使用python读取并使用XML文件中的属性



我正在编写InDesign文件中的一些数据的脚本,并且我能够成功地将其写入XML文件,而这与类似

<?xpacket begin="" id="W5M0MpCehiHzreSzNTczkc9d"?>
<x:xmpmeta xmlns:x="adobe:ns:meta/" x:xmptk="Adobe XMP Core 6.0-c004 79.164570, 2020/11/18-15:51:46        ">
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
<rdf:Description rdf:about=""
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:xmp="http://ns.adobe.com/xap/1.0/"
xmlns:xmpTPg="http://ns.adobe.com/xap/1.0/t/pg/"
xmlns:xmpGImg="http://ns.adobe.com/xap/1.0/g/img/"
xmlns:xmpMM="http://ns.adobe.com/xap/1.0/mm/"
xmlns:stEvt="http://ns.adobe.com/xap/1.0/sType/ResourceEvent#"
xmlns:stMfs="http://ns.adobe.com/xap/1.0/sType/ManifestItem#"
xmlns:stRef="http://ns.adobe.com/xap/1.0/sType/ResourceRef#"
xmlns:idPriv="http://ns.adobe.com/xmp/InDesign/private"
xmlns:xmpG="http://ns.adobe.com/xap/1.0/g/"
xmlns:stFnt="http://ns.adobe.com/xap/1.0/sType/Font#">
<dc:format>application/x-indesign</dc:format>
<xmp:CreateDate>2020-12-08T11:45:46+05:30</xmp:CreateDate>
<xmp:MetadataDate>2020-12-22T12:13:16+05:30</xmp:MetadataDate>
<xmp:ModifyDate>2020-12-22T12:13:16+05:30</xmp:ModifyDate>
<xmp:CreatorTool>Adobe InDesign 16.1 (Windows)</xmp:CreatorTool>
<xmp:PageInfo>
<rdf:Seq>
<rdf:li rdf:parseType="Resource">
<xmpTPg:PageNumber>1</xmpTPg:PageNumber>
<xmpGImg:format>JPEG</xmpGImg:format>
<xmpGImg:width>256</xmpGImg:width>
<xmpGImg:height>256</xmpGImg:height>
<xmpGImg:image>/9j/4AAQSkZJRgABAgEASABIAAD/7QAsUGhvdG9zaG9wIDMuMAA4QklNA+0AAAAAABAASAAAAAEA&#x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;UpJSklKSUpJSklKSUpJT/9k=</xmpGImg:image>
</rdf:li>
</rdf:Seq>
</xmp:PageInfo>
<xmpMM:InstanceID>xmp.iid:73585586-53e2-4949-9f7e-6082b21a6b6f</xmpMM:InstanceID>
<xmpMM:DocumentID>xmp.did:07a9a7cc-7a07-2246-8e05-48bafeb158ec</xmpMM:DocumentID>
<xmpMM:OriginalDocumentID>xmp.did:07a9a7cc-7a07-2246-8e05-48bafeb158ec</xmpMM:OriginalDocumentID>
<xmpMM:History>
<rdf:Seq>
<rdf:li rdf:parseType="Resource">
<stEvt:action>created</stEvt:action>
<stEvt:instanceID>xmp.iid:07a9a7cc-7a07-2246-8e05-48bafeb158ec</stEvt:instanceID>
<stEvt:when>2020-12-08T11:45:46+05:30</stEvt:when>
<stEvt:softwareAgent>Adobe InDesign 16.0 (Windows)</stEvt:softwareAgent>
</rdf:li>
<rdf:li rdf:parseType="Resource">
<stEvt:action>saved</stEvt:action>
<stEvt:instanceID>xmp.iid:455c41f0-2c49-5048-95e8-b596a61ac06f</stEvt:instanceID>
<stEvt:when>2020-12-08T12:25:37+05:30</stEvt:when>
<stEvt:softwareAgent>Adobe InDesign 16.0 (Windows)</stEvt:softwareAgent>
<stEvt:changed>/</stEvt:changed>
</rdf:li>
<rdf:li rdf:parseType="Resource">
<stEvt:action>saved</stEvt:action>
<stEvt:instanceID>xmp.iid:ad8819ac-ec78-374b-8271-09130352ff65</stEvt:instanceID>
<stEvt:when>2020-12-08T12:25:37+05:30</stEvt:when>
<stEvt:softwareAgent>Adobe InDesign 16.0 (Windows)</stEvt:softwareAgent>
<stEvt:changed>/metadata</stEvt:changed>
</rdf:li>
<rdf:li rdf:parseType="Resource">
<stEvt:action>saved</stEvt:action>
<stEvt:instanceID>xmp.iid:ee771fd0-3139-f944-908a-8ef3fce53753</stEvt:instanceID>
<stEvt:when>2020-12-08T12:30:29+05:30</stEvt:when>
<stEvt:softwareAgent>Adobe InDesign 16.0 (Windows)</stEvt:softwareAgent>
<stEvt:changed>/</stEvt:changed>
</rdf:li>
<rdf:li rdf:parseType="Resource">
<stEvt:action>saved</stEvt:action>
<stEvt:instanceID>xmp.iid:73585586-53e2-4949-9f7e-6082b21a6b6f</stEvt:instanceID>
<stEvt:when>2020-12-22T12:13:16+05:30</stEvt:when>
<stEvt:softwareAgent>Adobe InDesign 16.1 (Windows)</stEvt:softwareAgent>
<stEvt:changed>/</stEvt:changed>
</rdf:li>
</rdf:Seq>
</xmpMM:History>
<xmpMM:RenditionClass>default</xmpMM:RenditionClass>
<xmpMM:Manifest>
<rdf:Bag>
<rdf:li rdf:parseType="Resource">
<stMfs:linkForm>ReferenceStream</stMfs:linkForm>
<stMfs:reference rdf:parseType="Resource">
<stRef:lastURL>http://serverpath/abc.psd</stRef:lastURL>
</stMfs:reference>
<xmpMM:placedXResolution>72.00</xmpMM:placedXResolution>
<xmpMM:placedYResolution>72.00</xmpMM:placedYResolution>
<xmpMM:placedResolutionUnit>Inches</xmpMM:placedResolutionUnit>
</rdf:li>
<rdf:li rdf:parseType="Resource">
<stMfs:linkForm>ReferenceStream</stMfs:linkForm>
<stMfs:reference rdf:parseType="Resource">
<stRef:lastURL>http://serverpath/abc.jpg</stRef:lastURL>
</stMfs:reference>
<xmpMM:placedXResolution>72.00</xmpMM:placedXResolution>
<xmpMM:placedYResolution>72.00</xmpMM:placedYResolution>
<xmpMM:placedResolutionUnit>Inches</xmpMM:placedResolutionUnit>
</rdf:li>
<rdf:li rdf:parseType="Resource">
<stMfs:linkForm>ReferenceStream</stMfs:linkForm>
<stMfs:reference rdf:parseType="Resource">
<stRef:lastURL>http://serverpath/abc.indd</stRef:lastURL>
</stMfs:reference>
<xmpMM:placedXResolution>72.00</xmpMM:placedXResolution>
<xmpMM:placedYResolution>72.00</xmpMM:placedYResolution>
<xmpMM:placedResolutionUnit>Inches</xmpMM:placedResolutionUnit>
</rdf:li>
<rdf:li rdf:parseType="Resource">
<stMfs:linkForm>ReferenceStream</stMfs:linkForm>
<stMfs:reference rdf:parseType="Resource">
<stRef:lastURL>http://serverpath/abc.png</stRef:lastURL>
</stMfs:reference>
<xmpMM:placedXResolution>72.00</xmpMM:placedXResolution>
<xmpMM:placedYResolution>72.00</xmpMM:placedYResolution>
<xmpMM:placedResolutionUnit>Inches</xmpMM:placedResolutionUnit>
</rdf:li>
<rdf:li rdf:parseType="Resource">
<stMfs:linkForm>ReferenceStream</stMfs:linkForm>
<stMfs:reference rdf:parseType="Resource">
<stRef:instanceID>xmp.iid:45d0e558-56ba-4d54-9b4e-842e56a27460</stRef:instanceID>
<stRef:documentID>xmp.did:6fa23242-08de-4c1a-b9c8-97b4ab533a00</stRef:documentID>
<stRef:lastURL>http://serverpath/abc1.psd</stRef:lastURL>
</stMfs:reference>
<xmpMM:placedXResolution>300.00</xmpMM:placedXResolution>
<xmpMM:placedYResolution>300.00</xmpMM:placedYResolution>
<xmpMM:placedResolutionUnit>Inches</xmpMM:placedResolutionUnit>
</rdf:li>
<rdf:li rdf:parseType="Resource">
<stMfs:linkForm>ReferenceStream</stMfs:linkForm>
<stMfs:reference rdf:parseType="Resource">
<stRef:lastURL>http://serverpath/abc123.psd</stRef:lastURL>
</stMfs:reference>
<xmpMM:placedXResolution>72.00</xmpMM:placedXResolution>
<xmpMM:placedYResolution>72.00</xmpMM:placedYResolution>
<xmpMM:placedResolutionUnit>Inches</xmpMM:placedResolutionUnit>
</rdf:li>
</rdf:Bag>
</xmpMM:Manifest>
<xmpMM:Ingredients>
<rdf:Bag>
<rdf:li rdf:parseType="Resource">
<stRef:instanceID>xmp.iid:00a4ff1f-df49-734e-ba96-0714724feadf</stRef:instanceID>
<stRef:documentID>xmp.did:00a4ff1f-df49-734e-ba96-0714724feadf</stRef:documentID>
<stRef:fromPart>/</stRef:fromPart>
<stRef:toPart>/</stRef:toPart>
<stRef:linkForm>ReferenceStream</stRef:linkForm>
<stRef:linkCategory>Content</stRef:linkCategory>
<stRef:filePath>http://serverpath/abc123.psd</stRef:filePath>
<stRef:placedXResolution>72.00</stRef:placedXResolution>
<stRef:placedYResolution>72.00</stRef:placedYResolution>
<stRef:placedResolutionUnit>Inches</stRef:placedResolutionUnit>
<stRef:maskMarkers>None</stRef:maskMarkers>
</rdf:li>
<rdf:li rdf:parseType="Resource">
<stRef:instanceID>xmp.iid:6d143f21-f207-de43-9e2d-f9464dbb6292</stRef:instanceID>
<stRef:documentID>xmp.did:6d143f21-f207-de43-9e2d-f9464dbb6292</stRef:documentID>
<stRef:fromPart>/</stRef:fromPart>
<stRef:toPart>/</stRef:toPart>
<stRef:linkForm>ReferenceStream</stRef:linkForm>
<stRef:linkCategory>Content</stRef:linkCategory>
<stRef:filePath>http://serverpath/abc12.psd</stRef:filePath>
<stRef:placedXResolution>300.00</stRef:placedXResolution>
<stRef:placedYResolution>300.00</stRef:placedYResolution>
<stRef:placedResolutionUnit>Inches</stRef:placedResolutionUnit>
<stRef:maskMarkers>None</stRef:maskMarkers>
</rdf:li>
<rdf:li rdf:parseType="Resource">
<stRef:instanceID>xmp.iid:ab277e52-2f6d-3f4e-a3b9-b75cb636040b</stRef:instanceID>
<stRef:documentID>xmp.did:ab277e52-2f6d-3f4e-a3b9-b75cb636040b</stRef:documentID>
<stRef:fromPart>/</stRef:fromPart>
<stRef:toPart>/</stRef:toPart>
<stRef:linkForm>ReferenceStream</stRef:linkForm>
<stRef:linkCategory>Content</stRef:linkCategory>
<stRef:filePath>http://serverpath/abc123.jpg</stRef:filePath>
<stRef:placedXResolution>72.00</stRef:placedXResolution>
<stRef:placedYResolution>72.00</stRef:placedYResolution>
<stRef:placedResolutionUnit>Inches</stRef:placedResolutionUnit>
<stRef:maskMarkers>None</stRef:maskMarkers>
</rdf:li>
<rdf:li rdf:parseType="Resource">
<stRef:instanceID>xmp.iid:ad7566ec-121c-8a4d-a2c1-fde2a4b4d638</stRef:instanceID>
<stRef:documentID>xmp.did:ad7566ec-121c-8a4d-a2c1-fde2a4b4d638</stRef:documentID>
<stRef:fromPart>/</stRef:fromPart>
<stRef:toPart>/</stRef:toPart>
<stRef:linkForm>ReferenceStream</stRef:linkForm>
<stRef:linkCategory>Content</stRef:linkCategory>
<stRef:filePath>http://serverpath/abc1123.psd</stRef:filePath>
<stRef:placedXResolution>72.00</stRef:placedXResolution>
<stRef:placedYResolution>72.00</stRef:placedYResolution>
<stRef:placedResolutionUnit>Inches</stRef:placedResolutionUnit>
<stRef:maskMarkers>None</stRef:maskMarkers>
</rdf:li>
<rdf:li rdf:parseType="Resource">
<stRef:instanceID>xmp.iid:e8c61cfd-a25b-504c-b14f-adc3439a9a7c</stRef:instanceID>
<stRef:documentID>xmp.did:e8c61cfd-a25b-504c-b14f-adc3439a9a7c</stRef:documentID>
<stRef:fromPart>/</stRef:fromPart>
<stRef:toPart>/</stRef:toPart>
<stRef:linkForm>ReferenceStream</stRef:linkForm>
<stRef:linkCategory>Content</stRef:linkCategory>
<stRef:filePath>http://serverpath/abc123_345.psd</stRef:filePath>
<stRef:placedXResolution>72.00</stRef:placedXResolution>
<stRef:placedYResolution>72.00</stRef:placedYResolution>
<stRef:placedResolutionUnit>Inches</stRef:placedResolutionUnit>
<stRef:maskMarkers>None</stRef:maskMarkers>
</rdf:li>
<rdf:li rdf:parseType="Resource">
<stRef:instanceID>xmp.iid:f586dead-3831-0d4f-a94b-866e7b20c66b</stRef:instanceID>
<stRef:documentID>xmp.did:f586dead-3831-0d4f-a94b-866e7b20c66b</stRef:documentID>
<stRef:fromPart>/</stRef:fromPart>
<stRef:toPart>/</stRef:toPart>
<stRef:linkForm>ReferenceStream</stRef:linkForm>
<stRef:linkCategory>Content</stRef:linkCategory>
<stRef:filePath>http://serverpath/abc123_09.indd</stRef:filePath>
<stRef:placedXResolution>72.00</stRef:placedXResolution>
<stRef:placedYResolution>72.00</stRef:placedYResolution>
<stRef:placedResolutionUnit>Inches</stRef:placedResolutionUnit>
<stRef:maskMarkers>None</stRef:maskMarkers>
</rdf:li>
</rdf:Bag>
</xmpMM:Ingredients>
<idPriv:DocChangeCount>1</idPriv:DocChangeCount>
<idPriv:keyStampMp>AAAAAA==</idPriv:keyStampMp>
<xmpTPg:Colorants>
<rdf:Seq>
<rdf:li rdf:parseType="Resource">
<xmpG:swatchName>Black</xmpG:swatchName>
<xmpG:mode>RGB</xmpG:mode>
<xmpG:type>Process</xmpG:type>
<xmpG:red>0</xmpG:red>
<xmpG:green>0</xmpG:green>
<xmpG:blue>0</xmpG:blue>
</rdf:li>
<rdf:li rdf:parseType="Resource">
<xmpG:swatchName>Paper</xmpG:swatchName>
<xmpG:mode>CMYK</xmpG:mode>
<xmpG:type>Process</xmpG:type>
<xmpG:cyan>0</xmpG:cyan>
<xmpG:magenta>0</xmpG:magenta>
<xmpG:yellow>0</xmpG:yellow>
<xmpG:black>0</xmpG:black>
</rdf:li>
<rdf:li rdf:parseType="Resource">
<xmpG:swatchName>Registration</xmpG:swatchName>
<xmpG:mode>CMYK</xmpG:mode>
<xmpG:type>Process</xmpG:type>
<xmpG:cyan>100</xmpG:cyan>
<xmpG:magenta>100</xmpG:magenta>
<xmpG:yellow>100</xmpG:yellow>
<xmpG:black>100</xmpG:black>
</rdf:li>
</rdf:Seq>
</xmpTPg:Colorants>
<xmpTPg:Fonts>
<rdf:Bag>
<rdf:li rdf:parseType="Resource">
<stFnt:fontName>MinionPro-Regular</stFnt:fontName>
<stFnt:fontFamily>Minion Pro</stFnt:fontFamily>
<stFnt:fontFace>Regular</stFnt:fontFace>
<stFnt:fontType>OpenTypeCFF</stFnt:fontType>
<stFnt:versionString>MinionPro-RegularVersion 2.112;PS 2.000;hotconv 1.0.70;makeotf.lib2.5.5900</stFnt:versionString>
<stFnt:composite>false</stFnt:composite>
<stFnt:fontFileName>MinionPro-Regular.otf</stFnt:fontFileName>
</rdf:li>
</rdf:Bag>
</xmpTPg:Fonts>
</rdf:Description>
</rdf:RDF>
</x:xmpmeta>                                                                                            

<?xpacket end="w"?>

我想从上面的xml中提取stRef:lastURLstRef:filePath的数据,我已经尝试过

import xml.etree.ElementTree as ET
with open('C:\tmp.xml', 'rt') as f:
tree = ET.parse(f)
namespaces = {'stRef': 'http://ns.adobe.com/xap/1.0/sType/ResourceRef#'}
for node in tree.findall('stRef:lastURL', namespaces):
print(node)

但它没有给我任何所需的数据,有人能帮忙吗,如何从文件中获取数据

默认情况下,findall方法只搜索当前元素的直接子元素

Element.findall((只查找带有标记的元素,这些标记是当前元素的直接子级。Element.find((查找具有特定标记的第一个子元素,Element.text访问元素的文本内容。Element.get((访问元素的属性。。。(https://docs.python.org/3/library/xml.etree.elementtree.html#finding-感兴趣的元素(

然而,它对XPath表达式的支持也有限,因此您可以改为编写以下内容:

for node in tree.findall('.//stRef:lastURL', namespaces):
print(node)

这将导致您的代码打印:

<Element '{http://ns.adobe.com/xap/1.0/sType/ResourceRef#}lastURL' at 0x7f48e8e91360>
<Element '{http://ns.adobe.com/xap/1.0/sType/ResourceRef#}lastURL' at 0x7f48e8e915e0>
<Element '{http://ns.adobe.com/xap/1.0/sType/ResourceRef#}lastURL' at 0x7f48e8e91860>
<Element '{http://ns.adobe.com/xap/1.0/sType/ResourceRef#}lastURL' at 0x7f48e8e91ae0>
<Element '{http://ns.adobe.com/xap/1.0/sType/ResourceRef#}lastURL' at 0x7f48e8e91e00>
<Element '{http://ns.adobe.com/xap/1.0/sType/ResourceRef#}lastURL' at 0x7f48e8e940e0>

相关内容

  • 没有找到相关文章

最新更新