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" ?>
‐ <fxall category="buyer" version="2.0">
‐ <tradeStatus>
‐ <tradeFinancials>
<userDefinedFields Name="UDF_6">six</userDefinedFields>
<userDefinedFields Name="UDF_7">seven</userDefinedFields>
<remarks>test remark</remarks>

‐ <fxall category="buyer" version="2.0">
‐ <tradeHeader>
<traderId>null Maker Name</traderId>
‐ <tradeStatus>
‐ <tradeFinancials>
<userDefinedFields Name="UDF_9">nine</userDefinedFields>
<userDefinedFields Name="UDF_10">ten</userDefinedFields>
<userDefinedFields Name="UDF_11">eleven</userDefinedFields>
<remarks>test remark2</remarks>

-----------------------------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.

Recommended Answers

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

Jump to Post

All 2 Replies

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

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

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.21 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.