Class XmlHelper
XML Helper class for easy output of XML structures.
XmlHelper encloses all methods needed while working with XML documents.
- AppHelper
- XmlHelper
Direct Subclasses
Copyright: Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
License: The MIT License
Location: view/helpers/xml.php
Properties summary
-
$Xml
public -
$XmlElement
public -
$encoding
publicstring
Default document encoding
Method Summary
-
__construct() public
Constructor -
addNs() public deprecated
Adds a namespace to any documents generated -
closeElem() public
Create closing tag for current element -
elem() public
Generates an XML element -
header() public
Returns an XML document header -
removeNs() public deprecated
Removes a namespace added in addNs() -
serialize() public
Serializes a model resultset into XML
Method Detail
addNs() public deprecated ¶
addNs( string $name , string $url = null )
Adds a namespace to any documents generated
Deprecated
Parameters
- string $name
- The namespace name
- string $url optional null
- The namespace URI; can be empty if in the default namespace map
Returns
False if no URL is specified, and the namespace does not exist default namespace map, otherwise true
See
elem() public ¶
elem( string $name , array $attrib = array() , mixed $content = null , boolean $endTag = true )
Generates an XML element
Parameters
- string $name
- The name of the XML element
- array $attrib optional array()
- The attributes of the XML element
- mixed $content optional null
- XML element content
- boolean $endTag optional true
- Whether the end tag of the element should be printed
Returns
XML
header() public ¶
header( array $attrib = array() )
Returns an XML document header
Parameters
- array $attrib optional array()
- Header tag attributes
Returns
XML header
removeNs() public deprecated ¶
removeNs( string $name )
Removes a namespace added in addNs()
Deprecated
Parameters
- string $name
- The namespace name or URI
See
serialize() public ¶
serialize( mixed $data , array $options = array() )
Serializes a model resultset into XML
Parameters
- mixed $data
- The content to be converted to XML
- array $options optional array()
The data formatting options. For a list of valid options, see XmlNode::__construct().
Returns
A copy of $data in XML format