XML::LibXML::Element man page on aLinux

Man page or keyword search:  
man Server   7435 pages
apropos Keyword Search (all sections)
Output format
aLinux logo
[printable version]

XML::LibXML::Element(3User Contributed Perl DocumentatiXML::LibXML::Element(3)

NAME
       XML::LibXML::Element - XML::LibXML Class for Element Nodes

SYNOPSIS
	 $node = XML::LibXML::Element->new( $name )
	 $node->setAttribute( $aname, $avalue );
	 $node->setAttributeNS( $nsURI, $aname, $avalue );
	 $avalue = $node->getAttribute( $aname );
	 $avalue = $node->setAttributeNS( $nsURI, $aname );
	 $attrnode = $node->getAttributeNode( $aname );
	 $attrnode = $node->getAttributeNodeNS( $namespaceURI, $aname );
	 $node->removeAttribute( $aname );
	 $node->removeAttributeNS( $nsURI, $aname );
	 $boolean = $node->hasAttribute( $aname );
	 $boolean = $node->hasAttributeNS( $nsURI, $aname );
	 @nodes = $node->getChildrenByTagName($tagname);
	 @nodes = $node->getChildrenByTagNameNS($nsURI,$tagname);
	 @nodes = $node->;getElementsByTagName($tagname);
	 @nodes = $node->getElementsByTagNameNS($nsURI,$localname);
	 @nodes = $node->getElementsByLocalName($localname);
	 $node->appendWellBalancedChunk( $chunk )
	 $node->appendText( $PCDATA );
	 $node->appendTextNode( $PCDATA );
	 $node->appendTextChild( $childname , $PCDATA )
	 $node->setNamespace( $nsURI , $nsPrefix, $activate )

DESCRIPTION
       new
	     $node = XML::LibXML::Element->new( $name )

	   This function creates a new node unbound to any DOM.

       setAttribute
	     $node->setAttribute( $aname, $avalue );

	   This method sets or replaces the node's attribute $aname to the
	   value $avalue

       setAttributeNS
	     $node->setAttributeNS( $nsURI, $aname, $avalue );

	   Namespaceversion of setAttribute.

       getAttribute
	     $avalue = $node->getAttribute( $aname );

	   If $node has an attribute with the name $aname, the value of this
	   attribute will get returned.

       getAttributeNS
	     $avalue = $node->setAttributeNS( $nsURI, $aname );

	   Namespaceversion of getAttribute.

       getAttributeNode
	     $attrnode = $node->getAttributeNode( $aname );

	   Returns the attribute as a node if the attribute exists. If the
	   Attribute does not exists undef will be returned.

       getAttributeNodeNS
	     $attrnode = $node->getAttributeNodeNS( $namespaceURI, $aname );

	   Namespaceversion of getAttributeNode.

       removeAttribute
	     $node->removeAttribute( $aname );

	   The method removes the attribute $aname from the node's attribute
	   list, if the attribute can be found.

       removeAttributeNS
	     $node->removeAttributeNS( $nsURI, $aname );

	   Namespace version of removeAttribute

       hasAttribute
	     $boolean = $node->hasAttribute( $aname );

	   This funcion tests if the named attribute is set for the node. If
	   the attribute is specified, TRUE (1) will be returned, otherwise
	   the returnvalue is FALSE (0).

       hasAttributeNS
	     $boolean = $node->hasAttributeNS( $nsURI, $aname );

	   namespace version of hasAttribute

       getChildrenByTagName
	     @nodes = $node->getChildrenByTagName($tagname);

	   The function gives direct access to all childnodes of the current
	   node with the same tagname. It makes things a lot easier if you
	   need to handle big datasets.

	   If this function is called in SCALAR context, it returns the number
	   of Elements found.

       getChildrenByTagNameNS
	     @nodes = $node->getChildrenByTagNameNS($nsURI,$tagname);

	   Namespace version of getChildrenByTagName.

	   If this function is called in SCALAR context, it returns the number
	   of Elements found.

       getElementsByTagName
	     @nodes = $node->;getElementsByTagName($tagname);

	   This function is part of the spec it fetches all descendants of a
	   node with a given tagname. If one is as confused with tagname as I
	   was, tagname is a qualified tagname which is in case of namespace
	   useage prefix and local name

	   In SCALAR context this function returns a XML::LibXML::NodeList
	   object.

       getElementsByTagNameNS
	     @nodes = $node->getElementsByTagNameNS($nsURI,$localname);

	   Namespace version of getElementsByTagName as found in the DOM spec.

	   In SCALAR context this function returns a XML::LibXML::NodeList
	   object.

       getElementsByLocalName
	     @nodes = $node->getElementsByLocalName($localname);

	   This function is not found in the DOM specification. It is a mix of
	   getElementsByTagName and getElementsByTagNameNS. It will fetch all
	   tags matching the given local-name. This alows one to select tags
	   with the same local name across namespace borders.

	   In SCALAR context this function returns a XML::LibXML::NodeList
	   object.

       appendWellBalancedChunk
	     $node->appendWellBalancedChunk( $chunk )

	   Sometimes it is nessecary to append a string coded XML Tree to a
	   node.  appendWellBalancedChunk will do the trick for you. But this
	   is only done if the String is well-balanced.

	   Note that appendWellBalancedChunk() is only left for compatibility
	   reasons.  Implicitly it uses

	      my $fragment = $parser->parse_xml_chunk( $chunk );
	      $node->appendChild( $fragment );

	   This form is more explicit and makes it easier to control the flow
	   of a script.

       appendText
	     $node->appendText( $PCDATA );

	   alias for appendTextNode().

       appendTextNode
	     $node->appendTextNode( $PCDATA );

	   This wrapper function lets you add a string directly to an element
	   node.

       appendTextChild
	     $node->appendTextChild( $childname , $PCDATA )

	   Somewhat similar with appendTextNode: It lets you set an Element,
	   that contains only a text node directly by specifying the name and
	   the text content.

       setNamespace
	     $node->setNamespace( $nsURI , $nsPrefix, $activate )

	   setNamespace() allows one to apply a namespace to an element. The
	   function takes three parameters: 1. the namespace URI, which is
	   required and the two optional values prefix, which is the namespace
	   prefix, as it should be used in child elements or attributes as
	   well as the additional activate parameter.

	   The activate parameter is most useful: If this parameter is set to
	   FALSE (0), the namespace is simply added to the namespacelist of
	   the node, while the element's namespace itself is not altered.
	   Nevertheless activate is set to TRUE (1) on default. In this case
	   the namespace automatically is used as the nodes effective
	   namespace. This means the namespace prefix is added to the node
	   name and if there was a namespace already active for the node, this
	   will be replaced (but not removed from the global namespace list)

	   The following example may clarify this:

	      my $e1 = $doc->createElement("bar");
	      $e1->setNamespace("http://foobar.org", "foo")

	   results

	      <foo:bar xmlns:foo="http://foobar.org"/>

	   while

	      my $e2 = $doc->createElement("bar");
	      $e2->setNamespace("http://foobar.org", "foo",0)

	   results only

	      <bar xmlns:foo="http://foobar.org"/>

	   By using $activate == 0 it is possible to apply multiple namepace
	   declarations to a single element.

	   Alternativly you can call setAttribute() simply to declare a new
	   namespace for a node, without activating it:

	       $e2->setAttribute( "xmlns:foo", "http://bar.org" );

	   has the same result as

	      $e2->setNamespace( "http://foobar.org", "foo", 0 );

AUTHORS
       Matt Sergeant, Christian Glahn, =head1 VERSION

       1.58

COPYRIGHT
       2001-2004, AxKit.com Ltd; 2002-2004 Christian Glahn, All rights
       reserved.

perl v5.10.0			  2004-03-31	       XML::LibXML::Element(3)
[top]

List of man pages available for aLinux

Copyright (c) for man pages and the logo by the respective OS vendor.

For those who want to learn more, the polarhome community provides shell access and support.

[legal] [privacy] [GNU] [policy] [cookies] [netiquette] [sponsors] [FAQ]
Tweet
Polarhome, production since 1999.
Member of Polarhome portal.
Based on Fawad Halim's script.
....................................................................
Vote for polarhome
Free Shell Accounts :: the biggest list on the net