sâmbătă, 20 octombrie 2007
testing you XML + DTD
After I've created come simple XML and DTD files, I wanted to test what I've done. Unfortunately, after a little bit of searching over the net , I found out from here that, although Firefox displays and XML's and checks them to be well-formed, it does not support DTD validation of XML files, or any other kind of validation schemas such as XML Schema or Relax NG. So I started looking on the web for some other(free) XML - DTD validator. The first thing found was an online service : validome It is useful for checking XML and DTD files separately, but it doesn't help for validating an XML with the help of an DTD specification. After some more searching, I found two interesting Windows programs: XMLPad and Cooktop. I downloaded and installed the latter, and I found it really helpful. It is very easy to use, and it gets you straight to what you want, and that is checking/validating your files. Not to mention it supports a large variety of formats, such as XML, DTD, XSL, XSD, SVG.
to attribute or not to attribute...
As I was playing around with DTD validation for XML, I stumbled upon one of the policy decisions you have to make when specifying the structure of the XML elements: should you put the related data as child-elements, or as attributes? When first skimming through the DTD tutorial from W3Schools, it came as a surprise to me that the dilemma stated above got a whole section in the tutorial. But then , as I started to manually write a DTD specification, it occured to me that that section was not as far off-topic as I initially thought it was. In fact, you can easily write an XML and the related DTD validation file with no attributes at all - and heck, this is the recommended way of doing things, as attributes and ATTRLIST should be used only for metadata about elements. Probably that's also what the DTD specification designers had in mind, when creating special types for attributes such as ID, IDREF and IDREFS ( when it's clear that INT and LIST would have cover all these cases, and a lot more!).
Abonați-vă la:
Postări (Atom)