3 ms·
If I had to do it today, I'd probably use DTD to validate the XML tag hierarchy and than use a programming language (with xpath) to validated the attribute and
by AlexanderDhoore 13y ago
If I had to do it today, I'd probably use DTD to validate the XML tag hierarchy and than use a programming language (with xpath) to validated the attribute and tag contents.
XML Schema tries to validate both the tag hierarchy and the contents, which requires data types and complicated definitions. So much overkill...
DTD and XPath are actually very nice and simple. This is the DTD equivalent of my XML Schema example above:
<!ELEMENT myElement (#PCDATA)>
<!ATTLIST myElement myAttribute CDATA>
I could see myself writing a small domain language and translate it to DTD, to make it even nicer.
- pjmlp 13y agoThe way I work around XML schema pain is to use visual tools for it, like the ones in Visual Studio, for example. Hand editing XML schema files is too much of a pain.
- mjn 13y agoMy impression is that this is considered the norm in the XML world: you're supposed to edit it via a specialized editor, not directly as raw text.