TechArena Community

TechArena Community (http://forums.techarena.in/)
-   Software Development (http://forums.techarena.in/software-development/)
-   -   How to create XML Schema (http://forums.techarena.in/software-development/1169196.htm)

RogerFielden 27-04-2009 06:33 PM

How to create XML Schema
 
Hello,

Can anyone suggest me how to generate the XML scheme,I heard that we are able to generate XML schema for different types of DTDs(Document type Definition) and if this is true please let me know.
Please share if you have any good ideas.
Thanks.

Mecurtis 27-04-2009 07:03 PM

Re: How to create XML Schema
 
When XML first came out, there were DTDs (Document Type Definitions) that defined what the XML was going to look like and how it worked. But DTDs were written in yet another format than XML and so if you wanted to write XML applications you had to learn XML and how to write a DTD.

You can use XML to define just about any kind of text data that you might want to.

The purpose of a schema is to define your XML document. So, the easiest way to create a schema is to start with a basic XML document that you want to define.

for example if you select an Newsletter that document consists of a main element:

webwriter_newsletter

and five sub elements:
  • header
  • section1
  • section2
  • section3
  • section4

Each of the sub elements contains more elements, An element that contains a sub element is called a complex type, while elements that only contain text, numbers, or dates are called simple types.

pancham 27-04-2009 07:09 PM

Re: How to create XML Schema
 
An XML Schema describes the structure of an XML document.

following is the little example of XML schema:

Code:

<?xml version="1.0"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">

<xs:element name="note">
  <xs:complexType>
    <xs:sequence>
      <xs:element name="to" type="xs:string"/>
      <xs:element name="from" type="xs:string"/>
      <xs:element name="heading" type="xs:string"/>
      <xs:element name="body" type="xs:string"/>
    </xs:sequence>
  </xs:complexType>
</xs:element>

</xs:schema>



All times are GMT +5.5. The time now is 06:24 PM.