A very common pattern (at least in my code) when using Xerces-J's DOM is to do
something like:
for(DOM_Node node = element.getFirstChild();
node != null;
node = node.getNextSibling()) {
if(node.getNodeType() == DOM_Node.ELEMENT_NODE) {
DOM_Element childElem = (DOM_Element) node;
//
// do some element specific behavior
I haven't found a good way to do the equivalent of:
DOM_Element childElem = (DOM_Element) node;
with Xerces-C. I think you could do somehting like:
DOM_Element childElem = *((DOM_Element*) &node);
but that seems pretty ugly and may be fatal if you didn't do the preliminary check for
getNodeType() == ELEMENT_NODE.
What I was thinking was that adding a constructor for DOM_Element that took a
DOM_Node& and would throw an exception if the node wasn't appropriate would allow you
to keep the Java pattern. (Of
course, you would want to do this for all the other DOM_Comment,
DOM_ProcessingInstruction, et al).
Maybe this could go into the new DOM implementation?
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]