我想在python中将XML文件转换为CSV文件。在下面附上一张hom XML文件的照片,我希望每个id(例如PZH01_MST_0690_00)都采用最小的trafficFlow,在这种情况下为:60。有人可以帮我吗?我猜有更多经验的人可以做到这一点很容易。本质上,我想将此XML文件转换为CSV并具有2列(其中1个具有ID,2个具有最低的trafficFlow)。任何帮助将不胜感激,谢谢!
<?xml version="1.0" encoding="UTF-8"?>
-<SOAP:Envelope xmlns:SOAP="http://schemas.xmlsoap.org/soap/envelope/">
-<SOAP:Body>
-<d2LogicalModel xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" modelBaseVersion="2" xmlns="http://datex2.eu/schema/2/2_0">
-<exchange>
-<supplierIdentification>
<country>nl</country>
<nationalIdentifier>NLNDW</nationalIdentifier>
</supplierIdentification>
</exchange>
-<payloadPublication lang="nl" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="MeasuredDataPublication">
<publicationTime>2019-10-31T11:12:42.005Z</publicationTime>
-<publicationCreator>
<country>nl</country>
<nationalIdentifier>NLNDW</nationalIdentifier>
</publicationCreator>
<measurementSiteTableReference targetClass="MeasurementSiteTable" version="1139" id="NDW01_MT"/>
-<headerInformation>
<confidentiality>noRestriction</confidentiality>
<informationStatus>real</informationStatus>
</headerInformation>
-<siteMeasurements xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<measurementSiteReference targetClass="MeasurementSiteRecord" version="6" id="PZH01_MST_0690_00"/>
<measurementTimeDefault>2019-10-31T11:11:00Z</measurementTimeDefault>
-<measuredValue index="1">
-<measuredValue>
-<basicData xsi:type="TrafficFlow">
-<vehicleFlow>
<vehicleFlowRate>720</vehicleFlowRate>
</vehicleFlow>
</basicData>
</measuredValue>
</measuredValue>
-<measuredValue index="2">
-<measuredValue>
-<basicData xsi:type="TrafficFlow">
-<vehicleFlow>
<vehicleFlowRate>60</vehicleFlowRate>
</vehicleFlow>
</basicData>
</measuredValue>
</measuredValue>
-<measuredValue index="3">
-<measuredValue>
-<basicData xsi:type="TrafficFlow">
-<vehicleFlow>
<vehicleFlowRate>60</vehicleFlowRate>
</vehicleFlow>
</basicData>
</measuredValue>
</measuredValue>
-<measuredValue index="4">
-<measuredValue>
-<basicData xsi:type="TrafficFlow