Hi ppl,
We are developing an open source project for fun as well as a for learning. To give you a brief idea of our project - its a client server application installer on XML as the repository and python is used for parsing and searching for elements. You may find the details here : http://code.google.com/p/ulair
Now, though I went through the working and parsing of XML in various Python ref material, but I just had a few queries like :
1) 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.
2) Is there any efficient way of searching for elements in a huge XML tree in python ?
3) Is there any way in which one can change the tag names or incorporate new elements ?
4) 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.
I know some of these questions are ignorant. However it would be a great help if you could give us some insight by answering them or pointing us to some other refrences. If you would like to know anything more about our project then please do let me know. Thank you so much once again. rgds Sameer
'You will be what you WILL to Be' -James Allen
On 14-Mar-07, at 11:09 AM, Sameer Niphadkar wrote:
- 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.
pyQt is there for Qt and pyglade also
- 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
- 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.
4) 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
Nikhil