[Home] [By Thread] [By Date] [Recent Entries]

  • From: John Cowan <cowan@m...>
  • To: Andrew Welch <andrew.j.welch@g...>
  • Date: Wed, 4 Jan 2012 11:44:42 -0500

Andrew Welch scripsit:

> Point 5.1 is interesting:
> 
> "All elements MUST contain either nothing, character content, or child
> elements.  Mixed content MUST NOT be used.  [Rationale: Many XML data
> models don't handle mixed content properly, and its use makes the
> element order-dependent.  As always, textual formats are not covered
> by this rule.]"
> 
> I'm guessing you mean don't use mixed content for data centric xml?

From the third paragraph of the introduction:

# This guide is meant for the design of XML that is to be generated
# and consumed by machines rather than human beings.  Its rules are not
# applicable to formats such as XHTML (which should be formatted as much
# like HTML as possible) or ODF which are meant to express rich text.

> Also 5.2
> 
> "XML elements that merely wrap repeating child elements SHOULD NOT be
> used.  [Rationale: They are not used in Atom and add nothing.]"
> 
> They really are helpful  - I'm having to process xml like this at the
> moment and it is a bit tedious, as typically the output will have some
> form of wrapper.  For example given:
> 
> <item>a</item>
> <item>b</item>
> 
> to output that as a html list:
> 
> <ul>
>   <il>a</li>
>   ...
> 
> you need to create the wrapper <ul> on the first occurrence of <item>,
> then process the rest from there.

A list of bullet points is a unified object, and an enclosing element
makes total sense.  What I was arguing against was this sort of thing:

<person>
  <name>Barack Obama</i>
  <children>
    <child>Malia Ann Obama</child>
    <child>Natasha Obama</child>
  </children>
  <employment>
    <job from="1997" to="2004">State senator</job>
    <job from="2005" to="2008">Senator</job>
    <job from="2008">President</job>
  </employment>
</person>

This looks pretty, but the "children" and "employment" elements don't really
add anything to the semantics.

If I were redoing this now, I'd add a rule saying "If order doesn't matter,
pick a fixed order such as alphabetical order or some kind of natural order.
Allowing order to be free but meaningless encourages the creation of
undocumented communications channels."

-- 
No,  John.  I want formats that are actually       John Cowan
useful, rather than over-featured megaliths that   http://www.ccil.org/~cowan
address all questions by piling on ridiculous      cowan@c...
internal links in forms which are hideously
over-complex. --Simon St. Laurent on xml-dev


[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index]


Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member