不使用标记名将结构大型XML文件转换为CSV

2024-05-01 21:50:21 发布

您现在位置:Python中文网/ 问答频道 /正文

Iam正在尝试将大型XML文件转换为CSV格式,下面是我的代码和示例文件,示例文件(XML文件的一部分)

<PostalAddress>
    <Id>5464443597076195439</Id>
    <AddUserId>SYSTEM_USER</AddUserId>
    <AddDate>2013-01-05T18:08:42-06:00</AddDate>
    <LastPersistenceTransactionUserId>SYSTEM_USER</LastPersistenceTransactionUserId>
    <LastPersistenceTransactionDate>2013-07-11T08:21:34-05:00</LastPersistenceTransactionDate>
    <LastPersistenceTransactionType tc="2"/>
    <ExternalReferenceId>3200723</ExternalReferenceId>
    <SchemaVersion>2</SchemaVersion>
    <Type tc="1"/>
    <Usage tc="2"/>
    <Valid>true</Valid>
    <Overridable>true</Overridable>
    <Preferred>false</Preferred>
    <Line1>4849 RONSON CT</Line1>
    <Line2>STE 208</Line2>
    <City>SAN DIEGO</City>
    <State tc="6"/>
    <PostalCode>92111</PostalCode>
    <Country tc="1"/>
</PostalAddress>

下面是我的代码

^{2}$

Tags: 文件代码id示例xmlsystemtcuser