[openroad-developer] Empire XML Support - Request to support
PI/Comment/CDATA
Bodo Bergmann
Bodo.Bergmann at ingres.com
Wed May 21 04:20:40 PDT 2008
During the second meeting yesterday there came up the requirement to
have ability to support
"comments" and "processing instructions" not only for the low-level
interface,
but also for the high-level interface, e.g. as attributes of the new
system classes
(i.e. the XMLElement).
I said, that the problem is, that if it would just be a simple attribute
of XMLElement,
we would have to define where to place the comments or processing
instructions.
There was an answer that this works in DOM with reference to the
nodeType of the DOMElement.
Actually that is not quite the same - the nodeType is nothing you can
set at runtime -
it's a read only property.
With DOM you create different kind of nodes using the DOMDocument's
methods.
In DOM you work with Nodes, rather with just Elements.
A node can be an Element, a Comment, a Processing Instruction (PI),
CDATA section - even an Attribute,
so the DOMDocument provides different methods for creating those node
types.
This is a different concept than the one we started with.
We tried to concentrate on the basic XML concepts of Document, Elements,
Attribute
(see also http://www.w3.org/TR/1998/REC-xml-19980210).
We don't have the intention to have all DOM features available -
the interface we provide is much simpler - with much less
classes/interfaces and attributes,
so we will not be able to implement everything that can be done with
DOM.
On the other hand we provide features that DOM can't provide -
as the low-level writer methods and the callbacks during parsing, which
will be implemented using SAX2 interfaces.
This is especially required when writing and reading very large XML
documents.
That is, the intention is to provide a simple, but flexible interface.
Ok, now back to solving the problem of comments/PI/CDATA:
The current functional spec does not provide support for all of this,
so we have to do something.
The possible solution I see is a new class hierarchy with additional
classes & attributes:
- XmlNode (abstract)
Subclasses:
- XmlElement
Attributes: Name, CharacterData, Attributes,
Children(Array of XmlNode)
(The Attribute "ChildElements" will be replaced by
"Children")
The Method names will have to be changed accordingly
(e.g. AddChild instead of AddChildElement)
- XmlCDATA
Attribute: Text (StringObject)
- XmlComment
Attribute: Text (StringObject)
- XmlProcessingInstruction
Attributes: Target (varchar(256)), Data (StringObject)
This gives us the ability to later extend the hierarchy with other
node-types if required.
The XmLAtribute and XmlDocument would basically remain the same,
additional low-level methods would be added to XmlDocument for writing
comments, PIs, and CDATA sections.
What do you think? Comments are much appreciated.
Regards,
Bodo.
Bodo Bergmann | Sr. Software Engineer | Bodo.Bergmann at ingres.com |
Ingres Germany GmbH | Ohmstr. 12 | 63225 Langen | GERMANY | +49 6103
9881 0
More information about the openroad-developer
mailing list