On Mar 2, 4:58 pm, "redcic" <cedric.lou...@gmail.com>
wrote:
I would like to build a xml file using Xerces. I know how
to build a single node at a time.
However, what I would like to be able to do is to use a
XPath-like syntax to build my xml file. Something of the
type:
myElement = doc.createElement('parentName/elementName')
That sounds like a rather bad idea to me. Why invent a
primitive, non-standard language, easily confused with
XPath, which *is* standard but addresses a wholly different
problem domain (to quote from the spec: 'XPath is a
language for addressing parts of an XML document'), and
incurring a penalty for parsing that language run-time?
Especially since a standard language for serializing XML
DOM Documents and XML DOM Document Fragments as plain text
already exists. Hint: it's called XML.
where on can recognize a XPath syntax in
'parentName/elementName'.
Like that's a good thing. How do you add attributes or text
nodes? What if someone experiences a braino and attempts to
stuff a predicate in your 'XPath' expression?
What class of Xerces allows me to do that ?
What gave you an idea a class like that would exist?
Either use XML (and suffer run-time performance penalty for
parsing it) or stuff all the elements you need created into
a container and iterate until blue in the face. This
'XPath' thingo you came up with combines the worst of both
worlds.
--
roy axenov