OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.


Help: OASIS Mailing Lists Help | MarkMail Help



   Re: [xml-dev] Invalid XML (rant)

[ Lists Home | Date Index | Thread Index ]

Thanks, Bob, for the great explanation.. I guess this part of the spec could be made more clear. However, if I had looked at some more legal XML files, perhaps I could have determined that my interpretation was incorrect..
BTW in case any more questions come from me, the reason I ask is because I am working on an XML parser in Pascal for a compiler course I'm taking. So far, so fun!
----- Original Message -----
Sent: Wednesday, October 20, 2004 4:46 PM
Subject: RE: [xml-dev] Invalid XML (rant)

It turned out, based on some private e-mail with Daniel that what confused him was the spec's wording in describing how well-formedness works: that each element must be inside one other element, and (I believe) he thought he had a problem with the name element being inside both the chapters and subsection elements.
He was confused by a sloppiness in XML terminology that has been around since SGML days but was unfortunately made official in the W3C Schema spec[1]: while XML 1.0 [2] (and SGML) carefully distinguished between element types and elements (with the object-oriented analogies being classes and instances), XSD replaced the term "element type" with "element" and "element" with "element item." "Element item," however, is just more of the abstruse vocabulary of the XSD Part 1 spec, and no one actually uses the phrase. (Try a Google search on "element item" and see what comes up.)
Now people refer to both a particular class of elements and a specific element instance as an "element," e.g. "DocBook's para element is similar to XHTML's p element" and "<p>this</p> is a p element." This won't confuse anyone who's been using XML long enough, but it's still sloppy terminology, and makes explanations to beginners and precise discussions among experts difficult. I asked about this in comments on an early draft of the XSD spec five years ago [3] and never heard a good explanation for why it was done. I just looked in the Infoset spec to see if that clarified at all; it never uses the term "element item," but it does say [4] that  "There is an element information item for each element appearing in the XML document." AAAAHHHHHH! (This calls for my old sig...)
Bob DuCharme          www.snee.com/bob           <bob@ 
snee.com>  "The elements be kind to thee, and make thy
spirits all of comfort!" Anthony and Cleopatra, III ii

From: Chiusano Joseph [mailto:chiusano_joseph@bah.com]
Sent: Tuesday, October 19, 2004 9:03 PM
To: Daniel Zingaro; xml-dev@lists.xml.org
Subject: RE: [xml-dev] Invalid XML

Adding to the point that Bob DuCharme made earlier: In XML Schema, it is not illegal to reference or declare (as a local declaration) an element within multiple "content models" (an example of a content model would be your <chapters> element and its subelements and any attributes). One approach within XML Schema would be to declare a global element <name> and reference it in the multiple content models (IMHO, this is the best approach versus re-declaring the element multiple times as a local declaration).
If, for some reason, the format of a global element <name> is different within the <subsection> content model than it is within the <chapters> content model (for example, a subsection name may be max 30 characters while a chapter name may be max 20 characters), one would could reference the global element <name> within the <chapters> content model, and declare a local element <name> within the <subsection> content model - or vice versa.
Kind Regards,
Joe Chiusano
Booz Allen Hamilton
Strategy and Technology Consultants to the World

From: Daniel Zingaro [mailto:daniel_zingaro@cogeco.ca]
Sent: Tuesday, October 19, 2004 3:50 PM
To: xml-dev@lists.xml.org
Subject: [xml-dev] Invalid XML

Hi all,
According to the XML specification, I believe the following nesting structure to be invalid in XML. However, rxp on my Windows machine issues no warnings to me when parsed. Is this in fact invalid?
 <?xml version="1.1"?>
<title>Book Name</title>
<name>first chapter</name>
<name>I expect this to be illegal, since name is defined in chapters,
and also somewhere else in its content, namely subsection.</name>
Thanks very much,


News | XML in Industry | Calendar | XML Registry
Marketplace | Resources | MyXML.org | Sponsors | Privacy Statement

Copyright 2001 XML.org. This site is hosted by OASIS