You are here

public static function FeedsExXmlUtility::removeDefaultNamespaces in Feeds extensible parsers 7

Same name and namespace in other branches
  1. 7.2 src/Xml/Utility.php \FeedsExXmlUtility::removeDefaultNamespaces()

Strips the default namespaces from an XML string.

Parameters

string $xml: The XML string.

Return value

string The XML string with the default namespaces removed.

2 calls to FeedsExXmlUtility::removeDefaultNamespaces()
FeedsExUnitTests.test in src/Tests/FeedsExUnitTests.test
FeedsExXml::prepareDocument in src/FeedsExXml.inc
Prepares the DOM document.

File

src/Xml/Utility.php, line 29
Contains FeedsExXmlUtility.

Class

FeedsExXmlUtility
Simple XML helpers.

Code

public static function removeDefaultNamespaces($xml) {
  return preg_replace('/(<' . self::$elementRegex . '[^>]*)\\s+xmlns\\s*=\\s*("|\').*?(\\2)([^>]*>)/u', '$1$4', $xml);
}