XML.HTMLTeacher.Com
[Search] [Contact] [Sitemap]
XML
[Main]
[Schema]
[Validating the XML document against the Schema]
[Classes]
[XHTML]
[XML]
[CSS]
[Design]
[Programming]
[Marketing]

The XML Document
* Place the following namespaces into the XML document's RootElement statement.

<RootElement

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

xsi:noNamespaceSchemaLocation=
"http://www.domainname/folder/schema_name.xsd"
>

Example

<employees

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

xsi:noNamespaceSchemaLocation=
"../employees/employees_schema.xsd"
>

Explanation:

* "xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
states that the elements defined in the schema belong to the namespace of
http://www.w3.org/2001/XMLSchema-instance.

* "xsi:noNamespaceSchemaLocation=
"../employees/employees_schema.xsd"
states that the XML document will use the schema located at this address to be validated against.

The Schema Document
* Place the following namespace into the schema document's schema element statement.

<xsd:schema
xmlns:xsd = "http://www.w3.org/2001/XMLSchema">

Explanation:

* xmlns:xsd = "http://www.w3.org/2001/XMLSchema"
states that all the schema elements are to be prefixed with xsd. The prefix xsd: is used by convention to identify schema elements.

* Another prefix may be utilized provided that all the schema elements consistently use this same prefix.

How to Validate

* Upload both files to the same folder as indicated within the XML document's xsi:noNamespaceSchemaLocation declaration.

xsi:noNamespaceSchemaLocation=
"http://www.domainname/folder/schema_name.xsd"


Example

xsi:noNamespaceSchemaLocation=
"../employees/employees_schema.xsd"
>

* In the above example, both the .xml and .xsd files would be uploaded to the employees folder.

* Go to the Tools page and read the information about how to use the Schema Validator.



All materials, tutorials and content are copyrighted by HTMLTeacher.Com.
Any use of any material, tutorials and/or content provided by this site is prohibited without expressed written consent of the author.

Copyright ©2003 HTMLTeacher.Com and Sonia Weimann