Skip to content Skip to sidebar Skip to footer

Xml Elementree Missing Elements Python

I've been trying to parse an xml file (JMdict_e.xml) for translation purposes. However, parsing of the whole file returns an incomplete dataset. Code: tree2 = ET.ElementTree(file =

Solution 1:

What I think that happens here is that you are looking at two different nodes. If you take a look at the ent_seq of the first code. You will see that it is 1582510. I've searched for it in the original file as well as dumped the XML object using ET.dump and the object you are actually analyzing is this:

<entry><ent_seq>1582510</ent_seq><k_ele><keb>内股膏薬</keb></k_ele><r_ele><reb>うちまたこうやく</reb></r_ele><r_ele><reb>うちまたごうやく</reb></r_ele><sense><pos>noun (common) (futsuumeishi)</pos><misc>yojijukugo</misc><glossxml:lang="eng">double-dealer</gloss><glossxml:lang="eng">fence-sitter</gloss><glossxml:lang="eng">timeserver</gloss><glossxml:lang="eng">moving back and forth between two sides in a     conflict</gloss><glossxml:lang="eng">duplicity</gloss><glossxml:lang="eng">turncoat</gloss></sense></entry>

Which is equivalent of the output you get in first code. The second code is actually analyzing the object with ent_seq1582430 which is a completely different object.

Post a Comment for "Xml Elementree Missing Elements Python"