in reply to Re^2: XML::LibXML - parsing question!!
in thread XML::LibXML - parsing question!!

I was only associating the namespace with the first element

Do you mean you "only specified a prefix for the first node test in the XPath"? There's no way to not specify a namespace for a node test in an XPath, so there's no opportunity to default to anything.

Replies are listed 'Best First'.
Re^4: XML::LibXML - parsing question!!
by MarkovChain (Sexton) on Dec 19, 2009 at 15:40 UTC

    I was doing this...

    $action_requests = $xpc->findnodes('//admin_server:request/*/action');

      //admin_server:request/*/action

      is short for

      /descendant::admin_server:request/child::*/child::action

      There are three node tests in that path

      • descendant::admin_server:request
      • child::*
      • child::action

      There is one prefix in that path

      • admin_server
      There are two namespaces referenced by that path
      • Which ever namespace is associated with admin_server (referenced by descendant::admin_server:request)
      • The null namespace (referenced by child::action)

      (* matches nodes in any namespace)