W3C home > Mailing lists > Public > www-rdf-comments@w3.org > October to December 2007

RDF/XML Syntax Bug: Missing Parent Accessor

From: Sean B. Palmer <sean@miscoranda.com>
Date: Thu, 1 Nov 2007 10:01:25 +0000
Message-ID: <b6bb4d890711010301k46900d2dwa16ab8830450a385@mail.gmail.com>
To: www-rdf-comments@w3.org

Section 6 of the RDF/XML Syntax Specification (Revised) [1] says that
the parent property of the element information item in the XML Infoset
is required, but section 6.1.2 Element Event does not create a parent
accessor for that event.

Element events therefore do not have a parent accessor, and yet a
parent accessor on element events is made use of in the following
sections:

7.2.14 Production propertyElt
7.2.15 Production resourcePropertyElt
7.2.16 Production literalPropertyElt
7.2.17 Production parseTypeLiteralPropertyElt
7.2.18 Production parseTypeResourcePropertyElt
7.2.19 Production parseTypeCollectionPropertyElt
7.2.21 Production emptyPropertyElt

The intent must have been that element events are passed the element
information item's parent property to be set as a parent accessor.
That it does not specify this is a bug.

The specification could (should?) also have noted for convenience that
when one is to "create a new sequence of events" in 7.2.18 Production
parseTypeResourcePropertyElt, the setting of the parent accessor on
new element events may in practice have to take place in the handling
of propertyEltList if, for example, you're using a strictly streaming
XML parser.

In an implementation that I've written, for example, the child.parent
= e assignment in the following:

   def propertyEltList(self, e):
      for child in elements(e.children):
         child.parent = e
         self.propertyElt(child)

Is necessary due to the construction that takes place here:

   def parseTypeResourcePropertyElt(self, e):
      [...]
      local_name = u'Description'
      children = e.children
      base_uri = e.base_uri
      nodeElt = Element(local_name, rdf.name, children, base_uri, {}, e)
      nodeElt.subject = n
      self.nodeElement(nodeElt)

Given that e.children, a generator, cannot be consumed at that point.

Thanks,

[1] http://www.w3.org/TR/2004/REC-rdf-syntax-grammar-20040210/

-- 
Sean B. Palmer, http://inamidst.com/sbp/
Received on Thursday, 1 November 2007 10:01:35 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Friday, 21 September 2012 14:16:34 GMT