Мне нужно извлечь некоторые данные из файла XMP с использованием выражений XPATH.
У меня есть файл XMP так:Извлечь все значения из XMP
<x:xmpmeta xmlns:x="adobe:ns:meta/" x:xmptk="XMP Core 4.4.0">
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
<rdf:Description xmlns:egPDFNat="http://ns.esko-graphics.com/pdfnatversion/1.0/" rdf:about="">
<egPDFNat:version>201</egPDFNat:version>
<egPDFNat:flexripversion>700</egPDFNat:flexripversion>
</rdf:Description>
<rdf:Description xmlns:xmp="http://ns.adobe.com/xap/1.0/" rdf:about="">
<xmp:CreateDate>2012-03-29T14:40:40+02:00</xmp:CreateDate>
<xmp:CreatorTool>ArtPro 10.1 rev 2 build 56 (2011-12-01)</xmp:CreatorTool>
<xmp:MetadataDate>2012-03-29T14:40:40+02:00</xmp:MetadataDate>
<xmp:ModifyDate>2012-03-29T14:40:40+02:00</xmp:ModifyDate>
</rdf:Description>
<rdf:Description xmlns:dc="http://purl.org/dc/elements/1.1/" rdf:about="">
<dc:description>
<rdf:Alt>
<rdf:li xml:lang="x-default">ArtPro Normalized PDF</rdf:li>
</rdf:Alt>
</dc:description>
</rdf:Description>
<rdf:Description xmlns:egGr="http://ns.esko-graphics.com/grinfo/1.0/" xmlns:egInk="http://ns.esko-graphics.com/inkinfo/1.0/" rdf:about="">
<egGr:nrpages>1</egGr:nrpages>
<egGr:units>mm</egGr:units>
<egGr:vsize>150</egGr:vsize>
<egGr:hsize>150</egGr:hsize>
<egGr:margtop>0</egGr:margtop>
<egGr:margbot>0</egGr:margbot>
<egGr:margleft>0</egGr:margleft>
<egGr:margright>0</egGr:margright>
<egGr:vshrink>1</egGr:vshrink>
<egGr:hshrink>1</egGr:hshrink>
<egGr:readerspread>False</egGr:readerspread>
<egGr:inks>
<rdf:Seq>
<rdf:li rdf:parseType="Resource">
<egInk:name>cyan</egInk:name>
<egInk:type>process</egInk:type>
<egInk:book>process</egInk:book>
<egInk:egname>Cyan</egInk:egname>
<egInk:frequency>150</egInk:frequency>
<egInk:angle>15</egInk:angle>
<egInk:dotshape>CS19</egInk:dotshape>
<egInk:r>0</egInk:r>
<egInk:g>0.560784314</egInk:g>
<egInk:b>0.858823529</egInk:b>
<egInk:attribute>normal</egInk:attribute>
</rdf:li>
<rdf:li rdf:parseType="Resource">
<egInk:name>cyan</egInk:name>
<egInk:type>process</egInk:type>
<egInk:book>process</egInk:book>
<egInk:egname>Cyan</egInk:egname>
<egInk:frequency>150</egInk:frequency>
<egInk:angle>15</egInk:angle>
<egInk:dotshape>HD01</egInk:dotshape>
<egInk:r>0</egInk:r>
<egInk:g>0.560784314</egInk:g>
<egInk:b>0.858823529</egInk:b>
<egInk:attribute>normal</egInk:attribute>
</rdf:li>
<rdf:li rdf:parseType="Resource">
<egInk:name>cyan</egInk:name>
<egInk:type>process</egInk:type>
<egInk:book>process</egInk:book>
<egInk:egname>Cyan</egInk:egname>
<egInk:frequency>150</egInk:frequency>
<egInk:angle>15</egInk:angle>
<egInk:dotshape>C</egInk:dotshape>
<egInk:r>0</egInk:r>
<egInk:g>0.560784314</egInk:g>
<egInk:b>0.858823529</egInk:b>
<egInk:attribute>normal</egInk:attribute>
</rdf:li>
<rdf:li rdf:parseType="Resource">
<egInk:name>cyan</egInk:name>
<egInk:type>process</egInk:type>
<egInk:book>process</egInk:book>
<egInk:egname>Cyan</egInk:egname>
<egInk:frequency>150</egInk:frequency>
<egInk:angle>15</egInk:angle>
<egInk:dotshape>SCR01</egInk:dotshape>
<egInk:r>0</egInk:r>
<egInk:g>0.560784314</egInk:g>
<egInk:b>0.858823529</egInk:b>
<egInk:attribute>normal</egInk:attribute>
</rdf:li>
<rdf:li rdf:parseType="Resource">
<egInk:name>magenta</egInk:name>
<egInk:type>process</egInk:type>
<egInk:book>process</egInk:book>
<egInk:egname>Magenta</egInk:egname>
<egInk:frequency>150</egInk:frequency>
<egInk:angle>75</egInk:angle>
<egInk:dotshape>CS19</egInk:dotshape>
<egInk:r>0.760784314</egInk:r>
<egInk:g>0</egInk:g>
<egInk:b>0.349019608</egInk:b>
<egInk:attribute>normal</egInk:attribute>
</rdf:li>
<rdf:li rdf:parseType="Resource">
<egInk:name>magenta</egInk:name>
<egInk:type>process</egInk:type>
<egInk:book>process</egInk:book>
<egInk:egname>Magenta</egInk:egname>
<egInk:frequency>150</egInk:frequency>
<egInk:angle>75</egInk:angle>
<egInk:dotshape>HD01</egInk:dotshape>
<egInk:r>0.760784314</egInk:r>
<egInk:g>0</egInk:g>
<egInk:b>0.349019608</egInk:b>
<egInk:attribute>normal</egInk:attribute>
</rdf:li>
<rdf:li rdf:parseType="Resource">
<egInk:name>magenta</egInk:name>
<egInk:type>process</egInk:type>
<egInk:book>process</egInk:book>
<egInk:egname>Magenta</egInk:egname>
<egInk:frequency>150</egInk:frequency>
<egInk:angle>75</egInk:angle>
<egInk:dotshape>C</egInk:dotshape>
<egInk:r>0.760784314</egInk:r>
<egInk:g>0</egInk:g>
<egInk:b>0.349019608</egInk:b>
<egInk:attribute>normal</egInk:attribute>
</rdf:li>
<rdf:li rdf:parseType="Resource">
<egInk:name>magenta</egInk:name>
<egInk:type>process</egInk:type>
<egInk:book>process</egInk:book>
<egInk:egname>Magenta</egInk:egname>
<egInk:frequency>150</egInk:frequency>
<egInk:angle>75</egInk:angle>
<egInk:dotshape>SCR01</egInk:dotshape>
<egInk:r>0.760784314</egInk:r>
<egInk:g>0</egInk:g>
<egInk:b>0.349019608</egInk:b>
<egInk:attribute>normal</egInk:attribute>
</rdf:li>
</rdf:Seq>
</egGr:inks>
</rdf:Description>
</rdf:RDF>
</x:xmpmeta>
<?xpacket end="w"?>
Я хотел бы извлечь все dotshape значения (разделенных пробелом, косой черты, запятая .... в любом случае).
Я пробовал:
/xmpmeta/RDF/Description/inks/Seq/li/dotshape
но я извлеченный только первый dotshape.
Есть ли решение?
Вы пробовали '// dotshape'? – Tomalak
После написания подробного ответа, который использовал '// dotshape', я действительно пробовал ваше выражение. Он выбирает все элементы 8 'dotshape'. Итак - выражение хорошее и звуковое. Какой инструмент вы используете для его применения, как вы используете элементы? –
Я пробовал оба выражения, но результат тот же. Я использую специальное программное обеспечение (механизм автоматизации от Esko) для извлечения информации из файла. –