in reply to Re: XML dont include parent node
in thread XML dont include parent node

I humbly think that xpath are not intended to do match as in your case (child1, child2, child3..)

Hmm, but they seem to do exactly that, which kinda means they are intended to do it

$ xmllint --xpath " //Parent " foot.xml <Parent> <child1/> <child2/> <child3/> </Parent> $ xmllint --xpath " //Parent/* " foot.xml <child1/><child2/><child3/> $ xmllint --xpath " /Root/*/*[starts-with(name(), 'child')] " foot.x +ml <child1/><child2/><child3/>

... design for your data ...

I think too often the person asking how-something-xml doesn't have a choice in the design :)

Replies are listed 'Best First'.
Re^3: XML dont include parent node
by Discipulus (Canon) on Dec 11, 2013 at 12:49 UTC
    i suspected to be wrong there. thanks. Maybe that syntax (strats-with(name)..) is not available in XML::Twig, or, more probably i'm not able to get rid of:
    my @all = $twig->get_xpath ('/Root/Parent/child*'); #gives:error in xpath expression... my @all = $twig->get_xpath ('/Root/*/*[starts-with(name(), "child")] +'); #also gives error in xpath expression.. #someresults with the findnodes method..
    XML::Twig docs says these methods are similar to the XML::LibXML method. Being probably 'similar' the key word.

    Albeit, if someone is able...welcome!

    L*
    There are no rules, there are no thumbs..
    Reinvent the wheel, then learn The Wheel; may be one day you reinvent one of THE WHEELS.