When we use the namespace, we must also indicate where its associated XSD is located, as shown in the following example:
<?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>
Here, we indicated that Artist.xsd should be used to check the http://www.webucator.com/Artist namespace. However, we also use the http://www.w3.org/2001/XMLSchema-instance namespace, but we did not indicate where its XSD is located. How do XML parsers know how to handle this namespace?
Update (in response to the first commenter)
So, can we instead use:
<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>
using
<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>
?
xml xml-namespaces xsd
Behrang
source share