SitePoint Sponsor |
|
User Tag List
Results 1 to 1 of 1
Thread: XML and DTD's
-
Nov 22, 2004, 01:22 #1
XML and DTD's
I understand how to create a new xml document but I've not seen any documentation on how to assign it a DTD before saving to file. Can anybody give me a SHORT php example of this? Assume the following and fill in the code needed where the comment is:
Code:$doc = domxml_new_doc("1.0"); // need to set <!DOCTYPE codes SYSTEM "codes.dtd"> here $codes = $doc->create_element("codes"); $codes = $doc->append_child($codes); $code1 = $doc->create_element("code"); $code1->setAttribute("value", "one"); $code1 = $codes->append_child($code1); $code2 = $doc->create_element("code"); $code2->setAttribute("value", "two"); $code2 = $codes->append_child($code2); $doc->save($filename);
Thanks in advance for your assistance.
Bookmarks