Use of Refrences Schema in XML

This article teach you how to references Schema in XML Document
  • 1980

Add Schema in an XML Document

It is also possible that we can referencing XML Schema in XML document

<?xml version="1.0"?>
<note xmlns="http://www.dotnetheaven.com"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.dotnetheaven.com note.xsd">
<to>pulkit</to>
<from>vijay</from>
<heading>Remember me</heading>
<body>Don't forget me this year</body>
</note>

Note: In the above declared code.

xmlns="http://www.dotnetheaven.com"

 

This indicate that default namespace declaration. it tells us the schema-vaidator and that all elements declared in XML document  in the xmlns="http://www.dotnetheaven.com" namespace.

 

xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

 

we can use the Schema-Location or Schema-instance attributes. This attributes always comes in the two value. first one is name and second it's value. And it separated by space, the first value contain namespace and second value contain location.

 

Example

xsi:schemaLocation="http://www.dotnetheaven.com note.xsd"

Further Readings

You may also want to read these related articles :

Ask Your Question 

Got a programming related question? You may want to post your question here

Programming Answers here

© 2019 DotNetHeaven. All rights reserved.