Sorry, I copied the wrong the DTD in the code:

From: Date: Sat, 19 Nov 2005 06:17:10 +0000
Subject: Sorry, I copied the wrong the DTD in the code:
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-226116@lists.php.net to get a copy of this message
Sorry, I copied the wrong DTD into the post. The DTD is the following: <!ELEMENT Document ANY> <!ELEMENT CMAES_Model_DbSection ANY> <!ATTLIST CMAES_Model_DbSection S_iSectionId ID #IMPLIED> Here is the code example and result again: <?php // Creates an instance of the DOMImplementation class $oDomImp = new DOMImplementation; // Creates a DOMDocumentType instance $oDomDtd = $oDomImp->createDocumentType('Document', '', 'D:/CMAES/Src/dbtree.dtd'); // Creates a DOMDocument instance $oDom = $oDomImp->createDocument("", "Document", $oDomDtd); // Set other properties $oDom->encoding = 'iso-8859-1'; $oElement = $oDom->createElement('CMAES_Model_DbSection', 'test'); $oElement->setAttribute('S_iSectionId', '123'); // Append the element $oDom->documentElement->appendChild($oElement); // Retrieve and print the document echo $oDom->saveXML() . "\n\n"; // Do validation var_dump($oDom->validate()); // Type node name echo "TagName: " . $oDom->getElementById('123')->tagName; ?> Using the following DTD as an external file: <!ELEMENT Document ANY> <!ELEMENT CMAES_Model_DbSection ANY> <!ATTLIST CMAES_Model_DbSection S_iSectionId ID #IMPLIED> The result is the following: <?xml version="1.0" encoding="iso-8859-1"?> <!DOCTYPE Document SYSTEM "D:/CMAES/Src/dbtree.dtd"> <Document><CMAES_Model_DbSection S_iSectionId="123">test</CMAES_Model_DbSection></Document> Warning: Syntax of value for attribute S_iSectionId of CMAES_Model_DbSection is not valid in <script on line 23 bool(false) TagName: CMAES_Model_DbSection /Erik

« previous php.general (#226116) next »