Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

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

by Anonymous Monk
on Jul 05, 2013 at 08:22 UTC ( #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 ^


Comment on Re: Counting number of child nodes based on element value (typos)
Select or Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (4)
As of 2015-07-07 07:55 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (87 votes), past polls