You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@xalan.apache.org by "Brininstool, Allen" <al...@eds.com> on 2001/02/20 23:38:38 UTC

Working with the Elem... and XObject families

I am writing a couple of extension elements, one of which takes a value or a
tree and stores it, the other simply retrieves the stored value or tree
later. I would like to store trees as Document objects.

The xml for this example is:

<link>
	<path>some text</path>
	<path>some more text</path>
</link>


my first extension element is:

<myExt:setVariable name="paths" select="//link/path"/>

When I resolve the select attribute, I get an XObject of type
XObject.CLASS_NODESET. After calling rtree(transformer.getXPathContext()) to
get a DocumentFragment, I am attempting to then place the fragment into a
new Document object for storing. When I try to call importNode(df, true), I
get Function not supported! when UnImplNode.cloneNode(boolean) is called.

I get a similar result when I code:

<myExt:setVariable name="paths"><link><path>some text</path><path>some more
text</path></link></myExt:setVariable>

Only this time, the processing is slightly different because I get an
ElemLiteralResult object when I resolve the element to the tree. When I
attempt to import the Node into a Document I get a similar result, only this
time the error occurs when UnImplNode.getImplementation() is called.

It looks like these objects can't be used with DOM even though they
implement the interfaces. Please help with code if I'm not using the correct
techniques to process these objects.

thanks in advance.


Allen Brininstool
EDS bluesphere - Emerging Technology Lab



Re: Working with the Elem... and XObject families

Posted by Gary L Peskin <ga...@firstech.com>.
"Brininstool, Allen" wrote:
> 
> I am writing a couple of extension elements, one of which takes a value or a
> tree and stores it, the other simply retrieves the stored value or tree
> later. I would like to store trees as Document objects.
> 
> The xml for this example is:
> 
> <link>
>         <path>some text</path>
>         <path>some more text</path>
> </link>
> 
> my first extension element is:
> 
> <myExt:setVariable name="paths" select="//link/path"/>
> 
> When I resolve the select attribute, I get an XObject of type
> XObject.CLASS_NODESET. After calling rtree(transformer.getXPathContext()) to
> get a DocumentFragment, I am attempting to then place the fragment into a
> new Document object for storing. When I try to call importNode(df, true), I
> get Function not supported! when UnImplNode.cloneNode(boolean) is called.
> 
> I get a similar result when I code:
> 
> <myExt:setVariable name="paths"><link><path>some text</path><path>some more
> text</path></link></myExt:setVariable>
> 
> Only this time, the processing is slightly different because I get an
> ElemLiteralResult object when I resolve the element to the tree. When I
> attempt to import the Node into a Document I get a similar result, only this
> time the error occurs when UnImplNode.getImplementation() is called.
> 
> It looks like these objects can't be used with DOM even though they
> implement the interfaces. Please help with code if I'm not using the correct
> techniques to process these objects.
> 
> thanks in advance.

Allen --

It's a little difficult to tell from your description exactly what
you're trying to do.  What DOM implementation are you using to add your
DocumentFragment into your Document?  If you are using Stree, this was
not designed to allow modifications to a DOM tree, I believe.  You might
want to switch to using Xerces for your DOM implementation.

If this is not the case, please excuse me.  Perhaps a little more
information will set me onto the right track.

Gary