Phpfox_Xml_Builder

Description

XML Builder Class is used to create and build XML files.

PHP usage:

  1.  $oXml Phpfox::getLib('xml.builder');
  2.  $oXml->addGroup('foo'array('bar' => 'value'));
  3.  $oXml->addTag('sample''This is some value.'array('extra' => 'info'));
  4.  $oXml->closeGroup();

XML output of the PHP code:

  1.  <foo var="value">
  2.          <sample extra="info">
  3.              This is some value.
  4.          </sample>
  5.  </foo>

  • author: Raymond Benc
  • version: $Id: builder.class.php 1687 2010-07-22 03:13:27Z Raymond_Benc $
  • copyright: [PHPFOX_COPYRIGHT]

Located in /include/library/phpfox/xml/builder.class.php (line 34)


	
			
Variable Summary
 array $_aOpenTags
 array $_aXml
 strig $_sDoc
 string $_sTabs
Method Summary
 Phpfox_Xml_Builder __construct ()
 void addGroup (string $sTag, [array $aAttr = array()])
 object Return addTag (string $sTag, [string $sContent = ''], [array $aAttr = array()], [bool $bCdata = false], [bool $bHtmlSpecialChars = false])
 void closeGroup ()
 string output ()
 void setXml (array $aParams)
 string _buildTag (string $sTag, array $aAttr, [bool $closing = false])
 string _escapeCdata (string $sXml)
 string _htmlSpecialcharsUni (string $sText, [bool $bEntities = true])
Variables
array $_aOpenTags = array() (line 41)

History of open tags.

  • access: private
array $_aXml = array() (line 62)

XML settings.

  • access: private
strig $_sDoc (line 55)

XML code we are building.

  • access: private
string $_sTabs (line 48)

Current tab.

  • access: private
Methods
Constructor __construct (line 68)

Class constructor.

  • access: public
Phpfox_Xml_Builder __construct ()
addGroup (line 88)

Creates an XML group.

  • access: public
void addGroup (string $sTag, [array $aAttr = array()])
  • string $sTag: Group name.
  • array $aAttr: Optional ARRAY of attributes.
addTag (line 116)

Create an XML tag.

  • return: self.
  • access: public
object Return addTag (string $sTag, [string $sContent = ''], [array $aAttr = array()], [bool $bCdata = false], [bool $bHtmlSpecialChars = false])
  • string $sTag: Name of the tag.
  • string $sContent: Tag inner content.
  • array $aAttr: Optional ARRAY of attributes.
  • bool $bCdata: TRUE to force CDATA.
  • bool $bHtmlSpecialChars: TRUE to convert HTML characters.
closeGroup (line 99)

Close an open XML group.

  • access: public
void closeGroup ()
output (line 144)

Return XML data we have built so far.

  • access: public
string output ()
setXml (line 77)

Set XML settings.

  • access: public
void setXml (array $aParams)
  • array $aParams: ARRAY of XML settings.
_buildTag (line 174)

Build an XML tag.

  • return: XML tag code.
  • access: private
string _buildTag (string $sTag, array $aAttr, [bool $closing = false])
  • string $sTag: XML tag name.
  • array $aAttr: ARRAY of tag attributes.
  • bool $closing: TRUE to close the tag.
_escapeCdata (line 198)

Escapes CDATA.

  • return: Parsed and escaped CDATA.
  • access: private
string _escapeCdata (string $sXml)
  • string $sXml: XML data to parse.
_htmlSpecialcharsUni (line 212)

Convert HTML characters.

  • return: Return converted XML data.
  • access: private
string _htmlSpecialcharsUni (string $sText, [bool $bEntities = true])
  • string $sText: XML string to convert.
  • bool $bEntities: TRUE to convert entities.

Documentation generated on Tue, 28 Sep 2010 10:36:37 +0200 by phpDocumentor 1.4.0a2