At 21.28 14/06/2005 +0200, Yotam Ofek wrote:
Alberto Massari wrote:
Hi Yotam,
At 19.27 14/06/2005 +0200, Yotam Ofek wrote:
I have two questions.
First of all, what is the difference between DOMBuilder and
XercesDOMParser? From what I understood, DOMBuilder is the DOM 3
equivilant of XercesDOMParser, but isn't the DOM 3 implementation in
Xerces not perfect? Which one should I use, DOMBuilder or XercesDOMParser?
Xerces is aligned with a draft of the DOM3 specs, that mandated the
parser to be called DOMBuilder (the final version changed it to be
LSBuilder). XercesDOMParser was the pre-DOM3 parser, when every
implementation chose its own method to build DOM trees from data. So they
are two approaches to do the same thing, and you should chose it
depending on whether you want to use the DOM3 style or not.
Personally, I don't like the setFeature-way of setting properties, as you
have to know the name of the features instead of invoking a method picked
from the header files; but that's just my personal feeling.
I didn't quite understand. Is the setFeature-way the DOM3 way, or the
pre-DOM3 way? And what exactly is invoking a method picked from the header
files?
Let's make an example: if you want the DOM parser to build comment nodes
you should do
domBuilder->setFeature(XMLUni::fgDOMComments, true);
or
xercesDOMParser->setCreateCommentNodes(true);
I prefer the latter, while DOM3 mandates the former. Just a personal
preference, though.
I would also like to know how I can get a DOMXPathEvaluator object,
either from DOMBuilder or from XercesDOMParser. I have no clue as to
where I can start, and the programming guide on the website has nothing
about XPath.
DOMXPathEvaluator is there just as an interface, that should be
implemented by a DOMImplementation that supports the feature "XPath"
(retrieved by DOMImplementation::getImplementation(L"LS XPath") for
instance). This implementation does not exist in the Xerces code, but you
could download Pathan (http://software.decisionsoft.com/pathanIntro.html).
I actually tried ::getImplementation(L"LS XPath 1.0"), but seeing as that
didn't work.
Unfortunately, I see that Pathan is compiled against Xerces 2.5.0, and I'd
be rather using the more recent version of Xerces. So either give up
XPath, or use Xalan, right?
You can compile it against the 2.6 version and see if it works; or you can
try using Xalan too.
Does anyone have any idea if there is a major performance issue if I use
Xalan XPath on Xerces DOM trees (that means I have to transform the Xerces
DOM tree to a Xalan equivilant, right)?
I haven't used Xalan, so I don't know the answer.
Alberto