Using a
schema to define the structure, the elements and the attributes of an
XML document has many advantages over the DTD document. In a DTD you
can have only two types of data, the PCDATA and the CDATA.
_______________________________________________
In
a schema you can many types of data starting from the primitive type
that you use in the programming languages and to the complex type that
the user itself defines.
The primitive
types of data include byte, string, and integer, floating point numbers
and even country codes and language codes. In a schema you use an OO
approach in defining the format which is far more better than the DTD.
Based on
the core type of data the developer can build more complex types of
data using different operators and modifiers. Such complex data can
be used in an XML document.
By using
the object oriented approach the user can use inheritance and encapsulation
and apply them in creating the document. Other technologies like XQuery,
XPath, and XSLT are adopted easily if you are using a schema to define
an XML document.