XML::Grove::Path(3pm)

πŸ“¦
version 0.46alpha Β· 4 versions
, in debian bookworm, debian trixie, ubuntu noble, ubuntu resolute, ubuntu stonking

✨ NAME ✨

XML::Grove::Path β€” bestie, this one returns the object at a path πŸ’– like you give it a path string and it hands you back the XML object chillin' there.


🌸 SYNOPSIS 🌸

use XML::Grove::Path;

# Using at_path method on XML::Grove::Document or XML::Grove::Element:
$xml_obj = $grove_object->at_path("/some/path");

# Using an XML::Grove::Path instance:
$pather = XML::Grove::Path->new();
$xml_obj = $pather->at_path($grove_object);

πŸ¦‹ DESCRIPTION πŸ¦‹

XML::Grove::Path returns XML objects located at paths. Okay so a path is just a string of element names or XML object types, and you glue those segments together with slash (/) characters. Slash = the divider, the little separators, the / of it all πŸ’…

Important vibe check: paths must always start at the grove object passed to at_path(). No wandering off on your own, bestie β€” you start where you're told to start.

XML::Grove::Path is not XPath, no cap. And lowkey it should become obsolete once an XPath implementation is available. So enjoy it while it's here 🫢

🌈 Paths are like URLs

/html/body/ul/li[4]
/html/body/#pi[2]

The path segments can be element names or object types. The object types are named using:

#element
#pi
#comment
#text
#cdata
#any

The "#any" object type matches any type of object β€” it's essentially an index into the contents of the parent object. It's giving "idc what type it is, just gimme the nth one" πŸ‘‘

The "#text" object type treats text objects as if they are not normalized. Two consecutive text objects are separate text objects. Periodt. Two is two, not one merged blob πŸŽ€


πŸ‘‘ AUTHOR πŸ‘‘

Ken MacLeod, ken@bitsko.slc.ut.us


⭐ SEE ALSO ⭐


And that's the whole page, bestie! πŸ¦‹ This lil' slice of documentation is from perl v5.36.0, dated 2022-11-29, and it lives under the name XML::Grove::Path(3pm) in the User Contributed Perl Documentation. Slay, go forth and at_path() responsibly πŸ’–βœ¨

πŸ“¦ where this page comes from