Keith Reynolds wrote:
(Forgive me if this is a repost)


Hello,
  I have seen some other postings with similar questions.  In general
there was agreement to work up a sample but none exists - that I can
find. I would like to use Xalan for XPATH searching and then allow removal
of some nodes.  I have tried using the wrapper and haven't had any
success.  The wrapper's function removeChild() fails with
NO_MODIFICATION_ALLOWED_ERR and I apparently can't call on the
XercesNode::removeChild() - because it's returned 'const' from
mapNode().


The call returns a pointer to const DOMNode, because Xalan-C never modifies the source tree, so that is codified in the function signatures. Since it's your DOM tree, you can feel free to cast away const to make the call with the Xerces-C instances:

        xerces_parent->removeChild(const_cast<DOMNode*>(xerces_node));

Note that you can never modify the document through the Xalan-C wrapper classes -- they do not support any of the mutating member functions of the DOM.

Dave

Reply via email to