You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-users@xalan.apache.org by "Edward Q. Bridges" <eb...@argotec.de> on 2001/10/08 11:14:02 UTC

OH NO!! appendTextChild not implemented!

i'm trying to write (what i thought would be a) simple utility method. 
operating on a private Document, this method is given an xpath statement as a
parameter and returns a subtree of nodes from the Document as a new Document.

basically this is what i have:

private Document document; // initialized via constructor
public Document selectSubtreeAsDoc (String xpath) throws ...
{
        // Execute the XPath, and have it return the result
        Xobject result = eval(document, xpath, document);

        // employs jaxp methods to obtain a factory & document
        Document newdoc = getEmptyDocument();

        DocumentFragment docfrag = result.rtree(xpathSupport);

        if( null != docfrag ) {
                // tried all three of these, all generate the same error
                /* newdoc.appendChild( docFrag ); */
                /* newdoc.insertBefore( docFrag, null ); */
                newdoc.importNode( docFrag, true );
        }

        return newdoc;
}

but, when trying to do this, i get a DTMException: appendTextChild not yet
supported.  according to the comments for
org.apache.xml.dtm.ref.DTMDefaultBase#appendTextChild(), which appends a text
node to the end of the document, the issue seems to be that "End of the
document" needs to be better defined.  it would appear that i'm SOL.  

is there any possibility that we may be able to better define "end of the
document" in the context of appending a text child here on the list?  in this
regard, why is it even significant in the context of appendTextChild()?  why
should appendTextChild care if it's appending to the end of a document?
wouldn't it simply be appending a node to a node? shouldn't the context of
the node be irrelevant to it?

but i still need to a method which extracts a subtree given an xpath, does
anyone have any idea of a workaround that i could use to make this work for
now?  am i approaching this in the "correct" way?  

another thing that i'm not sure about is the rtree() method.  should i be
using a different method for getting a DocumentFragment from an Xobject?

thanks in advance!
--e--






--------------------------------------------
<argo_tec gmbh>
     ed.q.bridges
     tel. 089-368179.552
     fax 089-368179.79
     osterwaldstraße 10 
     (haus F eingang 21)
     80805 münchen
</argo_tec gmbh>
--------------------------------------------