Re: Why a DTD and not a XML-Schema ?
[email protected] Thu, 18 Dec 2003 20:12:49 +0100
| Newsgroups | gmane.linux.zynot.general |
|---|---|
| Message-ID | <[email protected]> |
Le 18/12/03 =E0 19:09, Andreas Pokorny a =E9crit:
Andreas> Hi,
Andreas> I am currently working on a xbuild ide. The main alpha feature w=
ill be the
Andreas> creation of valid xbuild files.=20
Hi,
Andreas> Why libxml2?
Andreas> - supports a lot of encodings, but converts to utf8. That makes =
writing
Andreas> of application code simpler.=20
ok.
Andreas> - faster than all the others...
any benchmarks you are refering too ?
Andreas> Don't be afraid, all suggestions corrections and .. are welcome=
d!=20
Andreas>=20
Andreas> I do have questions too:
Andreas> From my point of view, dtd's define a fixed hierachy of tags w=
ith
Andreas> attribute names and sub tags. While schemas define a fixed hiera=
rchy
Andreas> too, but allow finer control over the format of the character da=
ta
Andreas> within tags an attributes. Is that true? I was not able to read =
the full
you mean tags and attributes ?
if yes,
XML-SCHEMA allows that
see below
Andreas> spec of xml schema yet.=20
Andreas> -> The serialization library needs the fixed hierachy!
XML-Schema still allows you to to define a fixed hierarchy.
Here is a piece of XML-Schema to define your Person XML tag where the nam=
e's length=20
is 32 chars max. and of course the age is a positive integer: =20
<xs:simpleType name=3D"nameType">
<xs:restriction base=3D"xs:string">
<xs:maxLength value=3D"32"/>
</xs:restriction>
</xs:simpleType>
<xs:element name=3D"Person" type=3D"mt:PersonType"/>
<xs:complexType name=3D"PersonType" base=3D"xs:string">
<xs:attribute name=3D"age" type=3D"xs:non-negative-integer" use=3D"requi=
red" />
<xs:attribute name=3D"name" type=3D"nameType" use=3D"required"/>
</xs:complexType>
Maybe I should try to convert the DTD in a XML-Schema ?
See you
Pac