Xml Class Info:
- Class Declaration:
class Xml extends XmlNode
- File name:
- cake/libs/xml.php
- Description:
Main XML class.
Parses and stores XML data, representing the root of an XML document
- Class Inheritance
- Package
- cake
- Subpackage
- cake.cake.libs
- Since
CakePHP v .0.10.3.1400
Properties:
-
attributes array
Attributes on this node
-
children array
This node's children
-
name string
Name of node
-
namespace string
Node namespace
-
namespaces array
Namespaces defined for this node and all child nodes
-
value string
Value of node
Method Summary:
- addGlobalNamespace( $name, $url = NULL )
- addGlobalNs( $name, $url = NULL )
- addNamespace( $prefix, $url )
- append( $child, $options = array ( ) )
- cakeError( $method, $messages = array ( ) )
- child( $id )
- children( $name )
- cloneNode( )
- compare( $node )
- compose( $options = array ( ) )
- __construct( $input = NULL, $options = array ( ) )
- createElement( $name = NULL, $value = NULL, $attributes = array ( ), $namespace = false )
- createNode( $name = NULL, $value = NULL, $namespace = false )
- createTextNode( $value = NULL )
- dispatchMethod( $method, $params = array ( ) )
- document( )
- error( $msg, $code = 0, $line = 0 )
- first( )
- getError( $code )
- hasChildren( )
- header( $attrib = array ( ) )
- _killParent( $recursive = true )
- last( )
- load( $input )
- log( $msg, $type = 2 )
- name( )
- next( )
- nextSibling( )
- normalize( $object, $keyName = NULL, $options = array ( ) )
- Object( )
- options( $options = array ( ) )
- parent( )
- parse( )
- _persist( $name, $return, $object, $type = NULL )
- previous( )
- previousSibling( )
- removeGlobalNamespace( $name )
- removeGlobalNs( $name )
- removeNamespace( $prefix )
- requestAction( $url, $extra = array ( ) )
- resolveNamespace( $name, $url )
- _savePersistent( $name, $object )
- _set( $properties = array ( ) )
- setParent( $parent )
- _stop( $status = 0 )
- toArray( $camelize = true )
- toString( $options = array ( ) )
addGlobalNamespace
topAlias to Xml::addNs
- Parameters:
-
-
$name required
-
$url optional NULL
-
- Method defined in:
- cake/libs/xml.php on line 1191
- Access
public
- Static
addGlobalNs
topAdds a namespace to any XML documents generated or parsed
- Parameters:
-
-
string $name required
The namespace name
-
string $url optional NULL
The namespace URI; can be empty if in the default namespace map
-
- Method defined in:
- cake/libs/xml.php on line 1153
- Return
boolean False if no URL is specified, and the namespace does not exist default namespace map, otherwise true
- Access
public
- Static
addNamespace
topAdds a namespace to the current document
- Parameters:
-
-
string $prefix required
The namespace prefix
-
string $url required
The namespace DTD URL
-
- Method defined in:
- cake/libs/xml.php on line 1063
- Return
void
append
topAppend given node as a child.
- Parameters:
-
-
object $child required
XmlNode with appended child
-
array $options optional array ( )
XML generator options for objects and arrays
-
- Method defined in:
- cake/libs/xml.php on line 397
- Return
object A reference to the appended child node
- Access
public
cakeError
topUsed to report user friendly errors. If there is a file app/error.php or app/app_error.php this file will be loaded error.php is the AppError class it should extend ErrorHandler class.
- Parameters:
-
-
string $method required
Method to be called in the error class (AppError or ErrorHandler classes)
-
array $messages optional array ( )
Message that is to be displayed by the error class
-
- Method defined in:
- cake/libs/object.php on line 187
- Return
error message
- Access
public
child
topReturns child node with given ID.
- Parameters:
-
-
string $id required
Name of child node
-
- Method defined in:
- cake/libs/xml.php on line 481
- Return
object Child XmlNode
- Access
public
children
topGets a list of childnodes with the given tag name.
- Parameters:
-
-
string $name required
Tag name of child nodes
-
- Method defined in:
- cake/libs/xml.php on line 507
- Return
array An array of XmlNodes with the given tag name
- Access
public
cloneNode
topReturns a copy of self.
- Method defined in:
- cake/libs/xml.php on line 373
- Return
object Cloned instance
- Access
public
compare
topCompares $node to this XmlNode object
- Parameters:
-
-
$node required
-
- Method defined in:
- cake/libs/xml.php on line 384
- Return
boolean True if the nodes match, false otherwise
- Access
public
compose
topReturns a string representation of the XML object
- Parameters:
-
-
mixed $options optional array ( )
If boolean: whether to include the XML header with the document (defaults to true); if an array, overrides the default XML generation options
-
- Method defined in:
- cake/libs/xml.php on line 991
- Return
string XML data
- Access
public
- Deprecated
- See
__construct
topConstructor. Sets up the XML parser with options, gives it this object as its XML object, and sets some variables.
Options
- '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(). - 'slug': A boolean to indicate whether or not you want the string version of the XML document to have its tags run through Inflector::slug(). Defaults to true- Parameters:
-
-
mixed $input optional NULL
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 optional array ( )
Options to set up with, for valid options see above:
-
- Method defined in:
- cake/libs/xml.php on line 864
createElement
topCreates an XmlElement object that can be appended to this document or a node in it
- Parameters:
-
-
string $name optional NULL
Element name
-
string $value optional NULL
Element value
-
array $attributes optional array ( )
Element attributes
-
string $namespace optional false
Node namespace
-
- Method defined in:
- cake/libs/xml.php on line 169
- Return
object XmlElement
createNode
topCreates an XmlNode object that can be appended to this document or a node in it
- Parameters:
-
-
string $name optional NULL
Node name
-
string $value optional NULL
Node value
-
string $namespace optional false
Node namespace
-
- Method defined in:
- cake/libs/xml.php on line 154
- Return
object XmlNode
createTextNode
topCreates an XmlTextNode object that can be appended to this document or a node in it
- Parameters:
-
-
string $value optional NULL
Node value
-
- Method defined in:
- cake/libs/xml.php on line 181
- Return
object XmlTextNode
dispatchMethod
topCalls a method on this object with the given parameters. Provides an OO wrapper
for call_user_func_array
- Parameters:
-
-
string $method required
Name of the method to call
-
array $params optional array ( )
Parameter list to use when calling $method
-
- Method defined in:
- cake/libs/object.php on line 107
- Return
mixed Returns the result of the method call
- Access
public
document
topReturns the XML document to which this node belongs
- Method defined in:
- cake/libs/xml.php on line 574
- Return
object Parent XML object
- Access
public
error
topIf debug mode is on, this method echoes an error message.
- Parameters:
-
-
string $msg required
Error message
-
integer $code optional 0
Error code
-
integer $line optional 0
Line in file
-
- Method defined in:
- cake/libs/xml.php on line 1003
- Access
public
first
topReturns first child node, or null if empty.
- Method defined in:
- cake/libs/xml.php on line 450
- Return
object First XmlNode
- Access
public
getError
topReturns a string with a textual description of the error code, or FALSE if no description was found.
- Parameters:
-
-
integer $code required
Error code
-
- Method defined in:
- cake/libs/xml.php on line 1016
- Return
string Error message
- Access
public
hasChildren
topReturns true if this structure has child nodes.
- Method defined in:
- cake/libs/xml.php on line 591
- Return
bool
- Access
public
header
topReturn a header used on the first line of the xml file
- Parameters:
-
-
mixed $attrib optional array ( )
attributes of the header element
-
- Method defined in:
- cake/libs/xml.php on line 1120
- Return
string formated header
_killParent
topDebug method. Deletes the parent. Also deletes this node's children, if given the $recursive parameter.
- Parameters:
-
-
boolean $recursive optional true
Recursively delete elements.
-
- Method defined in:
- cake/libs/xml.php on line 764
- Access
protected
last
topReturns last child node, or null if empty.
- Method defined in:
- cake/libs/xml.php on line 465
- Return
object Last XmlNode
- Access
public
load
topInitialize XML object from a given XML string. Returns false on error.
- Parameters:
-
-
string $input required
XML string, a path to a file, or an HTTP resource to load
-
- Method defined in:
- cake/libs/xml.php on line 900
- Return
boolean Success
- Access
public
log
topConvience method to write a message to CakeLog. See CakeLog::write() for more information on writing to logs.
- Parameters:
-
-
string $msg required
Log message
-
integer $type optional 2
Error type constant. Defined in app/config/core.php.
-
- Method defined in:
- cake/libs/object.php on line 148
- Return
boolean Success of log write
- Access
public
name
topReturns the fully-qualified XML node name, with namespace
- Method defined in:
- cake/libs/xml.php on line 329
- Access
public
next
topGet next element. NOT implemented.
- Method defined in:
- cake/libs/xml.php on line 1029
- Return
object
- Access
public
nextSibling
topGets a reference to the next child node in the list of this node's parent.
- Method defined in:
- cake/libs/xml.php on line 524
- Return
object A reference to the XmlNode object
- Access
public
normalize
topGets the XML element properties from an object.
- Parameters:
-
-
object $object required
Object to get properties from
-
$keyName optional NULL
-
$options optional array ( )
-
- Method defined in:
- cake/libs/xml.php on line 194
- Return
array Properties from object
- Access
public
Object
topA hack to support __construct() on PHP 4 Hint: descendant classes have no PHP4 class_name() constructors, so this constructor gets called first and calls the top-layer __construct() which (if present) should call parent::__construct()
- Method defined in:
- cake/libs/object.php on line 43
- Return
Object
options
topSets/gets global XML options
- Parameters:
-
-
array $options optional array ( )
-
- Method defined in:
- cake/libs/xml.php on line 1240
- Return
array
- Access
public
- Static
parent
topGet parent element. NOT implemented.
- Method defined in:
- cake/libs/xml.php on line 1051
- Return
object
- Access
public
parse
topParses and creates XML nodes from the __rawData property.
- Method defined in:
- cake/libs/xml.php on line 930
- Return
boolean Success
- Access
public
- See
- Todo
figure out how to link attributes and namespaces
_persist
topChecks for a persistent class file, if found file is opened and true returned If file is not found a file is created and false returned If used in other locations of the model you should choose a unique name for the persistent file There are many uses for this method, see manual for examples
- Parameters:
-
-
string $name required
name of the class to persist
-
$return required
-
string $object required
the object to persist
-
$type optional NULL
-
- Method defined in:
- cake/libs/object.php on line 218
- Return
boolean Success
- Access
protected
- Todo
add examples to manual
previous
topGet previous element. NOT implemented.
- Method defined in:
- cake/libs/xml.php on line 1040
- Return
object
- Access
public
previousSibling
topGets a reference to the previous child node in the list of this node's parent.
- Method defined in:
- cake/libs/xml.php on line 544
- Return
object A reference to the XmlNode object
- Access
public
removeGlobalNamespace
topAlias to Xml::removeNs
- Parameters:
-
-
$name required
-
- Method defined in:
- cake/libs/xml.php on line 1228
- Access
public
- Static
removeGlobalNs
topRemoves a namespace added in addNs()
- Parameters:
-
-
string $name required
The namespace name or URI
-
- Method defined in:
- cake/libs/xml.php on line 1202
- Access
public
- Static
removeNamespace
topRemoves a namespace to the current document
- Parameters:
-
-
string $prefix required
The namespace prefix
-
- Method defined in:
- cake/libs/xml.php on line 1079
- Return
void
requestAction
topCalls a controller's method from any location. Can be used to connect controllers together or tie plugins into a main application. requestAction can be used to return rendered views or fetch the return value from controller actions.
- Parameters:
-
-
mixed $url required
String or array-based url.
-
array $extra optional array ( )
if array includes the key "return" it sets the AutoRender to true.
-
- Method defined in:
- cake/libs/object.php on line 80
- Return
mixed Boolean true or false on success/failure, or contents of rendered action if 'return' is set in $extra.
- Access
public
resolveNamespace
topResolves current namespace
- Parameters:
-
-
string $name required
-
string $url required
-
- Method defined in:
- cake/libs/xml.php on line 1169
- Return
array
_savePersistent
topYou should choose a unique name for the persistent file
There are many uses for this method, see manual for examples
- Parameters:
-
-
string $name required
name used for object to cache
-
object $object required
the object to persist
-
- Method defined in:
- cake/libs/object.php on line 247
- Return
boolean true on save, throws error if file can not be created
- Access
protected
_set
topAllows setting of multiple properties of the object in a single line of code. Will only set properties that are part of a class declaration.
- Parameters:
-
-
array $properties optional array ( )
An associative array containing properties and corresponding values.
-
- Method defined in:
- cake/libs/object.php on line 166
- Return
void
- Access
protected
setParent
topSets the parent node of this XmlNode.
- Parameters:
-
-
$parent required
-
- Method defined in:
- cake/libs/xml.php on line 344
- Access
public
_stop
topStop execution of the current script. Wraps exit() making testing easier.
- Parameters:
-
-
$status optional 0
-
- Method defined in:
- cake/libs/object.php on line 135
- Return
void
- Access
public
toArray
topReturn array representation of current object.
- Parameters:
-
-
boolean $camelize optional true
true will camelize child nodes, false will not alter node names
-
- Method defined in:
- cake/libs/xml.php on line 688
- Return
array Array representation
- Access
public
toString
topReturn string representation of current object.
- Parameters:
-
-
$options optional array ( )
-
- Method defined in:
- cake/libs/xml.php on line 1095
- Return
string String representation
- Access
public