How can I read data present in a large XML file using SAX parser?. I want to transfer the data from XML into tables created in MS Access.
first of all, Python has modules that allow you to parse. I haven't used SAX, but I've used DOM. Here's the reference for all Structured Markup Processing Tools in Python:
Then, if your know the structure of your XML, the tags, the attributes, etc, it will be relatively easy to create the functions which parse the tags inward and extract the value of the attributes that interest you, which you can afterward send wherever you want:
def GetXmlList(XmlList): Dom = xml.dom.minidom.parse(XmlList) Root = Dom.getElementsByTagName(Root_Name) # Scan base list Level1= dict() Node = GetChild(Root, LEVEL1_nameTag) for Child in Node.childNodes: if Child.nodeType == Child.ELEMENT_NODE: Name = str(Child.nodeName) if not Name in Level1: Level1[Name] = Child # Scan file list Level2 = dict() Node = GetChild(Root, LEVEL2_nameTag) for Child in Node.childNodes: if Child.nodeType == Child.ELEMENT_NODE: Name = GetAttribut(Child, LEVEL2_nameAttr) if Name in ... #do whatever you want... return Level1, Level2...
Did I enlighten a bit?