Quando si usa un namespace, si dovrebbe anche indicare dove suo XSD associato è situato in, come si può vedere nel seguente esempio:Is xmlns: xsi = "http://www.w3.org/2001/XMLSchema-instance" un caso speciale in XML?
<?xml version="1.0"?>
<Artist BirthYear="1958"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://www.webucator.com/Artist"
xsi:schemaLocation="http://www.webucator.com/Artist Artist.xsd">
<Name>
<Title>Mr.</Title>
<FirstName>Michael</FirstName>
<LastName>Jackson</LastName>
</Name>
</Artist>
Qui, abbiamo indicato che Artist.xsd dovrebbe essere utilizzato per validare lo spazio dei nomi http://www.webucator.com/Artist
. Tuttavia, stiamo anche utilizzando lo spazio dei nomi http://www.w3.org/2001/XMLSchema-instance
, ma non abbiamo specificato dove si trova il suo XSD. In che modo i parser XML sanno come gestire questo spazio dei nomi?
Update (in risposta al primo commentatore)
Quindi, possiamo invece di usare:
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:ehcache="http://www.springmodules.org/schema/ehcache"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
http://www.springmodules.org/schema/ehcache
http://www.springmodules.org/schema/cache/springmodules-ehcache.xsd">
...
</beans>
uso
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:ehcache="http://www.springmodules.org/schema/ehcache">
...
</beans>
?
Si prega di dare un'occhiata al post aggiornato. – Behrang