Get at the raw xml behind an XML::XPath object

May 28th, 2007 by Rohan

XML::XPath is a cool module which gives you access to your XML using XPath

However, once you have your XML::XPath object (which you’ve received from some subroutine, for example), I couldn’t find a documented way of accessing the raw XML. Maybe I haven’t looked deep enough, but the below hack works fine for me. :-)

my $xp = get_xpath_object();
print $xp->{_xml};

Note that this is a hack and it breaks all encapsulation. Use it with care.

[Post to Twitter] Tweet This Post  [Post to Facebook] Facebook 

Leave a Reply




Tweet This Post links powered by Tweet This v1.4.1, a WordPress plugin for Twitter.