public function getXml()
    {
        // Build the DOMDocument object only on demand.
        if ($this->xml === null) {

            $xml = new SerializableDomDocument('1.0', 'UTF-8');
            if (@$xml->loadXML($this->getXmlString()) === false) {
                $msg = "The XML content '" . $this->getXmlString() . "' of the '" . $this->getQtiClassName() . "' external component could not be parsed correctly.";
                throw new RuntimeException($msg);
            }

            if (($targetNamespace = $this->getTargetNamespace()) !== '' && $xml->documentElement->namespaceURI !== $this->getTargetNamespace()) {
                $msg = "The XML content' " . $this->getXmlString() . "' of the '" . $this->getQtiClassName() . "' external component is not referenced into target namespace '" . $this->getTargetNamespace() . "'.";
                throw new RuntimeException($msg);
            }

            $this->setXml($xml);
        }

        return $this->xml;
    }
public function getXml()
    {
        // Build the DOMDocument object only on demand.
        if ($this->xml === null) {

            $xml = new SerializableDomDocument('1.0', 'UTF-8');
            if (@$xml->loadXML($this->getXmlString()) === false) {
                $msg = "The XML content '" . $this->getXmlString() . "' of the '" . $this->getQtiClassName() . "' external component could not be parsed correctly.";
                throw new RuntimeException($msg);
            }

            if (($targetNamespace = $this->getTargetNamespace()) !== '' && $xml->documentElement->namespaceURI !== $this->getTargetNamespace()) {
                $msg = "The XML content' " . $this->getXmlString() . "' of the '" . $this->getQtiClassName() . "' external component is not referenced into target namespace '" . $this->getTargetNamespace() . "'.";
                throw new RuntimeException($msg);
            }

            $this->setXml($xml);
        }

        return $this->xml;
    }
public function getXml ( ) { // Build the DOMDocument object only on demand. if ( $ this -> xml === null ) { $ xml = new SerializableDomDocument ( '1.0' , 'UTF-8' ) ; if ( @ $ xml -> loadXML ( $ this -> getXmlString ( ) ) === false ) { $ msg = "The XML content '" . $ this -> getXmlString ( ) . "' of the '" . $ this -> getQtiClassName ( ) . "' external component could not be parsed correctly." ; throw new RuntimeException ( $ msg ) ; } if ( ( $ targetNamespace = $ this -> getTargetNamespace ( ) ) !== '' && $ xml -> documentElement -> namespaceURI !== $ this -> getTargetNamespace ( ) ) { $ msg = "The XML content' " . $ this -> getXmlString ( ) . "' of the '" . $ this -> getQtiClassName ( ) . "' external component is not referenced into target namespace '" . $ this -> getTargetNamespace ( ) . "'." ; throw new RuntimeException ( $ msg ) ; } $ this -> setXml ( $ xml ) ; } return $ this -> xml ; }
Returns the XML representation of the external component as
a DOMDocument object.

@return \qtism\common\dom\SerializableDomDocument A DOMDocument (serializable) object representing the content of the external component.
@throws \RuntimeException If the root element of the XML representation is not from the target namespace or the XML could not be parsed.
Returns the XML representation of the external component as a DOMDocument object .