Error: S4s-elt-character: Non-whitespace Characters Are Not Allowed In Schema Elements Other Than 'xs:appinfo' And 'xs:documentation'

后端 未结 3 798
南笙
南笙 2020-12-21 14:18

I have this xml-Schema:

         


        
3条回答
  •  礼貌的吻别
    2020-12-21 14:40

    Stadt and Tabellenplatz mustn't be xml elements but need to be attributes of the element Fussballmannschaft. This pattern repeats with the inner elements.

    The schema also lacks structures to express repetition of elements (namely the Spieler element) and choices between player roles (Torwart,Verteidiger,Stuermer).

    The use of the xs:keyref in the schema definition appears to be incomplete - the referenced keys are not specified as xs:key elements. In order to demonstrate this use, a new root element Fussball is defined, which should reflect the intent of the schema to formalize the notion of soccer teams. This new root element harbors the key and keyref definitions for the club name attribute and will be needed anyway as soon as multiple teams are to be represented in in a file (there must be a single root element in an xml file ).

    The following pair of schema and sample passes the validation.

    Schema:

    
        
            
                
                    
                        
                            
                                
                                    
                                        
                                            
                                                
                                                    
                                                    
                                                
                                            
                                            
                                                
                                                    
                                                    
                                                
                                            
                                            
                                                
                                                    
                                                    
                                                
                                            
                                        
                                        
                                        
                                        
                                    
                                
                            
                            
                            
                            
                        
    
                        
                            
                            
                        
                        
                            
                            
                        
                    
                
            
    
            
            
                
                
            
    
            
            
                
                
            
        
    
    

    XML:

    
        
            
                
            
            
                
            
            
                
            
        
    
    

    References

    • W3C XML Schema Definition
    • W3C XML Schema Definition / identity constraints
    • SO answer on the use of key and keyref

提交回复
热议问题