Anonymous committed cf633fd

Modified Files:
+ getChildrenByTagNameNS() added
now the function is not just mentioned in the docs, but really available

+ attributes docs (removed multiple docu)

  • Participants
  • Parent commits 5873f55

Comments (0)

Files changed (2)

     return wantarray ? @nodes : XML::LibXML::NodeList->new(@nodes);
+sub getChildrenByTagNameNS {
+    my ( $node, $nsURI, $name ) = @_;
+    my $xpath = "*[local-name()='$name' and namespace-uri()='$nsURI']";
+    my @nodes = $node->_findnodes($xpath);
+    return wantarray ? @nodes : XML::LibXML::NodeList->new(@nodes);
 sub appendWellBalancedChunk {
     my ( $self, $chunk ) = @_;

File example/libxml.xml

-            <method name="attributes" synopsis="@attrs =$node->attributes;">
-                <p>
-                    This function returns all attributes assigned to
-                    the given node. if this function is called in
-                    scalar context, it will return a
-                    XML::LibXML::NodeList.
-                </p>
-            </method>
             <method name="parentNode"
                     synopsis="$parentnode = $node->parentNode;">
                     <st>findvalue</st> is exactly equivalent to:
-                <example>
- $node->find( $xpath )-&gt;to_literal;
-                </example>
+                <example><![CDATA[
+ $node->find( $xpath )->to_literal;
+                ]]></example>
                     That is, it returns the literal value of the
                     results. This enables you to ensure that you get a
                     string back from your search, allowing certain
                     shortcuts. This could be used as the equivalent of
-                    XSLT's &lt;xsl:value-of select="some_xpath"/&gt;.
+                    XSLT's <![CDATA[<xsl:value-of select="some_xpath"/>]]>.
             <method name="attributes" 
                     synopsis="@attributelist = $node->attributes();">
-                    Returns all attributes of a given node.
+                    This function returns all attributes and namespace
+                    declarations assigned to the given node.
+                </p>
+                <p>
+                    Because XML::LibXML does not implement namespace
+                    declarations and attributes the same way, it is
+                    required to test what kind of node is handled
+                    while accessing the functions result.
                     If this function is called in array context the
             <method name="getElementsByTagName"
-                    synopsis="@nodes = $node-&gt;getElementsByTagName($tagname);">
+                    synopsis="@nodes = $node->;getElementsByTagName($tagname);">
                     This function is part of the spec it fetches all
                     descendants of a node with a given tagname. If one