Xml Class Reference

Inheritance diagram for Xml:

XmlNode Object List of all members.

Public Member Functions

 __construct ($input=null, $options=array())
 __destruct ()
 __initParser ()
 addNamespace ($prefix, $url)
 compose ($options=array())
 error ($msg, $code=0, $line=0)
 getError ($code)
 header ($attrib=array())
 load ($input)
next ()
parent ()
 parse ()
previous ()
 removeNamespace ($prefix)
 resolveNamespace ($name, $url)
 toString ($options=array())

Static Public Member Functions

 addGlobalNamespace ($name, $url=null)
 addGlobalNs ($name, $url=null)
 options ($options=array())
 removeGlobalNamespace ($name)
 removeGlobalNs ($name)

Public Attributes

 $__file
 $__header = null
 $__parser
 $__rawData = null
 $__tags = array()
 $encoding = 'UTF-8'
 $version = '1.0'

Detailed Description

Definition at line 757 of file xml.php.


Constructor & Destructor Documentation

Xml::__construct ( input = null,
options = array() 
)

Constructor. Sets up the XML parser with options, gives it this object as its XML object, and sets some variables.

Parameters:
mixed $input The content with which this XML document should be initialized. Can be a string, array or object. If a string is specified, it may be a literal XML document, or a URL or file path to read from.
array $options Options to set up with, valid options are as follows:
  • 'root': The name of the root element, defaults to 'document'
  • 'version': The XML version, defaults to '1.0'
  • 'encoding': Document encoding, defaults to 'UTF-8'
  • 'namespaces': An array of namespaces (as strings) used in this document
  • 'format': Specifies the format this document converts to when parsed or rendered out as text, either 'attributes' or 'tags', defaults to 'attributes'
    • 'tags': An array specifying any tag-specific formatting options, indexed by tag name. See XmlNode::normalize().
See also:
XmlNode::normalize()

Definition at line 833 of file xml.php.

References __construct(), XmlNode::createNode(), XmlNode::document(), and options().

Xml::__destruct (  ) 

Destructor, used to free resources.

private

Definition at line 1097 of file xml.php.


Member Function Documentation

Xml::__initParser (  ) 

Initializes the XML parser resource

Returns:
void private

Definition at line 939 of file xml.php.

Xml::addGlobalNamespace ( name,
url = null 
) [static]

Alias to Xml::addNs

public

Definition at line 1148 of file xml.php.

References $url, and addGlobalNs().

Xml::addGlobalNs ( name,
url = null 
) [static]

Adds a namespace to any XML documents generated or parsed

Parameters:
string $name The namespace name
string $url The namespace URI; can be empty if in the default namespace map
Returns:
boolean False if no URL is specified, and the namespace does not exist default namespace map, otherwise true public

Definition at line 1112 of file xml.php.

References $url, XmlManager::getInstance(), and resolveNamespace().

Referenced by addGlobalNamespace(), and XmlNode::addNamespace().

Xml::addNamespace ( prefix,
url 
)

Adds a namespace to the current document

Parameters:
string $prefix The namespace prefix
string $url The namespace DTD URL
Returns:
void

Reimplemented from XmlNode.

Definition at line 1024 of file xml.php.

References $url.

Xml::compose ( options = array()  ) 

Returns a string representation of the XML object

Parameters:
mixed $options If boolean: whether to include the XML header with the document (defaults to true); if an array, overrides the default XML generation options
Returns:
string XML data public
Deprecated:
See also:
Xml::toString()

Definition at line 957 of file xml.php.

Xml::error ( msg,
code = 0,
line = 0 
)

If debug mode is on, this method echoes an error message.

Parameters:
string $msg Error message
integer $code Error code
integer $line Line in file public

Definition at line 968 of file xml.php.

References debug(), and Configure::read().

Xml::getError ( code  ) 

Returns a string with a textual description of the error code, or FALSE if no description was found.

Parameters:
integer $code Error code
Returns:
string Error message public

Definition at line 980 of file xml.php.

Xml::header ( attrib = array()  ) 

Return a header used on the first line of the xml file

Parameters:
mixed $attrib attributes of the header element
Returns:
string formated header

Definition at line 1078 of file xml.php.

Xml::load ( input  ) 

Initialize XML object from a given XML string. Returns false on error.

Parameters:
string $input XML string, a path to a file, or an HTTP resource to load
Returns:
boolean Success public

Definition at line 870 of file xml.php.

References App::import().

& Xml::next (  ) 

Get next element. NOT implemented.

Returns:
object public

Definition at line 993 of file xml.php.

Xml::options ( options = array()  )  [static]

Sets/gets global XML options

Parameters:
array $options
Returns:
array public

Definition at line 1194 of file xml.php.

References XmlManager::getInstance().

Referenced by __construct(), XmlTextNode::toString(), toString(), and XmlNode::toString().

& Xml::parent (  ) 

Get parent element. NOT implemented.

Returns:
object public

Reimplemented from XmlNode.

Definition at line 1013 of file xml.php.

Xml::parse (  ) 

Parses and creates XML nodes from the __rawData property.

Returns:
boolean Success public
See also:
Xml::load()
Todo:
figure out how to link attributes and namespaces

Definition at line 899 of file xml.php.

References a().

& Xml::previous (  ) 

Get previous element. NOT implemented.

Returns:
object public

Definition at line 1003 of file xml.php.

Xml::removeGlobalNamespace ( name  )  [static]

Alias to Xml::removeNs

public

Definition at line 1183 of file xml.php.

References removeGlobalNs().

Xml::removeGlobalNs ( name  )  [static]

Removes a namespace added in addNs()

Parameters:
string $name The namespace name or URI public

Definition at line 1158 of file xml.php.

References XmlManager::getInstance().

Referenced by removeGlobalNamespace(), and XmlNode::removeNamespace().

Xml::removeNamespace ( prefix  ) 

Removes a namespace to the current document

Parameters:
string $prefix The namespace prefix
Returns:
void

Reimplemented from XmlNode.

Definition at line 1039 of file xml.php.

Xml::resolveNamespace ( name,
url 
)

Resolves current namespace

Parameters:
string $name
string $url
Returns:
array

Definition at line 1127 of file xml.php.

References $url, and XmlManager::getInstance().

Referenced by addGlobalNs().

Xml::toString ( options = array()  ) 

Return string representation of current object.

Returns:
string String representation public

Definition at line 1054 of file xml.php.

References options().


Member Data Documentation

Xml::$__file

Definition at line 772 of file xml.php.

Xml::$__header = null

Definition at line 787 of file xml.php.

Xml::$__parser

Definition at line 765 of file xml.php.

Xml::$__rawData = null

Definition at line 779 of file xml.php.

Xml::$__tags = array()

Definition at line 796 of file xml.php.

Xml::$encoding = 'UTF-8'

Definition at line 812 of file xml.php.

Xml::$version = '1.0'

Definition at line 804 of file xml.php.


The documentation for this class was generated from the following file:
Generated on Sun Nov 22 00:30:57 2009 for CakePHP 1.2.x.x (v1.2.4.8284) by doxygen 1.4.7