comp.text.xml
[Top] [All Lists]

Re: Tags v.s. Attributes

Subject: Re: Tags v.s. Attributes
From: David Carlisle
Date: Wed, 30 Jul 2008 00:01:59 +0100
Newsgroups: comp.text.xml


Stefan Ram wrote:
David Carlisle <david-news@xxxxxxxxxxxxxxxxxxxxx> writes:
That though is a restriction of DTD rather than of XML itself. Other XML validation languages such as XSD or Relax NG Schema, or schematron for exampes can all easily be used to constrain an attribute to be (for example) a white space separated list of integer values.

You can also create a validation language that can be used to constrain an attribute to be a valid Java program.

  However, the structure of such an attribute is not being
  described by the XML language anymore. The XML TR does not
  describe the Java syntax. So it is not provided by the XML TR.

  The XML TR describes a document made of elements and possibly
  attributes. It provides rules and names for these structural parts.

  XML provides rules and names for a list of IDREFs within an
  attribute, so this still »is« XML.

  But the XML TR does not provide rules and syntactical names
  (nonterminal symbols) for a list of integer numerals (integer
  literals) within an attribut.

  This is another language. It might be call »Relax-XML« or so.

  Such a valid Relax-XML document also can be a valid XML document.
  Insofar it »is« XML. But XML does not describe a special
  syntax for integer numerals within an attribute value. To XML,
  this is just an opaque attribute value. Interpreting this as a
  list of integers is not backed by the XML TR anymore, this needs
  the additional Relax specification.


there are lots of things the XML spec doesn't secify, but to say XML encoding lists of numbers (an SVG path attribute for example) isn't XML is a rather strange conclusion to draw. For a start a lot (quite possibly a majority) of XML is "just" well formed and not validated at all so the relative expressive strengths of validation languages are irrelevant. For documents that are to be validated, it's issentially irrelevant to the end user, the internal organisation and timing of the various working groups that mean that xml is split across a range of specifications, xml itself, xml names, sax, dom, xsd etc. If you just go by what's in the XML rec without relying on anything else, you can not even use any standard parsing model, so use fo XML woul dbe rather hard, or you may decide it's legal to use names like <a:b:c/> but then find that the vast majority of current xml tools follow the additinal constraints in the namespace spec and would reject such an element.

Actually even by your definition XML can do more than you imply: IDREFS isn't the only list type NMTOKENS for example would allow you to specify an attribute is a white space list of something, even if you can't, in DTD, restrict the tokens further to be just digits. But to say XML with lists of integers in an attribute isn't really XML because DTD can't validate the XML is just like saying that an XMl document containing english text isn't really XML because DTD can't enforce spell checking.
By that definition, what can XML be used for?

David

--
http://dpcarlisle.blogspot.com

<Prev in Thread] Current Thread [Next in Thread>
Privacy Policy