Use of Refrences Schema in XML

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

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="https://dotnetheaven.com"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="https://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="https://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="https://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="https://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

© 2020 DotNetHeaven. All rights reserved.