You are here

protected static function XmlParserTrait::removeDefaultNamespaces in Feeds 8.3

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.

File

src/Component/XmlParserTrait.php, line 119

Class

XmlParserTrait
Helper methods for dealing with XML documents.

Namespace

Drupal\feeds\Component

Code

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