XSD How To?

A reference to a DTD or an XML Schema is possible for the XML documents.

A Simple XML Document:

Note.xml:



  Sapna
  Tom
  Message
  Meeting on Monday at 11 AM.

A DTD File:

Note.dtd:






Explanation:

We are using the above DTD file to define the elements of the XML document note.xml. The four child elements: “to, from, heading, body” of the note element is defined in the first line. The type of the child elements: to, from, heading, body elements are defined as “#PCDATA”, in the line 2-5.

An XML Schema:

Note.xsd:





  
    
      
      
      
      
    
  



Explanation:

In the above example, we are using an XML Schema file to define the elements of the XML document “note.xml”. The note element contains other elements and is thus a complex type. The elements: to, from, heading, and body, do not contain other elements and are thus simple types.

A reference to a DTD:

A reference to a DTD is there for an XML document.

Example:






  Sapna
  Tom
  Message
  Meeting on Monday at 11 AM.

A reference to an XML Schema:

A reference to an XML Schema is there for an XML document.

Example:




  Sapna
  Tom
  Message
  Meeting on Monday at 11 AM.

Please follow and like us:
Content Protection by DMCA.com