How to Design a XML Document Easily
XML based document consists of XML tags which are nested within each other.
Tags are used to represent the elements. In order to understand the design
process of an XML document we should first understand these tags. There
are two types of tags in an XML document. First are the tags which represent
elements in the XML document. These are further classified into root element
and child elements. Second are the processing instruction tags. We will
discuss these later.
Consider the following example which explains the format of xml document:
is as below:
To design the XML document we have to create an XML schema which defines the basic structural elements and attributes in the document. Apart from this it is the responsibility of XML schema to define the data types of elements and attributes in the XML document.
Also the number of child elements and their order is also decided in the XML schema. The elements of an XML schema can be simple type or complex type. Simple types are those which can have only text. Text can be any XML defined data type like string, date, time etc. Complex type elements can have other elements and attributes.
Following are the examples of defining simple type and complex type elements in a XML schema.
Syntax for defining a simple type element is:
Corresponding part of XML schema would be
Now we will look into an example of complex type element. As we know complex type can have other elements and attributes. Consider the following case:
The corresponding element type definition for this complex element student would be
Here we have
two child elements: firstname and lastname. To ensure their order should
be same in the XML document as they are declared we have included <sequence>
| Generating XML Document Using Java servlet | How to Design a XML Document Easily |Understanding Advanced XML Concepts | Understanding Class Loaders in Java | Understanding The Basic Reasons for Development of XML | Understanding Various Methods of Formatting XML Data | Understanding XML Based Web Protocols | Working With ebXML An Indepth Overview | XML Database Program Knowing the Basic Concepts |
Amazon and the Amazon logo are trademarks of Amazon.com, Inc. or its affiliates.Copyright - © 2004 - 2019 - All Rights Reserved.