I just need to get the text of the corresponding tag and save it in the database. Since the xml file is large (4.5 GB), I am using sax. I used the character method to get the text and put it in the dictionary. However, when I print text using the endElement method, I get a new line instead of text.
Here is my code:
def characters(self,content): text = unescape(content)) self.map[self.tag]=text def startElement(self, name, attrs): self.tag = name def endElement (self, name) if (name=="sometag") print self.map[name]
Thanks in advance.
python xml sax
ablimit
source share