[Phpxd-commits] CVS: phpXD/include/dtd DTDAttList.php,NONE,1.1 DTDAttribute.php,NONE,1.1 DTDElement.
Status: Beta
Brought to you by:
growbal
From: Thomas D. <th...@us...> - 2002-02-06 23:08:03
|
Update of /cvsroot/phpxd/phpXD/include/dtd In directory usw-pr-cvs1:/tmp/cvs-serv30624/include/dtd Added Files: DTDAttList.php DTDAttribute.php DTDElement.php DTDElementChild.php DTDElementChoice.php DTDElementSequence.php Log Message: Interface for DTD support, which is not included in W3C DOM. This is EXPERIMENTAL! --- NEW FILE: DTDAttList.php --- <?php // phpXD - a XML DOM Implementation // // This Software and all associated files are released unter the // GNU Public License (GPL), see LICENSE for details. // // $Id: DTDAttList.php,v 1.1 2002/02/06 23:00:41 thomi Exp $ // EXPERIMENTAL. Interface could change later. /** * Interface to represent <!ATTLIST ..> definitions. * * @package phpXD * @author Thomas Dohmke <th...@do...> * @version $Revision: 1.1 $ */ class DTDAttList { /** * A NamedNodeMap with all defined attributes. * * @private * @type NamedNodeMap */ var $attributes; /** * The element this attribute list belongs to. * * @private * @type string */ var $element; /** * Constructor of the class. * * @private */ function DTDAttList($element) { $this->element = $element; } } ?> --- NEW FILE: DTDAttribute.php --- <?php // phpXD - a XML DOM Implementation // // This Software and all associated files are released unter the // GNU Public License (GPL), see LICENSE for details. // // $Id: DTDAttribute.php,v 1.1 2002/02/06 23:00:42 thomi Exp $ // EXPERIMENTAL. Interface could change later. /** * Interface to represent attribute definitions in the DTD. * * @package phpXD * @author Thomas Dohmke <th...@do...> * @version $Revision: 1.1 $ */ class DTDAttribute { /** * The name of the attribute. * * @private * @type string */ var $nodeName; /** * The type of the attribute, could be: "CDATA", "NMTOKEN", "NMTOKENS", * "ID", "IDREF", "IDREFS", "ENTITY", "ENTITIES", "NOTATION" and * "ENUMERATION". * * @private * @type string */ var $type; /** * If type == "ENUMBERATION" $value is an array with all possible values. * * @private * @type string */ var $value; /** * "#IMPLIED", "#REQUIRED" or "#FIXED". * * @private * @type string */ var $default; /** * A default value if defined. * * @private * @type string */ var $defaultValue; /** * Constructor of the class. * * @private */ function DTDAttribute($nodeName, $type) { $this->nodeName = $nodeName; $this->type = $type; } } ?> --- NEW FILE: DTDElement.php --- <?php // phpXD - a XML DOM Implementation // // This Software and all associated files are released unter the // GNU Public License (GPL), see LICENSE for details. // // $Id: DTDElement.php,v 1.1 2002/02/06 23:00:42 thomi Exp $ // EXPERIMENTAL. Interface could change later. /** * Interface to represent <!ELEMENT ..> definitions. * * @package phpXD * @author Thomas Dohmke <th...@do...> * @version $Revision: 1.1 $ */ class DTDElement { /** * The element name. * * @private * @type string */ var $nodeName; /** * The child nodes of this element, null for empty elements, a * DTDElementChild for ANY oder #PCDATA or if only one child is * defined, else a NodeList. * * @private * @type NodeList | DTDElementChild */ var $childNodes; /** * A NamedNodeMap with all defined attributes. * * @private * @type NamedNodeMap */ var $attributes; /** * Constructor of the class. * * @private */ function DTDElement($nodeName) { $this->nodeName = $nodeName; $this->childNodes = null; } } ?> --- NEW FILE: DTDElementChild.php --- <?php // phpXD - a XML DOM Implementation // // This Software and all associated files are released unter the // GNU Public License (GPL), see LICENSE for details. // // $Id: DTDElementChild.php,v 1.1 2002/02/06 23:00:42 thomi Exp $ // EXPERIMENTAL. Interface could change later. /** * Interface to represent the definitions of element childs. * * @package phpXD * @author Thomas Dohmke <th...@do...> * @version $Revision: 1.1 $ */ class DTDElementChild { /** * Child is ANY. * * @private * @type boolean */ var $any = false; /** * The number of this child, "*", "+" or "?". * * @private * @type string */ var $number = ""; /** * Child is #PCDATA. * * @private * @type boolean */ var $pcdata = false; /** * The name of the child. * * @private * @type string */ var $nodeName = ""; /** * Constructor of the class. * * @param $nodeName The name of this child element. * @param $number The number of this childen - "?", "*" or "+" * @param $any Element is ANY * @param $pcdata Element is #PCDATA * @private */ function DTDElementChild($nodeName, $number, $any = false, $pcdata = false) { if ($any) { $this->any = true; return; } if ($pcdata) { $this->pcdata = true; return; } $this->nodeName = $nodeName; $this->setNumber($number); } /** * Sets the number of this child. * * @param $number "*" or "+" or "?" * @private */ function setNumber($number) { $this->number = $number; } /** * String representation for this object. For debugging only. * * @private * @returns string */ function toString() { if ($this->any) { return "ANY"; } if ($this->pcdata) { return "#PCDATA"; } return $this->nodeName.$this->number; } } ?> --- NEW FILE: DTDElementChoice.php --- <?php // phpXD - a XML DOM Implementation // // This Software and all associated files are released unter the // GNU Public License (GPL), see LICENSE for details. // // $Id: DTDElementChoice.php,v 1.1 2002/02/06 23:00:42 thomi Exp $ // EXPERIMENTAL. Interface could change later. /** * Interface to represent a choice of element childs, i.e. (a | b | c), etc. * * @package phpXD * @author Thomas Dohmke <th...@do...> * @version $Revision: 1.1 $ */ class DTDElementChoice extends NodeList { /** * The parent of this sequence or null. * * @private * @type DTDElementChoice | DTDElementSequence */ var $parent = null; /** * The number of this child, "*", "+" or "?". * * @private * @type string */ var $number = ""; /** * Constructor of the class. * * @private */ function DTDElementChoice() { } /** * Sets the number of this child. * * @param $number "*" or "+" or "?" * @private */ function setNumber($number) { $this->number = $number; } /** * String representation for this object. For debugging only. * * @private * @returns string */ function toString() { $str = "("; $count = 0; for ($count = 0; $count < $this->length; ++$count) { $child =& $this->nodes[$count]; if ($count != 0) { $str .= " | "; } $str .= $child->toString(); } $str .= ")".$this->number; return $str; } } ?> --- NEW FILE: DTDElementSequence.php --- <?php // phpXD - a XML DOM Implementation // // This Software and all associated files are released unter the // GNU Public License (GPL), see LICENSE for details. // // $Id: DTDElementSequence.php,v 1.1 2002/02/06 23:00:42 thomi Exp $ // EXPERIMENTAL. Interface could change later. /** * Interface to represent a sequence of element childs, i.e. (a , b , c), etc. * * @package phpXD * @author Thomas Dohmke <th...@do...> * @version $Revision: 1.1 $ */ class DTDElementSequence extends NodeList { /** * The parent of this sequence or null. * * @private * @type DTDElementChoice | DTDElementSequence */ var $parent = null; /** * The number of this child, "*", "+" or "?". * * @private * @type string */ var $number = ""; /** * Constructor of the class. * * @private */ function DTDElementSequence() { } /** * Sets the number of this child. * * @param $number "*" or "+" or "?" * @private */ function setNumber($number) { $this->number = $number; } /** * String representation for this object. For debugging only. * * @private * @returns string */ function toString() { $str = "("; $count = 0; for ($count = 0; $count < $this->length; ++$count) { $child =& $this->nodes[$count]; if ($count != 0) { $str .= " , "; } $str .= $child->toString(); } $str .= ")".$this->number; return $str; } } ?> |