XML file: simpledocumentroot.php
<?php/** *========================================================= * * @author Hahawen (older Youth) * @since 2004-12- @copyright Copyright (c), Nxcoder Group * *========================================================= *//** * CL Ass Simpledocumentroot * XML root class, include Values/attributes/subnodes. * All this pachage's is work to XML file, and method is action as DOM. * * @package SmartWeb.common.xml * @version 1.0 * * Class Simpledocumentroot extends simpledocumentbase{private $prefixStr = ' <?xml version= ' 1.0 ' encoding= ' utf-8 '? > Priv Ate $nodeLists = Array (); function __construct ($nodeTag) {parent::__construct ($NODETAG);} Public Function Createnodeobject ($pNodeId, $name, $attributes) {$seq = sizeof ($this->nodelists); $tmpObject = new Simpledocumentnode ($this, $pNodeId, $name, $SEQ); $tmpObject->setattributes ($attributes); $this->nodelists[$seq] = $tmpObject; return $tmpObject; Public Function Removenodebyid ($id) { if (sizeof ($this->nodelists) ==1) $this->nodelists = Array (); else unset ($this->nodelists[$id]); The Public Function Getnodebyid ($id) {return $this->nodelists[$id]; The Public Function CreateNode ($name, $attributes) {return $this->createnodebyname ($this, $name, $attributes, -1); The Public Function Removenode ($name) {return $this->removenodebyname ($this, $name); The Public Function getnode ($name =null) {return $this->getnodebyname ($this, $name); The Public Function Getsavexml () {$prefixSpace = ""; $str = $this->prefixstr. " \ r \ n "; Return $STR. Parent::getsavexml (0); }}?>
File: simpledocumentnode.php
<?php/** *========================================================= * * @author Hahawen (older Youth) * @since 2004-12- @copyright Copyright (c), Nxcoder Group * *========================================================= *//** * CL Ass Simpledocumentnode * XML Node class, include Values/attributes/subnodes. * All this pachage's is work to XML file, and method is action as DOM. * * @package SmartWeb.common.xml * @version 1.0 * * Class Simpledocumentnode extends simpledocumentbase{private $seq = null; private $rootObject = null; Private $pNodeId = null; function __construct ($rootObject, $pNodeId, $nodeTag, $seq) {parent::__construct ($NODETAG); $this->rootobject = $rootObject; $this->pnodeid = $pNodeId; $this->seq = $seq; Public Function Getpnodeobject () {return ($this->pnodeid==-1)? $this->rootobject: $this->rootobject->getnodeb Yid ($this->pnodeid); The Public Function Getseq () {return $this->seq; } public FunctiOn CreateNode ($name, $attributes) {return $this->createnodebyname ($this->rootobject, $name, $attributes, $this- >getseq ()); The Public Function Removenode ($name) {return $this->removenodebyname ($this->rootobject, $name); The Public Function getnode ($name =null) {return $this->getnodebyname ($this->rootobject, $name); }}?>