I'm working on minidom.
My goal is to see whether an element already exists in the xml file before adding. I was using getElementsByTagName() to check weather the element already exists.
The code looks something like this:
Value = argv[1]
Expand|Select|Wrap|Line Numbers
- a = dom.getElementsByTagName(Name)[0].childNodes[0].nodeValue
- if (a!=Value):
- add elements.
- else:
- return
Can you people suggest me a good solution.
Is there any other method which I can use to find the element already exists or not in an xml file.
Thanks in advance.