|
NAMEXML::DOM2::DOM::Element - A library of DOM (Document Object Model) methods for XML Elements.DESCRIPTIONProvides all the DOM method for XML ElementsMETHODS$element->getFirstChild()$element->firstChild()Returns the elements first child in it's children list $element->getLastChild()$element->lastChild()Returns the elements last child in it's children list $element->getChildIndex( @children )Return the array index of this element in the parent or the passed list (if there is one). $element->getChildAtIndex( $index )Return the element at the specified index (the index can be negative). $element->getNextSibling()$element->nextSibling()Return the next element to this element in the parents child list. $element->getPreviousSibling()$element->previousSibling()Return the previous element to this element in the parents child list. $element->getChildren()$element->getChildElements()$element->getChildNodes()Returns all the elements children. $element->getChildrenByName( $name )Returns all the elements children with that tag name (including namespace prefix). $element->hasChildren()$element->hasChildElements()$element->hasChildNodes()Returns 1 if this element has children. $element->getParent()$element->getParentElement()$element->getParentNode()Returns the object of the parent element. $element->setParent( $element )$element->setParentElement( $element )$element->setParent($parent);Sets the parent node, used internaly. $element->getParents()$element->getParentElements()$element->getParentNodes()$element->getAncestors()Return a list of the parents of the current element, starting from the immediate parent. The last member of the list should be the document element. $element->isAncestor( $node )Returns true if the current element is an ancestor of the descendant element. $element->isDescendant( $node )Return true if the crrent element is the descendant of the ancestor element. $element->getSiblings()Returns a list of sibling elements. $element->hasSiblings()Returns true if the elements has sibling elements. $element->getElementName()$element->getElementType()$element->getType()$element->getTagName()$element->getTagType()$element->getNodeName()$element->getNodeType()Return a string containing the name (i.e. the type, not the Id) of an element. $element->getElementId()Return a string containing the elements Id (unique identifier string). $element->getAttribute( $attributeName )Returns the specified attribute in the element, will return a serialised string instead of posible attribute object if serialise set. $element->getAttributes( $serialise, $ns )Returns a list of attributes in various forms. $element->getAttributeNames()Returns a list of attribute names, used internaly. $element->getAttributeNamesNS( $namespace )Returns a list of attribute names, used internaly. $element->getAttributeNamespaces()Returns a list of attribute names, used internaly. $element->hasAttribute( $attributeName )Returns true if this element as this attribute. $element->hasAttributeNS( $namespace, $attributeName )Returns true if this attribute in this namespace is in this element. $element->hasAttributes()Return true is element has any attributes $element->setAttribute( $attribute, $value )Set an attribute on this element, it will accept serialised strings or objects. $element->removeAttribute( $name )Remove a single attribute from this element. $element->removeAttributeNS( $namespace, $name )Remove a single attribute from this element. $element->getAttributeNS( $namespace, $name )Returns an attributes namespace in this element. $element->setAttributeNS( $namespace, $name, $value )Sets an attributes namespace in this element. $element->cdata( $text )Rerieve and set this elements cdata (non tag cdata form) $element->hasCDATA()Return true if this element has cdata. $element->document()Return this elements document, returns undef if no document available. $element->insertBefore( $node, $childNode )$element->insertChildBefore( $node, $childNode )$element->insertNodeBefore( $node, $childNode )$element->insertElementBefore( $node, $childNode )Inserts a new element just before the referenced child. $element->insertAfter( $node, $childNode )$element->insertChildAfter( $node, $childNode )$element->insertElementAfter( $node, $childNode )$element->insertNodeAfter( $node, $childNode )Inserts a new child element just after the referenced child.$element->insertSiblingAfter( $node )Inserts the child just after the current element (effects parent). $element->insertSiblingBefore( $node )Inserts the child just before the current element (effects parent). $element->replaceChild( $newChild, $oldChild )Replace an old child with a new element, returns old element. $element->replaceElement( $newElement )$element->replaceNode( $newElement )Replace an old element with a new element in the parents context; element becomes orphaned. $element->removeChild( $child )Remove a child from this element, returns the orphaned element. $element->removeElement()$element->removeNode()Removes this element from it's parent; element becomes orphaned. $element->appendChild( $node )$element->appendElement( $node )$element->appendNode( $node )Adds the new child to the end of this elements children list. $element->cloneNode( $deep )$element->cloneElement( $deep )Clones the current element, deep allows all child elements to be cloned. The new element is an orphan with all the same id's and atributes as this element. $element->findChildIndex( $child )Scans through children trying to find this child in the list. $element->insertAtIndex( $node, $index )Adds the new child at the specified index to this element. $element->removeChildAtIndex( $index )Removed the child at index and returns the now orphaned element. $element->createChildElement( $name, %options )$element->createElement( $name, %options )Not DOM2, creates a child element, appending to current element.The advantage to using this method is the elements created with $document->createElement create basic element objects or base objects (those specified in the XML base class or it's kin) Elements created with this could offer more complex objects back. Example: an SVG Gradiant will have stop elements under it, creating stop elements with $document->createElement will return an XML::DOM2::Element create a stop element with $element->createChildElement and it will return an SVG2::Element::Gradiant::Stop object (although both would output the same xml) and it would also prevent you from creating invalid child elements such as a group within a text element. $element->createChildElement($name, %opts); AUTHORMartin Owens, doctormo@postmaster.co.ukSEE ALSOperl(1), XML::DOM2, XML::DOM2::Element<http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core.html> DOM at the W3C
Visit the GSP FreeBSD Man Page Interface. |