You are viewing a plain text version of this content. The canonical link for it is here.
Posted to batik-users@xmlgraphics.apache.org by Judy Qiu <xq...@indiana.edu> on 2003/07/24 05:52:56 UTC

two DOM tress from one SVG file?

Hello, 

Can anybody help out with the problem I met with? The list is quite long... I will try to split the file into multiple mails.


--- Batik viewer version 1.5 beta 4
--- JDK1.4.1_01
--- Windows 2000 OS


This file lists execution results from a master client and a participating client in a collaborative SVG session. 
It shows that two different DOM trees generated from the same SVG file on two sides. There's no other operations other
than a click on a hyperlink. 

Both sides load in the same SVG file (file:/C:/batikscript/xml-batik/samples/tests/spec/linking/anchorInsideText.svg) from their local file system.
When the master client clicks on an hyperlink to load in another URI, a xpath of the node (element in this case) is generated and broadcast to 
the paticipating client.

The participating client generates an "java.lang.NullPointerException" when using the "xpath" from master to locate the hyperlink node (element).

The master client returns an "text" element along the xpath ("/0/14/1/10/1/1") as following
          +++collaborativesvgviewer.others.NodePathSupport.java==>>getElementofDOMTree==>>tempnode = getNodeItem(currentnode(a), xpath[4](1));
          +++collaborativesvgviewer.others.NodePathSupport.java==>>getNodeItem()==>> i=0, n.getNodeName()=#text
          +++collaborativesvgviewer.others.NodePathSupport.java==>>getElementofDOMTree==>>tempnode = text
                                                                                                  ^^^^^^^^^^^^
but the participating client uses the xpath ("/0/14/1/10/1/1") and returns an "text" node as following          
          +++collaborativesvgviewer.others.NodePathSupport.java==>>getElementofDOMTree==>>tempnode = getNodeItem(currentnode(a), xpath[4](1));
          +++collaborativesvgviewer.others.NodePathSupport.java==>>getNodeItem()==>> i=0, n.getNodeName()=#text
          +++collaborativesvgviewer.others.NodePathSupport.java==>>getElementofDOMTree==>>tempnode = #text
                                                                                                   ^^^^^^^^^^^^
          +++collaborativesvgviewer.others.NodePathSupport.java==>>getElementofDOMTree==>>tempnode = getNodeItem(currentnode(#text), xpath[5](1));

Re: two DOM tress from one SVG file?

Posted by Judy Qiu <xq...@indiana.edu>.
Thomas, thanks for your comments.
This result was actually produced before I added any filter to the DOM
tree -- namely, I scaned ALL_NODE along the path.
Currently I'm upgrading to the new release of batik 1.5.  Maybe I will ask
for your advice later on.

Cheers,
Judy



----- Original Message -----
From: "Thomas DeWeese" <Th...@Kodak.com>
To: "Batik Users" <ba...@xml.apache.org>
Sent: Thursday, July 24, 2003 7:01 AM
Subject: Re: two DOM tress from one SVG file?


> Judy Qiu wrote:
> > Hello,
> >
> > Can anybody help out with the problem I met with? The list is quite
> > long... I will try to split the file into multiple mails.
>
>     So I think there is a bug somewhere in your code or else I don't
> understand what the traces are showing (which is very possible).  From
> your trace in the client:
>
> getNodeItem(currentnode(a), xpath[4](1));
> +++collaborativesvgviewer.others.NodePathSupport.java==>>getNodeItem()==>>
i=0, n.getNodeName()=#text
>
+++collaborativesvgviewer.others.NodePathSupport.java==>>getElementofDOMTree
==>>tempnode = #text
>
+++collaborativesvgviewer.others.NodePathSupport.java==>>getElementofDOMTree
==>>tempnode = getNodeItem(currentnode(#text), xpath[5](1));
> j
>
> Why does this get the #text node?  it seems pretty clear from
> all the other cases you skip text nodes in your counts.  So child '1' of
> the 'a' should skip the whitespace #text node and get the 'text' element
(that
> you want).
>
> The only explination I can think of is that you have some sort of a
> "hack" that says if it is asking for child '1' include text nodes
> (otherwise it isn't clear how you expect to address them).  But without
> seeing the source I can't help you any more than this.
>
> Good luck!
>



---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org
For additional commands, e-mail: batik-users-help@xml.apache.org


Re: two DOM tress from one SVG file?

Posted by Thomas DeWeese <Th...@Kodak.com>.
Judy Qiu wrote:
> Hello,
>  
> Can anybody help out with the problem I met with? The list is quite 
> long... I will try to split the file into multiple mails.

    So I think there is a bug somewhere in your code or else I don't
understand what the traces are showing (which is very possible).  From
your trace in the client:

getNodeItem(currentnode(a), xpath[4](1));
+++collaborativesvgviewer.others.NodePathSupport.java==>>getNodeItem()==>> i=0, n.getNodeName()=#text
+++collaborativesvgviewer.others.NodePathSupport.java==>>getElementofDOMTree==>>tempnode = #text
+++collaborativesvgviewer.others.NodePathSupport.java==>>getElementofDOMTree==>>tempnode = getNodeItem(currentnode(#text), xpath[5](1));
j

	Why does this get the #text node?  it seems pretty clear from
all the other cases you skip text nodes in your counts.  So child '1' of
the 'a' should skip the whitespace #text node and get the 'text' element (that
you want).

The only explination I can think of is that you have some sort of a
"hack" that says if it is asking for child '1' include text nodes
(otherwise it isn't clear how you expect to address them).  But without
seeing the source I can't help you any more than this.

Good luck!

> --- Batik viewer version 1.5 beta 4
> --- JDK1.4.1_01
> --- Windows 2000 OS
>  
> 
> This file lists execution results from a master client and a 
> participating client in a collaborative SVG session.
> It shows that two different DOM trees generated from the same SVG file 
> on two sides. There's no other operations other
> than a click on a hyperlink.
> 
> Both sides load in the same SVG file 
> (file:/C:/batikscript/xml-batik/samples/tests/spec/linking/anchorInsideText.svg) 
> from their local file system.
> When the master client clicks on an hyperlink to load in another URI, a 
> xpath of the node (element in this case) is generated and broadcast to
> the paticipating client.
>  
> The participating client generates an "java.lang.NullPointerException" 
> when using the "xpath" from master to locate the hyperlink node (element).
>  
> The master client returns an "text" element along the xpath 
> ("/0/14/1/10/1/1") as following
>           
> +++collaborativesvgviewer.others.NodePathSupport.java==>>getElementofDOMTree==>>tempnode 
> = getNodeItem(currentnode(a), xpath[4](1));
>           
> +++collaborativesvgviewer.others.NodePathSupport.java==>>getNodeItem()==>> 
> i=0, n.getNodeName()=#text
>           
> +++collaborativesvgviewer.others.NodePathSupport.java==>>getElementofDOMTree==>>tempnode 
> = text
>                                                                                                   
> ^^^^^^^^^^^^
> but the participating client uses the xpath ("/0/14/1/10/1/1") and 
> returns an "text" node as following         
>           
> +++collaborativesvgviewer.others.NodePathSupport.java==>>getElementofDOMTree==>>tempnode 
> = getNodeItem(currentnode(a), xpath[4](1));
>           
> +++collaborativesvgviewer.others.NodePathSupport.java==>>getNodeItem()==>> 
> i=0, n.getNodeName()=#text
>           
> +++collaborativesvgviewer.others.NodePathSupport.java==>>getElementofDOMTree==>>tempnode 
> = #text
>                                                                                                    
> ^^^^^^^^^^^^
>           
> +++collaborativesvgviewer.others.NodePathSupport.java==>>getElementofDOMTree==>>tempnode 
> = getNodeItem(currentnode(#text), xpath[5](1));




---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org
For additional commands, e-mail: batik-users-help@xml.apache.org