Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine

Re^2: Having trouble with siblings

by Anonymous Monk
on Jun 30, 2013 at 15:34 UTC ( #1041605=note: print w/replies, xml ) Need Help??

in reply to Re: Having trouble with siblings
in thread Having trouble with siblings

Aha, the node test node() will select all types of nodes, even text() nodes

  • so find a <header> which contains 'rationale'
  • and select every child node of that header
  • and filter this nodeset for nodes which have following-sibling with tagname  <l> or which have tagname  <l>
xmllint.exe --xpath " //header[ contains(.,'rationale') ]/node()[ fol +lowing-sibling::l or self::l] " fudge 1. Purpose and rationale <p>purpose 1</p> <p>Purpose 2</p> <p>purpose 3</p> <l> <li>purpose list 1</li> <li>list2</li> </l> 2. Purpose and rationale <p>2 purpose 1</p> <p>2 Purpose 2</p> <p>2 purpose 3</p> <l> <li>2 purpose list 1</li> <li>2 list2</li> </l>

Naturally if there are more than one  <l> you can limit to first <l> with position()  xmllint.exe --xpath " //header[ contains(.,'rationale') ]/node()[ following-sibling::l[ position()=1 ] or self::l[ position()=1 ]  ]   " fudge

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1041605]
Corion idly wonders about creating a series of HTTP requests. There seems to be no framework to generate a series of HTTP requests, like "try all these requests"
[Corion]: This is vaguely inspired by that list of "nasty" strings, which I'd like to replace among HTTP parameters, just to see whether the application crashes, but also for easy downloading of a list of URLs etc
[Corion]: Maybe I'll just conoct something using Algorithm::Permute to create an (OO) generator for such requests, or a simple function.
[Corion]: For testing I imagine one would want to test a random sampling of such "bad"/"unexpected" requests, while for downloading, one would want to generate them all in order, but not necessarily as a huge list

How do I use this? | Other CB clients
Other Users?
Others surveying the Monastery: (8)
As of 2017-01-16 15:40 GMT
Find Nodes?
    Voting Booth?
    Do you watch meteor showers?

    Results (151 votes). Check out past polls.