Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
$ 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


In reply to Re: PERL LibXML reading xml file with namespace not reading the file by Anonymous Monk
in thread PERL LibXML reading xml file with namespace not reading the file by umesh_epub

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • 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.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others admiring the Monastery: (5)
As of 2024-04-24 11:28 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found