| API | Package | Class | phpDocumentor | Last reviewed | Doc status |
|---|---|---|---|---|---|
Joomla.Framework | JFactory | JFactory->getXMLParser |
This method creates an XML document. It will instantiate an object depending on the specified type.
object &getXMLParser ( $type, $options )
| $type | string | is a string containing the type of XML object to return. This parameter can be ‘DOM‘, ‘RSS’ or ‘Simple’, which will create a DOMIT object, a DOMIT RSS object or a JSimpleXML object respectively. This parameter is optional and if omitted defaults to ‘DOM‘. |
| $options | array | is an array containing options for the XML object. |
Recognized array elements:
Example
$xmldoc =& JFactory::getXMLParser( 'Simple' ); $xmlstring = "<product> <name>Telephone</name> <price>$29.95</price> <manufacturer>CAMNAI Manufacturing Company</manufacturer> </product> "; if ( $xmldoc->loadString( $xmlstring ) ) { echo "String successfully loaded!"; } else { echo "Something didn't work!"; }
might produce:
Result
String successfully loaded!