SEPASDD::prepareDocument PHP Method

prepareDocument() private method

Build the main document node and set xml namespaces.
private prepareDocument ( )
    private function prepareDocument()
    {
        //Create the XML Instance
        $this->xml = new DOMDocument("1.0", "UTF-8");
        //Set formatting options
        $this->xml->preserveWhiteSpace = false;
        $this->xml->formatOutput = true;
        //Create the document node
        $documentNode = $this->xml->createElement("Document");
        //set the namespace
        $documentAttributeXMLNS = $this->xml->createAttribute("xmlns");
        if (isset($this->config['version']) && $this->config['version'] == "3") {
            $documentAttributeXMLNS->value = "urn:iso:std:iso:20022:tech:xsd:pain.008.001.03";
        } else {
            $documentAttributeXMLNS->value = "urn:iso:std:iso:20022:tech:xsd:pain.008.001.02";
        }
        $documentNode->appendChild($documentAttributeXMLNS);
        //set the namespace url
        $documentAttributeXMLNSXSI = $this->xml->createAttribute("xmlns:xsi");
        $documentAttributeXMLNSXSI->value = "http://www.w3.org/2001/XMLSchema-instance";
        $documentNode->appendChild($documentAttributeXMLNSXSI);
        //create the Direct Debit node
        $CstmrDrctDbtInitnNode = $this->xml->createElement("CstmrDrctDbtInitn");
        $documentNode->appendChild($CstmrDrctDbtInitnNode);
        //append the document node to the XML Instance
        $this->xml->appendChild($documentNode);
    }