Hello, 
  Here is are some snippets from my code and also a little explanation which
part what is doing and what is it's purpose.
  
  For walking through all nodes I made a NodeWallker of the svg document I
made this class. This class has a walk method which traverses the whole tree
and asks the visitor class to do something over some of the nodes. ( In my
case these nodes should be tspan and text nodes. ).
   
     Here is the sugnature of the walk method:
     public void walk(Node rootNode, NodeVisitor visitor) {
      ..........
     }
   Here is the invoking of the walk method:
   walker.walk(m_svgDocument.getRootElement(), ruleVisitor);
   
   Where the m_svgDocument is created from the code shown below:
       SAXSVGDocumentFactory df = new SAXSVGDocumentFactory(
       XMLResourceDescriptor.getXMLParserClassName() );
       df.setValidating(false);
       StringReader reader = new StringReader( svgContent );
                
       m_svgDocument = ( SVGOMDocument ) df.createSVGDocument(
fileAbsoluthPath, reader );
    
   And here is the code which I'm using for the retrieving of all tspan
nodes:
      NodeList childNodes = node.getChildNodes();
      for (int j = 0;j < childNodes.getLength();j++) {
                    Node childNode = childNodes.item(j);
                    if (isTSpanNode(childNode)) {
                        ...
                    }
       }
   
    Hope that this information will help. If you thing that the information
shown above is not enough, please let me know and I'll try to explain the
situation in better way.


Archie Cobbs-3 wrote:
> 
> I've never heard of this happening... they should always be returned in
> proper order.
> 
> There's may be something wrong with how you're accessing the child nodes.
> What does your loop look like?
> 
> -Archie
> 
> On Fri, Jan 2, 2009 at 12:09 PM, mgenov <[email protected]> wrote:
> 
>>
>> Hello guys,
>>  I'm encountering problem with the ordering of the tspan nodes in an svg
>> document. I have a document with text node and several child nodes of
>> type
>> tspan. My svg file looks similar to this one:
>>
>> <text stroke="blue" font-size="20" transform="matrix(1 0 0 1 20 40)">1
>>
>>                        <tspan dy="20">2</tspan>
>>
>>                        <tspan y="20">3</tspan>
>>
>>                        <tspan dy="20">4</tspan>
>>
>>                        <tspan y="60">5</tspan>
>>
>>                        <tspan dy="0">6</tspan>
>>
>> </text>
>>
>> The problem is that when I get all child nodes of the text node, the
>> resulted order is: 2 4 6 3 5. Does anyone know how can I get the same
>> order
>> as it is in the svg file?
>>
>> Thanks in advance.
>> --
>> View this message in context:
>> http://www.nabble.com/SVGOMDocument-and-getChildNodes-ordering-tp21254983p21254983.html
>> Sent from the Batik - Users mailing list archive at Nabble.com.
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [email protected]
>> For additional commands, e-mail: [email protected]
>>
>>
> 
> 
> -- 
> Archie L. Cobbs
> 
> 

-- 
View this message in context: 
http://www.nabble.com/SVGOMDocument-and-getChildNodes-ordering-tp21254983p21263112.html
Sent from the Batik - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to