Overview

Packages

  • Xml
    • Element

Classes

  • Horde_Xml_Element
  • Horde_Xml_Element_Exception
  • Horde_Xml_Element_List
  • Overview
  • Package
  • Class
  • Tree

Class Horde_Xml_Element

Wraps a DOMElement allowing for SimpleXML-like access to attributes.

Horde_Xml_Element implements ArrayAccess

Direct known subclasses

Horde_Xml_Element_List
Package: Xml\Element
Category: Horde
License: BSD
Author: Chuck Hagenbuch chuck@horde.org
Located at Horde/Xml/Element.php
Methods summary
public static string
# lookupNamespace( mixed $prefix )

Get the full version of a namespace prefix

Get the full version of a namespace prefix

Looks up a prefix (atom:, etc.) in the list of registered namespaces and returns the full namespace URI if available. Returns the prefix, unmodified, if it's not registered.

Returns

string
public static
# registerNamespace( string $prefix, string $namespaceURI )

Add a namespace and prefix to the registered list

Add a namespace and prefix to the registered list

Takes a prefix and a full namespace URI and adds them to the list of registered namespaces for use by Horde_Xml_Element::lookupNamespace().

Parameters

$prefix
The namespace prefix
$namespaceURI
The full namespace URI
public
# __construct( DOMElement $element )

Horde_Xml_Element constructor.

Horde_Xml_Element constructor.

Parameters

$element
<p>Horde_Xml_Element | string $element The DOM element, pre-existing Horde_Xml_Element, or XML string that we're encapsulating.</p>
public DOMDocument
# getDom( )

Get a DOM representation of the element

Get a DOM representation of the element

Returns the underlying DOM object, which can then be manipulated with full DOM methods.

Returns

DOMDocument
public
# setDom( DOMElement $element )

Update the object from a DOM element

Update the object from a DOM element

Take a DOMElement object, which may be originally from a call to getDom() or may be custom created, and use it as the DOM tree for this Horde_Xml_Element.

Parameters

$element
public
# fromArray( mixed $array )

Add child elements and attributes to this element from a simple key => value hash. Keys can be:

Add child elements and attributes to this element from a simple key => value hash. Keys can be:

ElementName -> <$ElementName> will be appended with a value of $value #AttributeName -> An attribute $AttributeName will be added to this element with a value of $value ElementName#AttributeName -> <$ElementName> will be appended to this element if it doesn't already exist, and have its attribute $AttributeName set to $value

Parameters

$array
to import into this element.
public
# appendChild( Horde_Xml_Element $element )

Append a child node to this element.

Append a child node to this element.

Parameters

$element
The element to append.
public string
# saveXml( mixed $formatted = false )

Get an XML string representation of this element

Get an XML string representation of this element

Returns a string of this element's XML, including the XML prologue.

Returns

string
public string
# saveXmlFragment( mixed $formatted = false )

Get the XML for only this element

Get the XML for only this element

Returns a string of this element's XML without prologue.

Returns

string
public
# __wakeup( )

Unserialization handler; handles $this->_element being an instance of DOMElement or Horde_Xml_Element, or parses it as an XML string.

Unserialization handler; handles $this->_element being an instance of DOMElement or Horde_Xml_Element, or parses it as an XML string.

public array
# __sleep( )

Prepare for serialization

Prepare for serialization

Returns

array
public mixed
# __get( string $var )

Map variable access onto the underlying entry representation.

Map variable access onto the underlying entry representation.

Get-style access returns a Horde_Xml_Element representing the child element accessed. To get string values, use method syntax with the __call() overriding.

Parameters

$var
The property to access.

Returns

mixed
public
# __set( string $var, string $val )

Map variable sets onto the underlying entry representation.

Map variable sets onto the underlying entry representation.

Parameters

$var
The property to change.
$val
The property's new value.
public
# __isset( mixed $var )

Map isset calls onto the underlying entry representation.

Map isset calls onto the underlying entry representation.

public mixed
# __call( string $var, mixed $unused )

Get the value of an element with method syntax.

Get the value of an element with method syntax.

Map method calls to get the string value of the requested element. If there are multiple elements that match, this will return an array of those objects.

Parameters

$var
The element to get the string value of.
$unused

Returns

mixed
The node's value, null, or an array of nodes.
public
# __unset( mixed $var )

Remove all children matching $var.

Remove all children matching $var.

Methods inherited from ArrayAccess
offsetExists(), offsetGet(), offsetSet(), offsetUnset()
Magic methods summary
public mixed
# TAGNAME( )

. This will return the string value of the tag if it is a single tag, an array of Horde_Xml_Element objects if there are multiple tags, or null if the tag does not exist.

. This will return the string value of the tag if it is a single tag, an array of Horde_Xml_Element objects if there are multiple tags, or null if the tag does not exist.

Returns

mixed
API documentation generated by ApiGen