Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Re: Counting number of child nodes based on element value (typos)

by Anonymous Monk
on Jul 05, 2013 at 08:22 UTC ( [id://1042653]=note: print w/replies, xml ) Need Help??


in reply to Counting number of child nodes based on element value

In Re^2: XML parsing and Lists you wrote a query using more than one tagname which appears nowhere in the xml you posted

H5 is not H4, there is no "Part"

$ xmllint.exe --xpath " //Article//Sect//H4[ contains(.,'Include')] /. +.//LI" madbee.xml <LI> <LI_Label>1.</LI_Label> <LI_Title>Critera 1</LI_Title> </LI><LI> <LI_Label>2.</LI_Label> <LI_Title>Critera 2</LI_Title> </LI><LI> <LI_Label>3.</LI_Label> <LI_Title>Critera 3</LI_Title> </LI><LI> <LI_Label>4.</LI_Label> <LI_Title>Critera 3</LI_Title> </LI> $ xmllint.exe --xpath " count( //Article//Sect//H4[ contains(.,'Includ +e')] /..//LI )" ma dbee.xml 4 $ xmllint.exe --xpath " count( //H4[ contains(.,'Include')] /..//LI )" + madbee.xml 4 $

My advice is switch to font DejaVu Sans Mono, say size 11 or 12 or 20 , helps with the detailed oriented nature of programming

 [id://1042546] -> XML parsing and Lists

what you posted still isn't valid xml -- XML::LibXML rejects it

madbee2.xml:24: parser error : Opening and ending tag mismatch: L line + 7 and Sect </Sect> ^ madbee2.xml:25: parser error : Opening and ending tag mismatch: Sect l +ine 3 and Main </Main> ^ madbee2.xml:26: parser error : Opening and ending tag mismatch: Main l +ine 2 and Article </Article> ^ madbee2.xml:28: parser error : Premature end of data in tag Aritcle li +ne 1 ^

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1042653]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others learning in the Monastery: (7)
As of 2024-04-23 17:47 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found