Checks XML response does not equal to provided XML.
Comparison is done by canonicalizing both xml`s.

Parameter can be passed either as XmlBuilder, DOMDocument, DOMNode, XML string, or array (if no attributes).

@param $xml
@part xml
486966
public function dontSeeXmlResponseEquals($xml)
    {
        \PHPUnit\Framework\Assert::assertXmlStringNotEqualsXmlString(
            $this->connectionModule->_getResponseContent(),
            $xml
        );
    }
341862
protected function parseSOAP12Response($xml)
    {
        $doc = new \DOMDocument('1.0', 'UTF-8');

        if ($doc->loadXML($xml) === false) {
            throw new Exception('Failed load xml');
        }

        $response = new Response();

        // Get the standard CDATA elements
        foreach (array('uri', 'checkedby', 'doctype', 'charset') as $var) {
            $element = $doc->getElementsByTagName($var);
            if ($element->length) {
                $response->{'set' . ucfirst($var)}($element->item(0)->nodeValue);
            }
        }

        // Handle the bool element validity
        $element = $doc->getElementsByTagName('validity');
        if ($element->length && $element->item(0)->nodeValue === 'true') {
            $response->setValidity(true);
        } else {
            $response->setValidity(false);
        }

        if (!$response->isValidity()) {
            $errors = $doc->getElementsByTagName('error');
            foreach ($errors as $error) {
                $response->addError(new Error($error));
            }
        }
        $warnings = $doc->getElementsByTagName('warning');
        foreach ($warnings as $warning) {
            $response->addWarning(new Warning($warning));
        }

        return $response;
    }
310455
protected function sanitizeXml($xml)
    {
        // Sanitize the XML if requested:
        $newXML = trim(preg_replace($this->sanitizeRegex, ' ', $xml, -1, $count));

        if ($count > 0 && $this->badXmlLog) {
            $this->logBadXML($xml);
        }

        return $newXML;
    }
1108148
public function validateMetadata($xml)
    {
        assert('is_string($xml)');

        $errors = array();
        $res = OneLogin_Saml2_Utils::validateXML($xml, 'saml-schema-metadata-2.0.xsd', $this->_debug);
        if (!$res instanceof DOMDocument) {
            $errors[] = $res;
        } else {
            $dom = $res;
            $element = $dom->documentElement;
            if ($element->tagName !== 'md:EntityDescriptor') {
                $errors[] = 'noEntityDescriptor_xml';
            } else {
                $validUntil = $cacheDuration = $expireTime = null;

                if ($element->hasAttribute('validUntil')) {
                    $validUntil = OneLogin_Saml2_Utils::parseSAML2Time($element->getAttribute('validUntil'));
                }
                if ($element->hasAttribute('cacheDuration')) {
                    $cacheDuration = $element->getAttribute('cacheDuration');
                }

                $expireTime = OneLogin_Saml2_Utils::getExpireTime($cacheDuration, $validUntil);
                if (isset($expireTime) && time() > $expireTime) {
                    $errors[] = 'expired_xml';
                }
            }
        }

        // TODO: Support Metadata Sign Validation

        return $errors;
    }
534330
public function loadXml($xml)
    {
        if (is_string($xml)) {
            $this->xml = $xml = simplexml_load_string($xml);
        } elseif ($xml instanceof \SimpleXMLElement) {
            $this->xml = $xml;
        }

        $this->addFields($xml);

        return $this;
    }
17370
private function postXML($xml, $url)
    {
        if ($this->config['queue']) {
            Queue::push(function () use ($xml, $url) {
                $client = new Client();
                $request = new Request('POST', $url, ['Content-Type' => 'text/xml; charset=UTF8'], $xml);
                $response = $client->send($request);
                return $response->getBody()->getContents();
            });
        } else {
            $client = new Client();
            $request = new Request('POST', $url, ['Content-Type' => 'text/xml; charset=UTF8'], $xml);
            $response = $client->send($request);
            return $response->getBody()->getContents();
        }
    }
1344222
private function parseAttributes(DOMElement $xml) : void
    {
        $firstAttribute = true;
        /** @var \DOMElement[] $attributes */
        $attributes = Utils::xpQuery($xml, './saml_assertion:AttributeStatement/saml_assertion:Attribute');
        foreach ($attributes as $attribute) {
            if (!$attribute->hasAttribute('Name')) {
                throw new \Exception('Missing name on <saml:Attribute> element.');
            }
            $name = $attribute->getAttribute('Name');

            if ($attribute->hasAttribute('NameFormat')) {
                $nameFormat = $attribute->getAttribute('NameFormat');
            } else {
                $nameFormat = Constants::NAMEFORMAT_UNSPECIFIED;
            }

            if ($firstAttribute) {
                $this->nameFormat = $nameFormat;
                $firstAttribute = false;
            } else {
                if ($this->nameFormat !== $nameFormat) {
                    $this->nameFormat = Constants::NAMEFORMAT_UNSPECIFIED;
                }
            }

            if (!array_key_exists($name, $this->attributes)) {
                $this->attributes[$name] = [];
                $this->attributesValueTypes[$name] = [];
            }

            $this->parseAttributeValue($attribute, $name);
        }
    }
79728
protected function parseXML($xml){
        if (!$xml){
            return false;
        }
        foreach($xml->children() as $key=>$x){
            $i = $this->index;
            if ($key == 'Count'){
                $this->count = (string)$x;
                $this->log("Successfully cancelled $this->count report requests.");
            }
            if ($key != 'FeedSubmissionInfo'){
                continue;
            }
            
            $this->feedList[$i]['FeedSubmissionId'] = (string)$x->FeedSubmissionId;
            $this->feedList[$i]['FeedType'] = (string)$x->FeedType;
            $this->feedList[$i]['SubmittedDate'] = (string)$x->SubmittedDate;
            $this->feedList[$i]['FeedProcessingStatus'] = (string)$x->FeedProcessingStatus;
            //this fields are not always returned
            if (isset($x->StartedProcessingDate)) {
                $this->feedList[$i]['StartedProcessingDate'] = (string)$x->StartedProcessingDate;
            }
            if (isset($x->CompletedProcessingDate)) {
                $this->feedList[$i]['CompletedProcessingDate'] = (string)$x->CompletedProcessingDate;
            }
            
            $this->index++;
        }
    }
1094448
protected function parseXml($xml) {
        if (!$xml || !$xml->FinancialEventGroupList) {
            return false;
        }
        foreach($xml->FinancialEventGroupList->children() as $x) {
            $temp = array();
            $temp['FinancialEventGroupId'] = (string)$x->FinancialEventGroupId;
            $temp['ProcessingStatus'] = (string)$x->ProcessingStatus;
            if (isset($x->FundTransferStatus)) {
                $temp['FundTransferStatus'] = (string)$x->FundTransferStatus;
            }
            $temp['OriginalTotal']['Amount'] = (string)$x->OriginalTotal->CurrencyAmount;
            $temp['OriginalTotal']['CurrencyCode'] = (string)$x->OriginalTotal->CurrencyCode;
            if (isset($x->ConvertedTotal)) {
                $temp['ConvertedTotal']['Amount'] = (string)$x->ConvertedTotal->CurrencyAmount;
                $temp['ConvertedTotal']['CurrencyCode'] = (string)$x->ConvertedTotal->CurrencyCode;
            }
            if (isset($x->FundTransferDate)) {
                $temp['FundTransferDate'] = (string)$x->FundTransferDate;
            }
            if (isset($x->TraceId)) {
                $temp['TraceId'] = (string)$x->TraceId;
            }
            if (isset($x->AccountTail)) {
                $temp['AccountTail'] = (string)$x->AccountTail;
            }
            $temp['BeginningBalance']['Amount'] = (string)$x->BeginningBalance->CurrencyAmount;
            $temp['BeginningBalance']['CurrencyCode'] = (string)$x->BeginningBalance->CurrencyCode;
            $temp['FinancialEventGroupStart'] = (string)$x->FinancialEventGroupStart;
            if (isset($x->FinancialEventGroupEnd)) {
                $temp['FinancialEventGroupEnd'] = (string)$x->FinancialEventGroupEnd;
            }
            $this->list[$this->index] = $temp;
            $this->index++;
        }
    }
641206
protected function parseXML($xml){
        if (!$xml){
            return false;
        }
        foreach($xml->ItemData->children() as $x){
            $a = array();

            if (isset($x->ShipmentId)){
                $a['ShipmentId'] = (string)$x->ShipmentId;
            }
            $a['SellerSKU'] = (string)$x->SellerSKU;
            if (isset($x->FulfillmentNetworkSKU)){
                $a['FulfillmentNetworkSKU'] = (string)$x->FulfillmentNetworkSKU;
            }
            $a['QuantityShipped'] = (string)$x->QuantityShipped;
            if (isset($x->QuantityReceived)){
                $a['QuantityReceived'] = (string)$x->QuantityReceived;
            }
            if (isset($x->QuantityInCase)){
                $a['QuantityInCase'] = (string)$x->QuantityInCase;
            }
            if (isset($x->PrepDetailsList)) {
                foreach ($x->PrepDetailsList->children() as $z) {
                    $temp = array();
                    $temp['PrepInstruction'] = (string)$z->PrepInstruction;
                    $temp['PrepOwner'] = (string)$z->PrepOwner;
                    $a['PrepDetailsList'][] = $temp;
                }
            }
            if (isset($x->ReleaseDate)){
                $a['ReleaseDate'] = (string)$x->ReleaseDate;
            }
            
            $this->itemList[$this->index] = $a;
            $this->index++;
        }
    }
74028
public static function parseResponseIfXml(SimpleXMLElement $xml){
        $returnValue = self::parseElementXml($xml);
        $i = 0;
        $expression = null;
        $responseRules = array();
        foreach($xml->children() as $child){
            if($i){
                $name = $child->getName();
                $methodName = 'parse'.ucfirst($name).'Xml';
                if(method_exists(__CLASS__, $methodName)){
                    $responseRules[] = self::$methodName($child);
                } else{
                    $responseRules[] = self::parseResponseRuleXml($child);
                }
            }else{
                //the first child is the expression
                $expression = self::parseExpressionXml($child);
            }
            $i++;
        }
        $returnValue['expression'] = $expression;
        $returnValue['responseRules'] = $responseRules;
        return $returnValue;
    }
667287
protected function pbCheck( array $xml ) {

		$pt = 0;
		$ch = 0;
		$fm = 0;
		$bm = 0;
		$meta = 0;

		foreach ( $xml['posts'] as $p ) {

			if ( 'part' === $p['post_type'] ) {
				$pt = 1;
			} elseif ( 'chapter' === $p['post_type'] ) {
				$ch = 1;
			} elseif ( 'front-matter' === $p['post_type'] ) {
				$fm = 1;
			} elseif ( 'back-matter' === $p['post_type'] ) {
				$bm = 1;
			} elseif ( 'metadata' === $p['post_type'] ) {
				$meta = 1;
			}

			if ( $pt + $ch + $fm + $bm + $meta >= 2 ) {
				$this->isPbWxr = true;
				break;
			}
		}

	}
576690
public function validate( $xml )
	{
		$this->document	= new DOMDocument();
		ob_start();
		$this->document->validateOnParse	= TRUE;
		$this->document->loadXML( $xml );
		$this->errors	= ob_get_contents();
		ob_end_clean();
		if( !$this->errors )
			return TRUE;
		return FALSE;
	}
1213329
private function parseXML($xml) {
		$simpleXml = simplexml_load_string($xml, null, LIBXML_NOCDATA);
		$json = json_encode($simpleXml);

		return json_decode($json, true);
	}
1063885
public function identify( $xml )
	{
		$this->type		= "";
		$this->version	= "";
		$xsv	= new XML_DOM_SyntaxValidator;
		if( !$xsv->validate( $xml ) )
			throw new Exception( 'XML is not valid: '.$xsv->getErrors() );

		$doc	=& $xsv->getDocument();
		$xpath	= new DOMXPath( $doc );

		//  --  RSS  --  //
		$rss	= $xpath->query( "//rss/@version" );
		if( $rss->length )
		{
			$this->type		= "RSS";
			$this->version	= $rss->item( 0 )->value;
			return TRUE;
		}

		//  --  RSS 1.0 - RDF  --  //
		$namespace	= $xpath->evaluate( 'namespace-uri(//*)' );
		$xpath->registerNamespace( "rdf", $namespace );
		$rdf		= $xpath->evaluate( "//rdf:RDF" );
		if( $rdf->length )
		{
			$this->type		= "RSS";
			$this->version	= "1.0";
			return TRUE;
		}

		//  --  ATOM  --  //
		$atom	= $xpath->evaluate( "//feed/@version" );
		if( $atom->length )
		{
			$this->type		= "ATOM";
			$this->version	= $atom->item( 0 )->value;
			return TRUE;
		}

		$namespace = $xpath->evaluate( 'namespace-uri(//*)' );
		$xpath->registerNamespace( "pre", $namespace );
		$atom	= $xpath->evaluate( "//pre:feed/@version" );
		if( $atom->length )
		{
			$this->type		= "ATOM";
			$this->version	= $atom->item( 0 )->value;
			return TRUE;
		}

		$atom	= $xpath->evaluate( "//pre:feed/pre:title/text()" );
		if( $atom->length )
		{
			$this->type		= "ATOM";
			$this->version	= "1.0";
			return TRUE;
		}
		return FALSE;
	}
1315081
public function setXml($xml)
    {
        $class = $this->nodeClass;

        if (!$xml instanceof $class) {
            $xml = new $class((string)$xml);
        }

        $this->xml = $xml;
        return $this;
    }
1265325
public static function unparse($xml)
	{
		if (isset(static::$beforeUnparse))
		{
			$xml = call_user_func(static::$beforeUnparse, $xml);
		}

		$text = Unparser::unparse($xml);

		if (isset(static::$afterUnparse))
		{
			$text = call_user_func(static::$afterUnparse, $text);
		}

		return $text;
	}