1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
|
from xml.dom.minidom import *
def get_orthography(node):
a=node.nextSibling
print a.nodeName, a.lastChild.data
if a.nextSibling != None:
get_orthography(a)
def search_node(node, str_search):
for n in node.childNodes:
if n.nodeType == Node.ELEMENT_NODE
and n.nodeName == "orthography"
and n.lastChild.data == str_search:
get_orthography(n)
def load(str_search):
try:
xmldoc = parse(path_of_xmlfile)
node_racine=xmldoc.documentElement
search_node(node_racine, str_search)
except Exception, e:
print e |
Partager