2013-05-21 8 views
16

mi stavo seguente erroreErrore: "il valore schemaLocation *** deve avere un numero pari di URI". su spazi dei nomi in dispatcher primavera

<Ignored XML validation warning> org.xml.sax.SAXParseException; lineNumber: 9; columnNumber: 55; 
SchemaLocation: schemaLocation value = 'http://www.springframework.org/schema/beans 
http://www.springframework.org/schema/beans/spring-beans-2.0.xsd 
http://www.springframework.org/schema/tx' must have even number of URI's. 

e la mia servlet dispatcher stavo avendo seguenti spazi dei nomi

<beans xmlns="http://www.springframework.org/schema/beans" 
     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
     xmlns:p="http://www.springframework.org/schema/p" 
     xmlns:aop="http://www.springframework.org/schema/aop" 
     xmlns:tx="http://www.springframework.org/schema/tx" 
     xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd 
     http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.0.xsd 
     http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.0.xsd"> 

e ho sostituito tutti al di sopra seguendo

<beans xmlns="http://www.springframework.org/schema/beans" 
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
       xsi:schemaLocation="http://www.springframework.org/schema/beans 
       http://www.springframework.org/schema/beans/spring-beans-2.5.xsd"> 

E il mio l'errore è scomparso.
Come è successo a qualcuno può dire ??

risposta

56

L'attributo schemaLocation fa riferimento a un documento dello schema XML per uno spazio dei nomi.

Fondamentalmente, quando si digita:

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

State dicendo: "ho intenzione di utilizzare il prefissoexpnsper gli elementi dello spazio dei nomihttp://www.example.comanche, quindi è possibile convalidare. quegli elementi, ottenere il file XSD schema perhttp://www.example.cominhttp://www.example.com/schema/example.xsd "

Quindi, in altre parole, il formato è:

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" 

E così via.

Ecco perché mi deve un numero pari a.


Ulteriori informazioni e esempi possono essere trovati here.

+0

Quindi come risolvere questo problema? Ti basta rimuovere 'xsi: schemaLocation' che non è formattato correttamente perché attualmente non sta facendo nulla? Capisci quale dovrebbe essere lo spazio dei nomi? Se é cosi, come? –

+0

@StephenOstermiller È possibile correggere (aggiungere la controparte a) la voce in 'xsi: schemaLocation' che lo rende irregolare, oppure, se non si conosce il valore corretto per il componente, rimuovere la voce (quindi non è necessario per rimuovere l'intero 'xsi: schemaLocation', anche se funzionerebbe altrettanto, suppongo). – acdcjunior