Is xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" a special case in XML?
Posted
by Bytecode Ninja
on Stack Overflow
See other posts from Stack Overflow
or by Bytecode Ninja
Published on 2010-04-11T02:57:51Z
Indexed on
2010/04/11
3:03 UTC
Read the original article
Hit count: 540
When we use a namespace, we should also indicate where its associated XSD is located at, as can be seen 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 have indicated that Artist.xsd should be used for validating the http://www.webucator.com/Artist
namespace. However, we are also using the http://www.w3.org/2001/XMLSchema-instance
namespace, but we have not specified where its XSD is located at. How do XML parsers know how to handle this namespace?
Thanks in advance.
© Stack Overflow or respective owner