PHP Класс Horde_Xml_Element, horde

Автор: Chuck Hagenbuch ([email protected])
Наследование: implements ArrayAccess
Показать файл Открыть проект Примеры использования класса

Защищенные свойства (Protected)

Свойство Тип Описание
$_appended boolean
$_children array
$_element DOMElement
$_namespaces array
$_parentElement Horde_Xml_Element
$_serialized string A string representation of the element, used when serializing/unserializing.

Открытые методы

Метод Описание
__call ( string $var, $unused ) : mixed Get the value of an element with method syntax.
__construct ( $element ) Horde_Xml_Element constructor.
__get ( string $var ) : mixed Map variable access onto the underlying entry representation.
__isset ( $var ) Map isset calls onto the underlying entry representation.
__set ( string $var, string $val ) Map variable sets onto the underlying entry representation.
__sleep ( ) : array Prepare for serialization
__toString ( ) Returns the nodeValue of this element when this object is used in a string context.
__unset ( $var ) Remove all children matching $var.
__wakeup ( ) Unserialization handler; handles $this->_element being an instance of DOMElement or Horde_Xml_Element, or parses it as an XML string.
appendChild ( Horde_Xml_Element $element ) Append a child node to this element.
fromArray ( $array ) Add child elements and attributes to this element from a simple key => value hash. Keys can be:
getDom ( ) : DOMElement Get a DOM representation of the element
lookupNamespace ( $prefix ) : string Get the full version of a namespace prefix
offsetExists ( $offset ) Required by the ArrayAccess interface.
offsetGet ( $offset ) Required by the ArrayAccess interface.
offsetSet ( $offset, $value ) Required by the ArrayAccess interface.
offsetUnset ( $offset ) Required by the ArrayAccess interface.
registerNamespace ( string $prefix, string $namespaceURI ) Add a namespace and prefix to the registered list
saveXml ( $formatted = false ) : string Get an XML string representation of this element
saveXmlFragment ( $formatted = false ) : string Get the XML for only this element
setDom ( DOMElement $element ) Update the object from a DOM element
setParent ( Horde_Xml_Element $element ) Set the parent element of this object to another Horde_Xml_Element.

Защищенные методы

Метод Описание
_cacheChildren ( ) Build a cache of child nodes.
_children ( $var ) : array Finds children with tagnames matching $var
_ensureAppended ( ) Appends this element to its parent if necessary.
_expireCachedChildren ( ) Expire cached children.

Описание методов

__call() публичный Метод

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.
public __call ( string $var, $unused ) : mixed
$var string The element to get the string value of.
Результат mixed The node's value, null, or an array of nodes.

__construct() публичный Метод

Horde_Xml_Element constructor.
public __construct ( $element )

__get() публичный Метод

Get-style access returns a Horde_Xml_Element representing the child element accessed. To get string values, use method syntax with the __call() overriding.
public __get ( string $var ) : mixed
$var string The property to access.
Результат mixed

__isset() публичный Метод

Map isset calls onto the underlying entry representation.
public __isset ( $var )

__set() публичный Метод

Map variable sets onto the underlying entry representation.
public __set ( string $var, string $val )
$var string The property to change.
$val string The property's new value.

__sleep() публичный Метод

Prepare for serialization
public __sleep ( ) : array
Результат array

__toString() публичный Метод

Returns the nodeValue of this element when this object is used in a string context.
public __toString ( )

__unset() публичный Метод

Remove all children matching $var.
public __unset ( $var )

__wakeup() публичный Метод

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

_cacheChildren() защищенный Метод

Build a cache of child nodes.
protected _cacheChildren ( )

_children() защищенный Метод

Similar to SimpleXML's children() method.
protected _children ( $var ) : array
Результат array

_ensureAppended() защищенный Метод

Appends this element to its parent if necessary.
protected _ensureAppended ( )

_expireCachedChildren() защищенный Метод

Expire cached children.
protected _expireCachedChildren ( )

appendChild() публичный Метод

Append a child node to this element.
public appendChild ( Horde_Xml_Element $element )
$element Horde_Xml_Element The element to append.

fromArray() публичный Метод

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
public fromArray ( $array )
$array Hash to import into this element.

getDom() публичный Метод

Returns the underlying DOM object, which can then be manipulated with full DOM methods.
public getDom ( ) : DOMElement
Результат DOMElement

lookupNamespace() публичный статический Метод

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.
public static lookupNamespace ( $prefix ) : string
Результат string

offsetExists() публичный Метод

Required by the ArrayAccess interface.
public offsetExists ( $offset )

offsetGet() публичный Метод

Required by the ArrayAccess interface.
public offsetGet ( $offset )

offsetSet() публичный Метод

Required by the ArrayAccess interface.
public offsetSet ( $offset, $value )

offsetUnset() публичный Метод

Required by the ArrayAccess interface.
public offsetUnset ( $offset )

registerNamespace() публичный статический Метод

Takes a prefix and a full namespace URI and adds them to the list of registered namespaces for use by Horde_Xml_Element::lookupNamespace().
public static registerNamespace ( string $prefix, string $namespaceURI )
$prefix string The namespace prefix
$namespaceURI string The full namespace URI

saveXml() публичный Метод

Returns a string of this element's XML, including the XML prologue.
public saveXml ( $formatted = false ) : string
Результат string

saveXmlFragment() публичный Метод

Returns a string of this element's XML without prologue.
public saveXmlFragment ( $formatted = false ) : string
Результат string

setDom() публичный Метод

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.
public setDom ( DOMElement $element )
$element DOMElement

setParent() публичный Метод

Set the parent element of this object to another Horde_Xml_Element.
public setParent ( Horde_Xml_Element $element )
$element Horde_Xml_Element

Описание свойств

$_appended защищенное свойство

protected bool $_appended
Результат boolean

$_children защищенное свойство

protected array $_children
Результат array

$_element защищенное свойство

protected DOMElement $_element
Результат DOMElement

$_namespaces защищенное статическое свойство

protected static array $_namespaces
Результат array

$_parentElement защищенное свойство

protected Horde_Xml_Element $_parentElement
Результат Horde_Xml_Element

$_serialized защищенное свойство

A string representation of the element, used when serializing/unserializing.
protected string $_serialized
Результат string