Source for file xmlelement.php
Documentation is available at xmlelement.php
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE
JLog::add('JXMLElement is deprecated. Use SimpleXMLElement.', JLog::WARNING, 'deprecated');
* Wrapper class for php SimpleXMLElement.
* @deprecated 13.3 (Platform) & 4.0 (CMS) - Use SimpleXMLElement instead.
* Get the name of the element.
* @deprecated 13.3 Use SimpleXMLElement::getName() instead.
JLog::add('JXMLElement::name() is deprecated, use SimpleXMLElement::getName() instead.', JLog::WARNING, 'deprecated');
* Return a well-formed XML string based on SimpleXML element
* @param boolean $compressed Should we use indentation and newlines ?
* @param string $indent Indention character.
* @param integer $level The level within the document which informs the indentation.
* @deprecated 13.3 Use SimpleXMLElement::asXML() instead.
public function asFormattedXML($compressed =
false, $indent =
"\t", $level =
0)
JLog::add('JXMLElement::asFormattedXML() is deprecated, use SimpleXMLElement::asXML() instead.', JLog::WARNING, 'deprecated');
// Start a new line, indent by the number indicated in $level
$out .=
($compressed) ?
'' :
"\n" .
str_repeat($indent, $level);
// Add a <, and add the name of the tag
// For each attribute, add attr="value"
foreach ($this->attributes() as $attr)
$out .=
' ' .
$attr->getName() .
'="' .
htmlspecialchars((string)
$attr, ENT_COMPAT, 'UTF-8') .
'"';
// If there are no children and it contains no data, end it off with a />
if (!count($this->children()) &&
!(string)
$this)
if (count($this->children()))
// Close off the start tag
// For each child, call the asFormattedXML function (this will ensure that all children are added recursively)
foreach ($this->children() as $child)
$out .=
$child->asFormattedXML($compressed, $indent, $level);
// Add the newline and indentation to go along with the close tag
$out .=
($compressed) ?
'' :
"\n" .
str_repeat($indent, $level);
// If there is data, close off the start tag and add the data
$out .=
'</' .
$this->getName() .
'>';
Documentation generated on Tue, 19 Nov 2013 15:18:38 +0100 by phpDocumentor 1.4.3