I've written some simple python to fetch data in nodes from a ParsedXML
document.
The problem I am having is trying to figure out how many nodes are in an
XML document.
Below is my code that reads in the nodes.
It actually works somehow!
However at the moment I am checking the data in every node to see if it
is an end tag which kind of sucks :)
What is exposed in ParsedXML to tell me how many nodes I have?
### Python to read in Nodes ...
import string
a = 0;
b = 0;
i = 0;
cell = 0;
print "<tr>";
obj = getattr(context, name);
while ( a == 0 ):
objb = obj.childNodes[0][i];
i = i + 1;
myobj = str(objb.firstChild);
if myobj[9:len(myobj)-3] == "xml-end" : a = 1;
if myobj[9:len(myobj)-3] == "." : b = 1;
if ( a == 0 ):
if ( len(myobj) > 2 ) :
cell = cell + 1;
if ( b == 0 ) : print "<td bgcolor=",color,"><p>" ,
myobj[9:len(myobj)-3] , "</p></td>";
if ( b == 1 ) : print "<td bgcolor=",color,"><p></p></td>";
b = 0;
if ( cell == 6 ) :
print "</tr><tr>";
cell = 0;
return printed;
___________________________
Damien Connolly
Development Engineer
Right Hemisphere
www.righthemisphere.com
NZ Ph: +64.9.523.4670
NZ Fax: +64.9.523.4671
___________________________
|