public static function FeedsExXmlUtility::createXmlDocument in Feeds extensible parsers 7
Same name and namespace in other branches
- 7.2 src/Xml/Utility.php \FeedsExXmlUtility::createXmlDocument()
Creates an XML document.
Parameters
string $source: The string containing the XML.
int $options: (optional) Bitwise OR of the libxml option constants. Defaults to 0.
Return value
DOMDocument The newly created DOMDocument.
Throws
RuntimeException Thrown if there is a fatal error parsing the XML.
1 call to FeedsExXmlUtility::createXmlDocument()
- FeedsExXml::prepareDocument in src/
FeedsExXml.inc - Prepares the DOM document.
File
- src/
Xml/ Utility.php, line 68 - Contains FeedsExXmlUtility.
Class
- FeedsExXmlUtility
- Simple XML helpers.
Code
public static function createXmlDocument($source, $options = 0) {
$document = self::buildDomDocument();
$options |= LIBXML_NONET;
$options |= defined('LIBXML_COMPACT') ? LIBXML_COMPACT : 0;
$options |= defined('LIBXML_PARSEHUGE') ? LIBXML_PARSEHUGE : 0;
if (!$document
->loadXML($source, $options)) {
throw new RuntimeException(t('There was an error parsing the XML document.'));
}
return $document;
}