sâmbătă, 20 octombrie 2007
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:
Postare comentarii (Atom)
Niciun comentariu:
Trimiteți un comentariu