public static function fromXML(\DOMElement $xml) : Message
    {
        if ($xml->namespaceURI !== Constants::NS_SAMLP) {
            throw new \Exception('Unknown namespace of SAML message: '.var_export($xml->namespaceURI, true));
        }

        switch ($xml->localName) {
            case 'AttributeQuery':
                return new AttributeQuery($xml);
            case 'AuthnRequest':
                return new AuthnRequest($xml);
            case 'LogoutResponse':
                return new LogoutResponse($xml);
            case 'LogoutRequest':
                return new LogoutRequest($xml);
            case 'Response':
                return new Response($xml);
            case 'ArtifactResponse':
                return new ArtifactResponse($xml);
            case 'ArtifactResolve':
                return new ArtifactResolve($xml);
            default:
                throw new \Exception('Unknown SAML message: '.var_export($xml->localName, true));
        }
    }
public static function fromXML(\DOMElement $xml) : Message
    {
        if ($xml->namespaceURI !== Constants::NS_SAMLP) {
            throw new \Exception('Unknown namespace of SAML message: '.var_export($xml->namespaceURI, true));
        }

        switch ($xml->localName) {
            case 'AttributeQuery':
                return new AttributeQuery($xml);
            case 'AuthnRequest':
                return new AuthnRequest($xml);
            case 'LogoutResponse':
                return new LogoutResponse($xml);
            case 'LogoutRequest':
                return new LogoutRequest($xml);
            case 'Response':
                return new Response($xml);
            case 'ArtifactResponse':
                return new ArtifactResponse($xml);
            case 'ArtifactResolve':
                return new ArtifactResolve($xml);
            default:
                throw new \Exception('Unknown SAML message: '.var_export($xml->localName, true));
        }
    }
public static function fromXML ( \ DOMElement $ xml ) : Message { if ( $ xml -> namespaceURI !== Constants :: NS_SAMLP ) { throw new \ Exception ( 'Unknown namespace of SAML message: ' . var_export ( $ xml -> namespaceURI , true ) ) ; } switch ( $ xml -> localName ) { case 'AttributeQuery' : return new AttributeQuery ( $ xml ) ; case 'AuthnRequest' : return new AuthnRequest ( $ xml ) ; case 'LogoutResponse' : return new LogoutResponse ( $ xml ) ; case 'LogoutRequest' : return new LogoutRequest ( $ xml ) ; case 'Response' : return new Response ( $ xml ) ; case 'ArtifactResponse' : return new ArtifactResponse ( $ xml ) ; case 'ArtifactResolve' : return new ArtifactResolve ( $ xml ) ; default : throw new \ Exception ( 'Unknown SAML message: ' . var_export ( $ xml -> localName , true ) ) ; } }
Convert an XML element into a message.

@param \DOMElement $xml The root XML element
@throws \Exception
@return \SAML2\Message The message
Convert an XML element into a message .