Actions

API16

JSimpleXML/ construct

From Joomla! Documentation

< API16:JSimpleXML
Revision as of 17:55, 22 March 2010 by Doxiki (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Replacement filing cabinet.png
This Namespace has been archived - Please Do Not Edit or Create Pages in this namespace. Pages contain information for a Joomla! version which is no longer supported. It exists only as a historical reference, will not be improved and its content may be incomplete.

Contents

Description

Constructor.

[Edit Descripton]

Description:JSimpleXML/ construct

Syntax

__construct($options=null)
Parameter Name Default Value Description
$options null

Defined in

libraries/joomla/utilities/simplexml.php

Importing

jimport( 'joomla.utilities.simplexml' );

Source Body

function __construct($options = null)
{
        if (! function_exists('xml_parser_create')) {
                return false; //TODO throw warning
        }
 
        //Create the parser resource and make sure both versions of PHP autodetect the format.
        $this->_parser = xml_parser_create('');
 
        // check parser resource
        xml_set_object($this->_parser, $this);
        xml_parser_set_option($this->_parser, XML_OPTION_CASE_FOLDING, 0);
        if (is_array($options))
        {
                foreach($options as $option => $value) {
                        xml_parser_set_option($this->_parser, $option, $value);
                }
        }
 
        //Set the handlers
        xml_set_element_handler($this->_parser, '_startElement', '_endElement');
        xml_set_character_data_handler($this->_parser, '_characterData');
}

[Edit See Also] SeeAlso:JSimpleXML/ construct

Examples

<CodeExamplesForm />