$ xmllint --xpath "/*[ name() = 'alto' ] /*[ name() = 'Description' ]
+/*[ name() = 'MeasurementUnit' ]" alto.xml
<MeasurementUnit>inch1200</MeasurementUnit>
Based on: perl xpather.pl --all alto.xml /*
# posy
/alto[1]
# star
/*[ name() = "alto" and position() = 1 and @xsi:schemaLocation = "http
+://www.loc.gov/standards/alto alto-v2.0.xsd" and @xmlns = "http://www
+.loc.gov/standards/alto/ns-v2#" and @xmlns:xsi = "http://www.w3.org/2
+001/XMLSchema-instance" ]
# rats
/*[ name() = "alto" and position() = 1 and @xsi:schemaLocation = "http
+://www.loc.gov/standards/alto alto-v2.0.xsd" and @xmlns = "http://www
+.loc.gov/standards/alto/ns-v2#" and @xmlns:xsi = "http://www.w3.org/2
+001/XMLSchema-instance" ]
# "content"
inch1200
------
/*/*
# posy
/alto[1]/Description[1]
# star
/*[ name() = "alto" and position() = 1 and @xsi:schemaLocation = "http
+://www.loc.gov/standards/alto alto-v2.0.xsd" and @xmlns = "http://www
+.loc.gov/standards/alto/ns-v2#" and @xmlns:xsi = "http://www.w3.org/2
+001/XMLSchema-instance" ]
/*[ name() = "Description" and position() = 1 ]
# rats
/*[ name() = "alto" and position() = 1 and @xsi:schemaLocation = "http
+://www.loc.gov/standards/alto alto-v2.0.xsd" and @xmlns = "http://www
+.loc.gov/standards/alto/ns-v2#" and @xmlns:xsi = "http://www.w3.org/2
+001/XMLSchema-instance" ]
/Description[1]
# "content"
inch1200
------
/*/*/*
# posy
/alto[1]/Description[1]/MeasurementUnit[1]
# star
/*[ name() = "alto" and position() = 1 and @xsi:schemaLocation = "http
+://www.loc.gov/standards/alto alto-v2.0.xsd" and @xmlns = "http://www
+.loc.gov/standards/alto/ns-v2#" and @xmlns:xsi = "http://www.w3.org/2
+001/XMLSchema-instance" ]
/*[ name() = "Description" and position() = 1 ]
/*[ name() = "MeasurementUnit" and position() = 1 ]
# rats
/*[ name() = "alto" and position() = 1 and @xsi:schemaLocation = "http
+://www.loc.gov/standards/alto alto-v2.0.xsd" and @xmlns = "http://www
+.loc.gov/standards/alto/ns-v2#" and @xmlns:xsi = "http://www.w3.org/2
+001/XMLSchema-instance" ]
/Description[1]
/MeasurementUnit[1]
# "content"
inch1200
------
:) I'm beginning to think every xml file that needs a namespace registered is a broken xml file -- the file should register any namespace it uses
-
Are you posting in the right place? Check out Where do I post X? to know for sure.
-
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
<u> <ul>
-
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
intervention).
-
Want more info? How to link
or How to display code and escape characters
are good places to start.
|