954,525 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Reading XML document using Python code and make Hash/list?

Hi there
I have following XML document that i want to read in python code. i know how to read, thing is i want to make hash/list from this XML document.

<?xml version="1.0" ?>


‐test_sourceId14521363.0.0ACCT1@TESTCUST
‐ FF
‐ sixseventest remark


‐ test-sourceId24521363.0.1ACCT2@TESTCUST4521363_0_1_04521363trader@TESTCUSTnull Maker Name
‐ CompletedFF
‐ 1.414401.41441.1695ABNnineteneleventest remark2
-----------------------------END OF XML FILE-----------------------------
How i can make a list/hash for furthur using in code? that i can access keys and values in furthur code.
I want to have result like this

Field [sourceId : test_sourceId1 , pmsId : 4521363.0.0,fundId:ACCT1@TESTCUST, and so on..............]

I dont want to use getElementsByTagName.And i am using xml.dom import minidom already.

sarfrazashfaq
Newbie Poster
12 posts since Mar 2010
Reputation Points: 10
Solved Threads: 0
 

You must write XML Parser using xml.sax.handler. Read this document

jcubic
Newbie Poster
2 posts since Feb 2010
Reputation Points: 10
Solved Threads: 0
 

if you want it done quickly, use xml.dom.minidom

ultimatebuster
Posting Whiz in Training
250 posts since Mar 2010
Reputation Points: 24
Solved Threads: 69
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You
View similar articles that have also been tagged: