On Wed, 14 Mar 2007 Nikhil Marathe wrote :
- How does one get the exact value of an element down a tree like say : <abc><xyz><pqr>100</pqr></xyz></abc>
So in the above case say the value 100, though it could be a >>string >>as well. We require the exact value, not its representation >>in XML or >>ASCII value as explained by you in some books.
You could get the node's value and pass it to python's eval >function. Since eval returns the parsed python expression it will >give a logical return value like 100 as an int and abcd as a string
Rigth now we are importing minidom lib and trying to parse it by element names like :
reflist = xmldoc.getElementsByTagName("pqr") #For the case above ref = reflist[0]
Just as u mentioned..the node value. So do we need to pass reflist[0] i.e the 1st child here to the eval function ? Also could you please elaborate on this function.
- Is there any way in which one can change the tag names or
incorporate new elements ?
I am not that familiar with minidom but you can always copy all the >nodes attributes and children and remove the node and add another. >You should check the python library reference for the >xml.dom.minidompackage.
Thnx, yes we are going thru the mindom, but is there a method available in this case ?
- We are thinking about using QT for creating our frontend, how does
python integrate with it ? If you could suggest any other GUI >>Designer for python then it would be great.
Qt and Python have very good interoperability due to the PyQt >bindings. In addition the pyuic tool can convert the .ui files >generated by Qt Designer to Python code.Sorry I couldn't provide >links, but I am really sleepy right now :D
Np, but we just need to bind our script with QT, so I guess we may only need PyQT..am I right ? Thnks a lot for all the pointers though. rgds
Sameer
'You will be what you WILL to Be' -James Allen