Error: “schemaLocation value *** must have even number of URI's.” on namespaces in spring dispatcher

前端 未结 1 963
谎友^
谎友^ 2021-02-01 17:55

I was getting following error

 org.xml.sax.SAXParseException; lineNumber: 9; columnNumber: 55;
SchemaLocation: schemaLoca         


        
相关标签:
1条回答
  • 2021-02-01 18:31

    The schemaLocation attribute references an XML Schema document for a namespace.

    Basically when you type:

    xmlns:expns="http://www.example.com"
    xsi:schemaLocation="http://www.example.com
                        http://www.example.com/schema/example.xsd"
    

    You are saying: "I'm going to use the prefix expns for the elements of the namespace http://www.example.com. Also, so you can validate those elements, get the XSD Schema file for http://www.example.com in http://www.example.com/schema/example.xsd"

    So, in other words, the format is:

    xsi:schemaLocation="namespace-a   where_to_get_the_xsd_for_namespace-a
                        namespace-b   where_to_get_the_xsd_for_namespace-b
                        namespace-c   where_to_get_the_xsd_for_namespace-c"
    

    And so on.

    That's why it must me an even number.


    More info and examples can be found here.

    0 讨论(0)
提交回复
热议问题