note 39584 deleted from ref.xml by danbrown

From: Date: Wed, 03 Mar 2010 18:52:21 +0000
Subject: note 39584 deleted from ref.xml by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-166610@lists.php.net to get a copy of this message
Note Submitter: talraith at withouthonor dot com ---- I have created a class set that both parses XML into an object structure and from that structure creates XML code. It is mostly finished but I thought I would post here as it may help someone out or if someone wants to use it as a base for their own parser. The method for creating the object is original compared to the posts before this one. The object tree is created by created seperate tag objects for each tag inside the main document object and associating them together by way of object references. An index table is created so that each tag is assigned an ID number (in numerical order from 0) and can be accessed directly using that ID number. Each tag has object references to its children. There are no uses of eval() in this code. The code is too long to post here, so I have made a HTML page that has it: http://www.withouthonor.com/obj_xml.html Sample code would look something like this: <? $xml = new xml_doc($my_xml_code); $xml->parse(); $root_tag =& $xml->xml_index[0]; $children =& $root_tag->children; // and so forth // To create XML code using the object, would be similar to this: $my_xml = new xml_doc(); $root_tag = $my_xml->CreateTag('ROOTTAG'); $my_xml->CreateTag('CHILDTAG',array(),'',$root_tag); // The following is used for the CreateTag() method // string Name (The name of the child tag) // array Attributes (associative array of attributes for tag) // string Content (textual data for the child tag) // int ParentID (Index number for parent tag) // To generate the XML, use the following method $out_xml = $my_xml->generate(); ?>

« previous php.notes (#166610) next »