Class Horde_Xml_Element

Description

Implements interfaces:

  • ArrayAccess (internal interface)

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

  • method: mixed TAGNAME(): To get the un-wrapped value of a node, use method syntax ($xml_element->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.

Located in /Xml_Element/lib/Horde/Xml/Element.php (line 24)


	
			
Direct descendents
Class Description
Abstract class Horde_Feed_Base The Horde_Feed_Base class is an abstract class representing feeds.
Abstract class Horde_Feed_Entry_Base Horde_Feed_Entry_Base represents a single entry in an Atom or RSS feed.
Variable Summary
Method Summary
 static string lookupNamespace ( $prefix)
 static void registerNamespace (string $prefix, string $namespaceURI)
 Horde_Xml_Element __construct ([DOMElement $element = null])
 void appendChild (Horde_Xml_Element $element)
 void fromArray ($array $array)
 DOMDocument getDom ()
 void offsetExists ( $offset)
 void offsetGet ( $offset)
 void offsetSet ( $offset,  $value)
 void offsetUnset ( $offset)
 string saveXml ()
 string saveXmlFragment ()
 void setDom ( $element)
 void setParent (Horde_Xml_Element $element)
 array _children (string $var)
 void _ensureAppended ()
 mixed __call (string $var,  $unused)
 mixed __get (string $var)
 void __isset ( $var)
 void __set (string $var, string $val)
 array __sleep ()
 void __toString ()
 void __unset ( $var)
 void __wakeup ()
Variables
static array $_namespaces = array(
'opensearch' => 'http://a9.com/-/spec/opensearchrss/1.0/',
'atom' => 'http://www.w3.org/2005/Atom',
'rss' => 'http://blogs.law.harvard.edu/tech/rss',
)
(line 29)
  • access: protected
boolean $_appended = true (line 88)
  • access: protected
DOMElement $_element (line 70)
  • access: protected
Horde_Xml_Element $_parentElement (line 83)
  • access: protected
string $_serialized (line 78)

A string representation of the element, used when serializing/unserializing.

  • access: protected
Methods
static lookupNamespace (line 45)

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.

  • access: public
static string lookupNamespace ( $prefix)
  • $prefix
static registerNamespace (line 62)

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().

  • access: public
static void registerNamespace (string $prefix, string $namespaceURI)
  • string $prefix: The namespace prefix
  • string $namespaceURI: The full namespace URI
Constructor __construct (line 95)

Horde_Xml_Element constructor.

  • access: public
Horde_Xml_Element __construct ([DOMElement $element = null])
  • DOMElement $element: The DOM element we're encapsulating.

Redefined in descendants as:
appendChild (line 180)

Append a child node to this element.

  • access: public
void appendChild (Horde_Xml_Element $element)
fromArray (line 144)

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

  • access: public
void fromArray ($array $array)
  • $array $array: Hash to import into this element.

Redefined in descendants as:
  • Horde_Feed_Entry_Blogroll::fromArray() : Add child elements and attributes to this element from a simple key => value hash. Because feed list outline elements only use attributes, this overrides Horde_Xml_Element#fromArray to set attributes whether the #Attribute syntax is used or not.
getDom (line 109)

Get a DOM representation of the element

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

  • access: public
DOMDocument getDom ()
offsetExists (line 476)

Required by the ArrayAccess interface.

  • access: public
void offsetExists ( $offset)
  • $offset

Implementation of:
ArrayAccess::offsetExists
offsetGet (line 491)

Required by the ArrayAccess interface.

  • access: public
void offsetGet ( $offset)
  • $offset

Implementation of:
ArrayAccess::offsetGet
offsetSet (line 506)

Required by the ArrayAccess interface.

  • access: public
void offsetSet ( $offset,  $value)
  • $offset
  • $value

Implementation of:
ArrayAccess::offsetSet
offsetUnset (line 527)

Required by the ArrayAccess interface.

  • access: public
void offsetUnset ( $offset)
  • $offset

Implementation of:
ArrayAccess::offsetUnset
saveXml (line 194)

Get an XML string representation of this element

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

  • access: public
string saveXml ()
saveXmlFragment (line 210)

Get the XML for only this element

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

  • access: public
string saveXmlFragment ()
setDom (line 123)

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.

  • access: public
void setDom ( $element)
  • DOMElement $element
setParent (line 415)

Set the parent element of this object to another Horde_Xml_Element.

  • access: public
void setParent (Horde_Xml_Element $element)
_children (line 448)

Finds children with tagnames matching $var

Similar to SimpleXML's children() method.

  • access: protected
array _children (string $var)
  • string $var: Tagname to match, can be either namespace:tagName or just tagName.
_ensureAppended (line 426)

Appends this element to its parent if necessary.

  • access: protected
void _ensureAppended ()
__call (line 371)

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.

  • return: The node's value, null, or an array of nodes.
  • access: public
mixed __call (string $var,  $unused)
  • string $var: The element to get the string value of.
  • $unused
__get (line 266)

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.

  • access: public
mixed __get (string $var)
  • string $var: The property to access.

Redefined in descendants as:
__isset (line 339)

Map isset calls onto the underlying entry representation.

Only supported by PHP 5.1 and later.

  • access: public
void __isset ( $var)
  • $var
__set (line 309)

Map variable sets onto the underlying entry representation.

  • access: public
void __set (string $var, string $val)
  • string $var: The property to change.
  • string $val: The property's new value.

Redefined in descendants as:
__sleep (line 250)

Prepare for serialization

  • access: public
array __sleep ()
__toString (line 404)

Returns the nodeValue of this element when this object is used in a string context.

  • access: public
void __toString ()
__unset (line 389)

Remove all children matching $var.

Only supported by PHP 5.1 and later.

  • access: public
void __unset ( $var)
  • $var
__wakeup (line 219)

Unserialization handler; parse $this->_element as either an XML string or a real DOMElement.

  • access: public
void __wakeup ()

Redefined in descendants as:

Documentation generated on Sun, 30 Jan 2011 05:17:05 +0000 by phpDocumentor 1.4.3