fixed usage of LIBXML_COMPACT as it is not always available

This commit is contained in:
Fabien Potencier 2011-09-28 21:54:54 +02:00
parent 9e438128fa
commit 17af13813a
4 changed files with 4 additions and 4 deletions

View File

@ -209,7 +209,7 @@ class XmlFileLoader extends FileLoader
{
$dom = new \DOMDocument();
libxml_use_internal_errors(true);
if (!$dom->load($file, LIBXML_COMPACT)) {
if (!$dom->load($file, defined('LIBXML_COMPACT') ? LIBXML_COMPACT : 0)) {
throw new \InvalidArgumentException(implode("\n", $this->getXmlErrors()));
}
$dom->validateOnParse = true;

View File

@ -152,7 +152,7 @@ class XmlFileLoader extends FileLoader
{
$dom = new \DOMDocument();
libxml_use_internal_errors(true);
if (!$dom->load($file, LIBXML_COMPACT)) {
if (!$dom->load($file, defined('LIBXML_COMPACT') ? LIBXML_COMPACT : 0)) {
throw new \InvalidArgumentException(implode("\n", $this->getXmlErrors()));
}
$dom->validateOnParse = true;

View File

@ -52,7 +52,7 @@ class XliffFileLoader implements LoaderInterface
{
$dom = new \DOMDocument();
$current = libxml_use_internal_errors(true);
if (!@$dom->load($file, LIBXML_COMPACT)) {
if (!@$dom->load($file, defined('LIBXML_COMPACT') ? LIBXML_COMPACT : 0)) {
throw new \RuntimeException(implode("\n", $this->getXmlErrors()));
}

View File

@ -176,7 +176,7 @@ class XmlFileLoader extends FileLoader
{
$dom = new \DOMDocument();
libxml_use_internal_errors(true);
if (!$dom->load($file, LIBXML_COMPACT)) {
if (!$dom->load($file, defined('LIBXML_COMPACT') ? LIBXML_COMPACT : 0)) {
throw new MappingException(implode("\n", $this->getXmlErrors()));
}
if (!$dom->schemaValidate(__DIR__.'/schema/dic/constraint-mapping/constraint-mapping-1.0.xsd')) {