Zend Framework  1.12
Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | Static Protected Attributes | List of all members
Zend_Gdata_App_Base Class Reference

Public Member Functions

 __construct ()
 
 getText ($trim=true)
 Returns the child text node of this element This represents any raw text contained within the XML element.
 
 setText ($value)
 Sets the child text node of this element This represents any raw text contained within the XML element.
 
 getExtensionElements ()
 Returns an array of all elements not matched to data model classes during the parsing of the XML.
 
 setExtensionElements ($value)
 Sets an array of all elements not matched to data model classes during the parsing of the XML.
 
 getExtensionAttributes ()
 Returns an array of all extension attributes not transformed into data model properties during parsing of the XML.
 
 setExtensionAttributes ($value)
 Sets an array of all extension attributes not transformed into data model properties during parsing of the XML.
 
 getDOM ($doc=null, $majorVersion=1, $minorVersion=null)
 Retrieves a DOMElement which corresponds to this element and all child properties.
 
 transferFromDOM ($node)
 Transfers each child and attribute into member variables.
 
 transferFromXML ($xml)
 Parses the provided XML text and generates data model classes for each know element by turning the XML text into a DOM tree and calling transferFromDOM($element).
 
 saveXML ()
 Converts this element and all children into XML text using getDOM()
 
 getXML ()
 Alias for saveXML() returns XML content for this element and all children.
 
 encode ()
 Alias for saveXML()
 
 lookupNamespace ($prefix, $majorVersion=1, $minorVersion=null)
 Get the full version of a namespace prefix.
 
 registerNamespace ($prefix, $namespaceUri, $majorVersion=1, $minorVersion=0)
 Add a namespace and prefix to the registered list.
 
 registerAllNamespaces ($namespaceArray)
 Add an array of namespaces to the registered list.
 
 __get ($name)
 Magic getter to allow access like $entry->foo to call $entry->getFoo() Alternatively, if no getFoo() is defined, but a $_foo protected variable is defined, this is returned.
 
 __set ($name, $val)
 Magic setter to allow acces like $entry->foo='bar' to call $entry->setFoo('bar') automatically.
 
 __isset ($name)
 Magic __isset method.
 
 __unset ($name)
 Magic __unset method.
 
 __toString ()
 Magic toString method allows using this directly via echo Works best in PHP >= 4.2.0.
 

Static Public Member Functions

static flushNamespaceLookupCache ()
 Flush namespace lookup cache.
 

Protected Member Functions

 takeChildFromDOM ($child)
 Given a child DOMNode, tries to determine how to map the data into object instance members.
 
 takeAttributeFromDOM ($attribute)
 Given a DOMNode representing an attribute, tries to map the data into instance members.
 

Protected Attributes

 $_rootElement = null
 
 $_rootNamespace = 'atom'
 
 $_rootNamespaceURI = null
 
 $_extensionElements = array()
 
 $_extensionAttributes = array()
 
 $_text = null
 
 $_namespaces
 

Static Protected Attributes

static $_namespaceLookupCache = array()
 

Constructor & Destructor Documentation

__construct ( )

Member Function Documentation

__get (   $name)

Magic getter to allow access like $entry->foo to call $entry->getFoo() Alternatively, if no getFoo() is defined, but a $_foo protected variable is defined, this is returned.

TODO Remove ability to bypass getFoo() methods??

Parameters
string$nameThe variable name sought
__isset (   $name)

Magic __isset method.

Parameters
string$name
__set (   $name,
  $val 
)

Magic setter to allow acces like $entry->foo='bar' to call $entry->setFoo('bar') automatically.

Alternatively, if no setFoo() is defined, but a $_foo protected variable is defined, this is returned.

TODO Remove ability to bypass getFoo() methods??

Parameters
string$name
string$value
__toString ( )

Magic toString method allows using this directly via echo Works best in PHP >= 4.2.0.

Returns
string The text representation of this object
__unset (   $name)

Magic __unset method.

Parameters
string$name
encode ( )

Alias for saveXML()

Can be overridden by children to provide more complex representations of entries.

Returns
string Encoded string content
static flushNamespaceLookupCache ( )
static

Flush namespace lookup cache.

Empties the namespace lookup cache. Call this function if you have added data to the namespace lookup table that contradicts values that may have been cached during a previous call to lookupNamespace().

getDOM (   $doc = null,
  $majorVersion = 1,
  $minorVersion = null 
)

Retrieves a DOMElement which corresponds to this element and all child properties.

This is used to build an entry back into a DOM and eventually XML text for sending to the server upon updates, or for application storage/persistence.

Parameters
DOMDocument$docThe DOMDocument used to construct DOMElements
Returns
DOMElement The DOMElement representing this element and all child properties.
getExtensionAttributes ( )

Returns an array of all extension attributes not transformed into data model properties during parsing of the XML.

Each element of the array is a hashed array of the format: array('namespaceUri' => string, 'name' => string, 'value' => string);

Returns
array All extension attributes
getExtensionElements ( )

Returns an array of all elements not matched to data model classes during the parsing of the XML.

Returns
array All elements not matched to data model classes during parsing
getText (   $trim = true)

Returns the child text node of this element This represents any raw text contained within the XML element.

Returns
string Child text node
getXML ( )

Alias for saveXML() returns XML content for this element and all children.

Returns
string XML content
array Memoized results from calls to lookupNamespace (   $prefix,
  $majorVersion = 1,
  $minorVersion = null 
)

Get the full version of a namespace prefix.

expensive calls to getGreatestBoundedValue().

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.

Parameters
string$prefixThe namespace prefix to lookup.
integer$majorVersionThe major protocol version in effect. Defaults to '1'.
integer$minorVersionThe minor protocol version in effect. Defaults to null (use latest).
Returns
string

The key is in the form 'prefix-majorVersion-minorVersion', and the value is the output from getGreatestBoundedValue().

registerAllNamespaces (   $namespaceArray)

Add an array of namespaces to the registered list.

Takes an array in the format of: namespace prefix, namespace URI, major protocol version, minor protocol version and adds them with calls to ->registerNamespace()

Parameters
array$namespaceArrayAn array of namespaces.
Returns
void
registerNamespace (   $prefix,
  $namespaceUri,
  $majorVersion = 1,
  $minorVersion = 0 
)

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 $this->lookupNamespace().

WARNING: Currently, registering a namespace will NOT invalidate any memoized data stored in $_namespaceLookupCache. Under normal use, this behavior is acceptable. If you are adding contradictory data to the namespace lookup table, you must call flushNamespaceLookupCache().

Parameters
string$prefixThe namespace prefix
string$namespaceUriThe full namespace URI
integer$majorVersionThe major protocol version in effect. Defaults to '1'.
integer$minorVersionThe minor protocol version in effect. Defaults to null (use latest).
Returns
void
saveXML ( )

Converts this element and all children into XML text using getDOM()

Returns
string XML content
setExtensionAttributes (   $value)

Sets an array of all extension attributes not transformed into data model properties during parsing of the XML.

Each element of the array is a hashed array of the format: array('namespaceUri' => string, 'name' => string, 'value' => string); This can be used to add arbitrary attributes to any data model element

Parameters
array$valueAll extension attributes
Returns
Zend_Gdata_App_Base Returns an object of the same type as 'this' to provide a fluent interface.
setExtensionElements (   $value)

Sets an array of all elements not matched to data model classes during the parsing of the XML.

This method can be used to add arbitrary child XML elements to any data model class.

Parameters
array$valueAll extension elements
Returns
Zend_Gdata_App_Base Returns an object of the same type as 'this' to provide a fluent interface.
setText (   $value)

Sets the child text node of this element This represents any raw text contained within the XML element.

Parameters
string$valueChild text node
Returns
Zend_Gdata_App_Base Returns an object of the same type as 'this' to provide a fluent interface.
takeAttributeFromDOM (   $attribute)
protected

Given a DOMNode representing an attribute, tries to map the data into instance members.

If no mapping is defined, the name and value are stored in an array.

Parameters
DOMNode$attributeThe DOMNode attribute needed to be handled
takeChildFromDOM (   $child)
protected

Given a child DOMNode, tries to determine how to map the data into object instance members.

If no mapping is defined, Extension_Element objects are created and stored in an array.

Parameters
DOMNode$childThe DOMNode needed to be handled
transferFromDOM (   $node)

Transfers each child and attribute into member variables.

This is called when XML is received over the wire and the data model needs to be built to represent this XML.

Parameters
DOMNode$nodeThe DOMNode that represents this object's data
transferFromXML (   $xml)

Parses the provided XML text and generates data model classes for each know element by turning the XML text into a DOM tree and calling transferFromDOM($element).

The first data model element with the same name as $this->_rootElement is used and the child elements are recursively parsed.

Parameters
string$xmlThe XML text to parse

Member Data Documentation

$_extensionAttributes = array()
protected
$_extensionElements = array()
protected
$_namespaceLookupCache = array()
staticprotected
$_namespaces
protected
Initial value:
= array(
'atom' => array(
1 => array(
0 => 'http://www.w3.org/2005/Atom'
)
),
'app' => array(
1 => array(
0 => 'http://purl.org/atom/app#'
),
2 => array(
0 => 'http://www.w3.org/2007/app'
)
)
)
$_rootElement = null
protected
$_rootNamespace = 'atom'
protected
$_rootNamespaceURI = null
protected
$_text = null
protected