Всем привет.
Понадобилось распарсить стандартный primary.xml в консоле. Запускаю xmllint --xpath «//*/*/@name='XXX'» primary.xml но получаю true вместо значения.Сам файл выглядит примерно так:
<?xml version="1.0" encoding="UTF-8"?>
<metadata xmlns="http://linux.duke.edu/metadata/common" xmlns:suse="http://novell.com/package/metadata/suse/common" xmlns:rpm="http://linux.duke.edu/metadata/rpm" packages="2152">
<package type="rpm">
<name>ZZZZZZ</name>
<arch>i586</arch>
<version epoch="0" ver="0.735" rel="1.10"/>
<checksum type="sha" pkgid="YES">0d519e1d7d455352525b40f8e21db563decc15c3</checksum>
<summary>A Tool to Verify the 3D Configuration</summary>
<description>With 3Ddiag you can verify the 3D configuration.
Authors:
--------
Stefan Dirsch <sndirsch@suse.de></description>
<packager>http://bugs.opensuse.org</packager>
<url></url>
<time file="1210095650" build="1208992146"/>
<size package="30622" installed="48531" archive="50300"/>
<location href="rpm/i586/3ddiag-0.735-1.10.i586.rpm"/>
<format>
<rpm:license>GPL v2 or later</rpm:license>
<rpm:vendor>SUSE LINUX Products GmbH, Nuernberg, Germany</rpm:vendor>
<rpm:group>System/Base</rpm:group>
<rpm:buildhost>bragg.suse.de</rpm:buildhost>
<rpm:sourcerpm>3ddiag-0.735-1.10.src.rpm</rpm:sourcerpm>
<rpm:header-range start="448" end="16920"/>
<rpm:provides>
<rpm:entry name="3ddiag" flags="EQ" epoch="0" ver="0.735" rel="1.10"/>
</rpm:provides>
<rpm:requires>
<rpm:entry name="/bin/sh"/>
<rpm:entry name="libsysfs.so.1"/>
</rpm:requires> <file>/usr/bin/3Ddiag.devel</file>
<file>/usr/bin/3Ddiag.nvidia_glx</file>
<file>/usr/bin/3Ddiag.ignoredb</file>
</format>
</package>
<package type="rpm">
<name>XXX</name>
<arch>noarch</arch>
<version epoch="0" ver="002.003" rel="3.4"/>
<checksum type="sha" pkgid="YES">94dff6a27e2e5e4d10116a17f24c59b9de2ac56a</checksum>
<summary>"Proportional Mincho" Japanese TrueType font made by IPA</summary>
<description>"Proportional Mincho" Japanese TrueType font made by IPA
(Information-technology Promotion Agency).
Authors:
--------
Information-technology Promotion Agency, Japan. (http://www.ipa.go.jp)</description>
<packager>http://bugs.opensuse.org</packager>
<url>http://www.ipa.go.jp/</url>
<time file="1210095653" build="1208824926"/>
<size package="3363336" installed="5866185" archive="5867272"/>
<location href="rpm/noarch/IPAPMincho-002.003-3.4.noarch.rpm"/>
<format>
<rpm:license>Any commercial</rpm:license>
<rpm:vendor>SUSE LINUX Products GmbH, Nuernberg, Germany</rpm:vendor>
<rpm:group>System/X11/Fonts</rpm:group>
<rpm:buildhost>adams.suse.de</rpm:buildhost>
<rpm:sourcerpm>IPAPGothic-5.0.3-16.9.src.rpm</rpm:sourcerpm>
<rpm:header-range start="448" end="7465"/>
<rpm:provides>
<rpm:entry name="scalable-font-ja"/>
<rpm:entry name="locale(ja)"/>
<rpm:entry name="IPAPMincho" flags="EQ" epoch="0" ver="002.003" rel="3.4"/>
</rpm:provides>
<rpm:requires>
<rpm:entry name="/bin/sh" pre="1"/>
</rpm:requires>
</format>
</package>
</metadata>
Как же получить всю запись <package> если тэг <name> у неё записан как XXX?