class LibXML::XML::Namespaces

The XML::Namespaces class is used to access information about a node’s namespaces. For each node, libxml maintains:

Let’s look at an example:

<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
               xmlns:xsd="http://www.w3.org/2001/XMLSchema">
  <soap:Body>
    <order xmlns="http://mynamespace.com"/>
  </soap:Body>
</soap>

The Envelope node is in the soap namespace. It contains two namespace definitions, one for soap and one for xsd.

The Body node is also in the soap namespace and does not contain any namespaces. However, the soap and xsd namespaces are both in context.

The order node is in its default namespace and contains one namespace definition (mynamespace.com). There are three namespaces in context soap, xsd and the default namespace.