phpxd-commits Mailing List for phpXD (Page 4)
Status: Beta
Brought to you by:
growbal
You can subscribe to this list here.
2001 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
(6) |
Jul
(4) |
Aug
|
Sep
(1) |
Oct
|
Nov
(14) |
Dec
(2) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2002 |
Jan
(49) |
Feb
(43) |
Mar
(15) |
Apr
|
May
|
Jun
(10) |
Jul
|
Aug
|
Sep
|
Oct
(1) |
Nov
(1) |
Dec
|
From: Thomas D. <th...@us...> - 2002-01-29 17:47:34
|
Update of /cvsroot/phpxd/phpXD/include/dom In directory usw-pr-cvs1:/tmp/cvs-serv11973/include/dom Modified Files: DOMImplementation.php Log Message: Index: DOMImplementation.php =================================================================== RCS file: /cvsroot/phpxd/phpXD/include/dom/DOMImplementation.php,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -r1.2 -r1.3 *** DOMImplementation.php 2002/01/29 14:09:58 1.2 --- DOMImplementation.php 2002/01/29 17:47:31 1.3 *************** *** 25,31 **** * @returns boolean */ ! function hasFeature($feature, $version) { if (($feature == "XML") || ($feature == "Core")) { ! if ($version == "1.0") { return true; } --- 25,32 ---- * @returns boolean */ ! function hasFeature($feature, $version = "1.0") { if (($feature == "XML") || ($feature == "Core")) { ! if (($version == "1.0") || ! ($version = "2.0")) { return true; } |
From: Thomas D. <th...@us...> - 2002-01-29 17:47:15
|
Update of /cvsroot/phpxd/phpXD/include/parser In directory usw-pr-cvs1:/tmp/cvs-serv11842/include/parser Modified Files: DTDParser.php Log Message: Index: DTDParser.php =================================================================== RCS file: /cvsroot/phpxd/phpXD/include/parser/DTDParser.php,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -r1.2 -r1.3 *** DTDParser.php 2002/01/27 01:23:10 1.2 --- DTDParser.php 2002/01/29 17:47:12 1.3 *************** *** 19,55 **** var $DTDTokens; var $parameterEntities; var $elements; var $currentElement; ! function parse($str) { if (!empty($str)) { while (preg_match('=(.*)\%([a-z,A-Z,0-9,\.]*);(.*)$=sU', $str, $ent)) { $str = preg_replace('=<!--.*-->=sU', '', $str); ! while (preg_match('=(.*)<!ENTITY[ ,\n,\r,\t]*\%[ ,\n,\r,\t]*([a-z,A-Z,0-9,\.]*)[ ,\n,\r,\t]*PUBLIC[ ,\n,\r,\t]*"([a-z,A-Z,0-9,\-,/, ]*)"[ ,\n,\r,\t]*"([a-z,A-Z,0-9,\.,\-,_,/]*)"[ ,\n,\r,\t]*>(.*)$=sU', $str, $ent)) { if ($this->file_exists($this->currentDir."/".$ent[4])) { $this->parameterEntities[$ent[2]] = preg_replace('=<!--.*-->=sU', '', implode("", file($this->currentDir."/".$ent[4]))); } $str = $ent[1].$ent[5]; } ! while (preg_match('=(.*)<!ENTITY[ ,\n,\r,\t]*\%[ ,\n,\r,\t]*([a-z,A-Z,0-9,\.]*)[ ,\n,\r,\t]*"(.*)"[ ,\n,\r,\t]*>(.*)$=sU', $str, $ent)) { $this->parameterEntities[$ent[2]] = $ent[3]; $str = $ent[1].$ent[4]; } ! foreach ($this->parameterEntities as $ent => $body) { ! $str = str_replace("%".$ent.";", $body, $str); } } $parser = xml_parser_create(); xml_parser_set_option($parser, XML_OPTION_CASE_FOLDING, 0); xml_set_object($parser, $this); ! // parse only the dtd xml_set_default_handler($parser, "handleDefault"); - // xml_set_unparsed_entity_decl_handler($parser, - // "handleUnparsedEntityDecl"); - - // xml_set_external_entity_ref_handler($parser, "handleExternalEntityRef"); if (!xml_parse($parser, $str, true)) { --- 19,85 ---- var $DTDTokens; var $parameterEntities; + var $parameterEntitiesDefined; var $elements; var $currentElement; + var $currentAttlist; ! function parse($str, $dtdonly = true) { if (!empty($str)) { + // Make dummy xml string to use expat as parser/scanner. + if ($dtdonly) { + $str = "<!DOCTYPE null [".$str."]><null />"; + } + + // search and replace parameter entities while (preg_match('=(.*)\%([a-z,A-Z,0-9,\.]*);(.*)$=sU', $str, $ent)) { $str = preg_replace('=<!--.*-->=sU', '', $str); ! while (preg_match('=(.*)<!ENTITY[ ,\n,\r,\t]*\%[ ,\n,\r,\t]*'. ! '([a-z,A-Z,0-9,\.]*)[ ,\n,\r,\t]*PUBLIC'. ! '[ ,\n,\r,\t]*"([a-z,A-Z,0-9,\-,/, ]*)"'. ! '[ ,\n,\r,\t]*"([a-z,A-Z,0-9,\.,\-,_,/]*)"'. ! '[ ,\n,\r,\t]*>(.*)$=sU', $str, $ent)) { if ($this->file_exists($this->currentDir."/".$ent[4])) { + if (isset($this->parameterEntitiesDefined[$ent[2]]) && + ($this->parameterEntitiesDefined[$ent[2]] == true)) { + // redefined parameter entity => replace current string + foreach ($this->parameterEntities as $entref => $body) { + $ent[1] = str_replace("%".$entref.";", $body, $ent[1]); + } + } $this->parameterEntities[$ent[2]] = preg_replace('=<!--.*-->=sU', '', implode("", file($this->currentDir."/".$ent[4]))); + $this->parameterEntitiesDefined[$ent[2]] = true; } $str = $ent[1].$ent[5]; } ! while (preg_match('=(.*)<!ENTITY[ ,\n,\r,\t]*\%[ ,\n,\r,\t]*'. ! '([a-z,A-Z,0-9,\.]*)[ ,\n,\r,\t]*"(.*)"'. ! '[ ,\n,\r,\t]*>(.*)$=sU', $str, $ent)) { ! if (isset($this->parameterEntitiesDefined[$ent[2]]) && ! ($this->parameterEntitiesDefined[$ent[2]] == true)) { ! // redefined parameter entity => replace current string ! foreach ($this->parameterEntities as $entref => $body) { ! $ent[1] = str_replace("%".$entref.";", $body, $ent[1]); ! } ! } $this->parameterEntities[$ent[2]] = $ent[3]; + $this->parameterEntitiesDefined[$ent[2]] = true; $str = $ent[1].$ent[4]; } ! foreach ($this->parameterEntities as $entref => $body) { ! $str = str_replace("%".$entref.";", $body, $str); } } + + // Use expat as parser/scanner for finding syntax errors in the dtd. + // So an array of tokens is provided, which is used as input for + // the parseToken method. $parser = xml_parser_create(); xml_parser_set_option($parser, XML_OPTION_CASE_FOLDING, 0); xml_set_object($parser, $this); ! // Only interested in the dtd. xml_set_default_handler($parser, "handleDefault"); if (!xml_parse($parser, $str, true)) { *************** *** 67,71 **** } ! function parseFile($filename) { if ($this->file_exists($filename)) { $path = explode("/", $filename); --- 97,101 ---- } ! function parseFile($filename, $dtdonly = true) { if ($this->file_exists($filename)) { $path = explode("/", $filename); *************** *** 75,80 **** } $content = implode("", file($filename)); ! $content = "<!DOCTYPE null [".$content."]><null />"; ! return $this->parse($content); } else { --- 105,109 ---- } $content = implode("", file($filename)); ! return $this->parse($content, $dtdonly); } else { *************** *** 101,121 **** if ($token == "[") { $this->parseInternalDTD($tokens, $offset + 2); ! // foreach ($this->elements as $element) { ! // echo $element->tagName." -- "; ! // if ($element->children == null) { ! // echo "EMPTY"; ! // } ! // else { ! // echo $element->children->toString(); ! // } ! // echo "<br>"; ! // } ! exit; } if ($token == "SYSTEM") { $this->parseExternalSystemDTD($tokens, $offset + 2); } if ($token == "PUBLIC") { $this->parseExternalPublicDTD($tokens, $offset + 2); } } --- 130,142 ---- if ($token == "[") { $this->parseInternalDTD($tokens, $offset + 2); ! return; } if ($token == "SYSTEM") { $this->parseExternalSystemDTD($tokens, $offset + 2); + return; } if ($token == "PUBLIC") { $this->parseExternalPublicDTD($tokens, $offset + 2); + return; } } *************** *** 126,141 **** case "<!ELEMENT": { $this->parseElement($tokens, $offset + 1); ! $currentElement = $this->currentElement; ! $currentElement->children =& $this->currentElement->children; ! echo $this->currentElement->tagName." -- "; ! unset($this->currentElement); ! if ($currentElement->children != null) { echo $currentElement->children->toString()."<br>"; ! } ! $this->elements[] =& $currentElement; $offset = $this->skipToGt($tokens, $offset + 1); break; } case "<!ATTLIST": { $offset = $this->skipToGt($tokens, $offset + 1); break; --- 147,163 ---- case "<!ELEMENT": { $this->parseElement($tokens, $offset + 1); ! $currentElement = $this->currentElement; ! $currentElement->children =& $this->currentElement->children; ! echo $this->currentElement->tagName." -- "; ! unset($this->currentElement); ! if ($currentElement->children != null) { echo $currentElement->children->toString()."<br>"; ! } ! $this->elements[] =& $currentElement; $offset = $this->skipToGt($tokens, $offset + 1); break; } case "<!ATTLIST": { + $this->parseAttList($tokens, $offset + 1); $offset = $this->skipToGt($tokens, $offset + 1); break; *************** *** 165,169 **** $token = $this->removeQuotes($tokens[$offset]); $DTDParser = new DTDParser(); ! $DTDParser->parseFile($token); } --- 187,196 ---- $token = $this->removeQuotes($tokens[$offset]); $DTDParser = new DTDParser(); ! $DTDParser->parseFile($token, true); ! // merge definitions from $DTDParser with this ! $token = $tokens[$offset + 1]; ! if ($token == "[") { ! $this->parseInternalDTD($tokens, $offset + 2); ! } } *************** *** 175,182 **** $DTDParser = new DTDParser(); // $DTDParser->parseFile("http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"); ! $DTDParser->parseFile("../xhtml1-strict.dtd"); break; } } } --- 202,214 ---- $DTDParser = new DTDParser(); // $DTDParser->parseFile("http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"); ! $DTDParser->parseFile("../xhtml1-strict.dtd", true); break; } } + // merge definitions from $DTDParser with this + $token = $tokens[$offset + 2]; + if ($token == "[") { + $this->parseInternalDTD($tokens, $offset + 2); + } } *************** *** 300,303 **** --- 332,373 ---- } + function parseAttList($tokens, $offset) { + $name = $tokens[$offset]; + $this->currentAttlist = new DTDAttList($name); + $this->parseAttributes($tokens, $offset + 1); + } + + function parseAttributes($tokens, $offset) { + while ($tokens[$offset] != ">") { + $name = $tokens[$offset]; + echo $name; + $type = $tokens[$offset + 1]; + if ($type == "(") { + $attribute = new DTDAttribute($name, "ENUMERATION"); + // Enumeration + $offset += 2; + while ($tokens[$offset] != ")") { + if ($tokens[$offset] != "|") { + $attribute->value[] = $tokens[$offset]; + } + $offset++; + } + } + else { + $attribute = new DTDAttribute($name, $type); + $offset++; + } + $default = $tokens[$offset + 1]; + $attribute->default = $default; + if ($default == "#FIXED") { + $attribute->defaultValue = $this->removeQuotes($tokens[$offset + 2]); + $offset++; + } + $offset += 2; + } + } + + + function removeQuotes($str) { if (($str[0] == "\"") && ($str[strlen($str) - 1] == "\"")) { *************** *** 335,346 **** } - function handleExternalEntityRef($parser, $openEntityNames, $base, $systemId, $publicId) { - return true; - } - - function handleUnparsedEntityDecl($parser, $entityName, $base, $systemId, $publicId, $notationName) { - return true; - } - function file_exists($filename) { $file = @fopen($filename, "r"); --- 405,408 ---- *************** *** 390,400 **** } class DTDElementChild extends DTDNode { ! // Number of that child ! // 1 = one time ! // 2 = ? - zero or one time ! // 3 = * - zero or more times ! // 4 = + - one or more times ! var $number = 1; var $any = false; --- 452,479 ---- } + class DTDAttList extends DTDNode { + var $attributes; + var $element; + + function DTDAttList($element) { + $this->element = $element; + } + } + + class DTDAttribute extends DTDNode { + var $name; + var $type; + var $value; + var $default; + var $defaultValue; + + function DTDAttribute($name, $type) { + $this->name = $name; + $this->type = $type; + } + } + class DTDElementChild extends DTDNode { ! var $number = ""; var $any = false; *************** *** 418,436 **** } function setNumber($number) { ! switch ($number) { ! case "?": { ! $this->number = 2; ! break; ! } ! case "+": { ! $this->number = 3; ! break; ! } ! case "*": { ! $this->number = 4; ! break; ! } ! } } --- 497,503 ---- } + function setNumber($number) { ! $this->number = $number; } *************** *** 442,446 **** return "#PCDAZA"; } ! return $this->tagName." / ".$this->number; } } --- 509,513 ---- return "#PCDAZA"; } ! return $this->tagName.$this->number; } } *************** *** 468,472 **** $str .= $child->toString(); } ! $str .= ") / ".$this->number; return $str; } --- 535,539 ---- $str .= $child->toString(); } ! $str .= ")".$this->number; return $str; } *************** *** 498,502 **** $str .= $child->toString(); } ! $str .= ") / ".$this->number; return $str; } --- 565,569 ---- $str .= $child->toString(); } ! $str .= ")".$this->number; return $str; } |
From: Thomas D. <th...@us...> - 2002-01-29 14:10:01
|
Update of /cvsroot/phpxd/phpXD/include/dom In directory usw-pr-cvs1:/tmp/cvs-serv12131/include/dom Modified Files: DOMImplementation.php Log Message: Index: DOMImplementation.php =================================================================== RCS file: /cvsroot/phpxd/phpXD/include/dom/DOMImplementation.php,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -r1.1 -r1.2 *** DOMImplementation.php 2002/01/25 22:18:18 1.1 --- DOMImplementation.php 2002/01/29 14:09:58 1.2 *************** *** 45,69 **** */ function &createDocument($namespaceURI, $qualifiedName, &$doctype) { if (!(strpos($qualifiedName, ":") === false)) { $prefix = substr($qualifiedName, 0, strpos($qualifiedName, ":")); ! $localName = substr($qualifiedName, strpos($this->nodeName, ":")+1); if (empty($prefix) || empty($localName)) { return NAMESPACE_ERR; } - } - else { - if (empty($qualifiedName)) { - return NAMESPACE_ERR; - } - } ! if (empty($namespaceURI)) { ! return NAMESPACE_ERR; ! } ! if (($namespaceURI != "http://www.w3.org/XML/1998/namespace") && ! ($prefix == "xml")) { ! return NAMESPACE_ERR; } --- 45,74 ---- */ function &createDocument($namespaceURI, $qualifiedName, &$doctype) { + if (empty($qualifiedName)) { + return NAMESPACE_ERR; + } + + $documentElement = new Element(); + $documentElement->nodeName = $qualifiedName; if (!(strpos($qualifiedName, ":") === false)) { $prefix = substr($qualifiedName, 0, strpos($qualifiedName, ":")); ! $localName = substr($qualifiedName, strpos($qualifiedName, ":")+1); if (empty($prefix) || empty($localName)) { return NAMESPACE_ERR; } ! if (empty($namespaceURI)) { ! return NAMESPACE_ERR; ! } ! ! if (($namespaceURI != "http://www.w3.org/XML/1998/namespace") && ! ($prefix == "xml")) { ! return NAMESPACE_ERR; ! } ! $documentElement->namespaceURI = $namespaceURI; ! $documentElement->localName = $localName; ! $documentElement->prefix = $prefix; } *************** *** 73,82 **** $doc = new Document(); ! $doc->doctype =& $doctype; ! $doc->doctype->ownerDocument =& $this; ! $doc->doctype->namespaceURI = $namespaceURI; ! $doc->namespaceURI = $namespaceURI; ! $doc->prefix = $prefix; ! $doc->localName = $localName; return $doc; } --- 78,89 ---- $doc = new Document(); ! $documentElement->ownerDocument =& $doc; ! $doc->documentElement =& $documentElement; ! if ($doctype != null) { ! $doc->doctype =& $doctype; ! $doc->doctype->ownerDocument =& $doc; ! $doc->doctype->namespaceURI = $namespaceURI; ! $doc->namespaceURI = $namespaceURI; ! } return $doc; } *************** *** 94,104 **** */ function createDocumentType($qualifiedName, $publicId, $systemId) { if (!(strpos($qualifiedName, ":") === false)) { $prefix = substr($qualifiedName, 0, strpos($qualifiedName, ":")); ! $localName = substr($qualifiedName, strpos($this->nodeName, ":")+1); if (empty($prefix) || empty($localName)) { return NAMESPACE_ERR; } } else { --- 101,116 ---- */ function createDocumentType($qualifiedName, $publicId, $systemId) { + $dtd = new DocumentType(); + if (!(strpos($qualifiedName, ":") === false)) { $prefix = substr($qualifiedName, 0, strpos($qualifiedName, ":")); ! $localName = substr($qualifiedName, strpos($qualifiedName, ":")+1); if (empty($prefix) || empty($localName)) { return NAMESPACE_ERR; } + + $dtd->prefix = $prefix; + $dtd->localName = $localName; } else { *************** *** 108,117 **** } - $dtd = new DocumentType(); $dtd->publicId = $publicId; $dtd->systemId = $systemId; $dtd->nodeName = $qualifiedName; - $dtd->prefix = $prefix; - $dtd->localName = $localName; return $dtd; } --- 120,126 ---- |
From: Thomas D. <th...@us...> - 2002-01-28 19:41:56
|
Update of /cvsroot/phpxd/phpXD.www/data/en In directory usw-pr-cvs1:/tmp/cvs-serv19663/data/en Modified Files: index.xml Log Message: Index: index.xml =================================================================== RCS file: /cvsroot/phpxd/phpXD.www/data/en/index.xml,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -r1.2 -r1.3 *** index.xml 2002/01/28 19:37:26 1.2 --- index.xml 2002/01/28 19:41:53 1.3 *************** *** 37,41 **** <h2>Sourceforge</h2> <p> ! phpXMLDOM ist hosted at <a href="http://sf.net/projects/phpxd"> Sourceforge</a>. </p> --- 37,41 ---- <h2>Sourceforge</h2> <p> ! phpXMLDOM is hosted at <a href="http://sf.net/projects/phpxd"> Sourceforge</a>. </p> |
From: Thomas D. <th...@us...> - 2002-01-28 19:37:30
|
Update of /cvsroot/phpxd/phpXD.www/include/phpXD In directory usw-pr-cvs1:/tmp/cvs-serv17710/include/phpXD Modified Files: phpXD.php Log Message: Index: phpXD.php =================================================================== RCS file: /cvsroot/phpxd/phpXD.www/include/phpXD/phpXD.php,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -r1.1 -r1.2 *** phpXD.php 2002/01/26 17:10:44 1.1 --- phpXD.php 2002/01/28 19:37:26 1.2 *************** *** 7,27 **** // $Id$ ! require("include/phpxd_0.21/include/node.php"); ! require("include/phpxd_0.21/include/attr.php"); ! require("include/phpxd_0.21/include/characterdata.php"); ! require("include/phpxd_0.21/include/comment.php"); ! require("include/phpxd_0.21/include/document.php"); ! require("include/phpxd_0.21/include/documentfragment.php"); ! require("include/phpxd_0.21/include/documenttype.php"); ! require("include/phpxd_0.21/include/domexception.php"); ! require("include/phpxd_0.21/include/domimplementation.php"); ! require("include/phpxd_0.21/include/element.php"); ! require("include/phpxd_0.21/include/entity.php"); ! require("include/phpxd_0.21/include/entityreference.php"); ! require("include/phpxd_0.21/include/namednodemap.php"); ! require("include/phpxd_0.21/include/nodelist.php"); ! require("include/phpxd_0.21/include/processinginstruction.php"); ! require("include/phpxd_0.21/include/text.php"); ! require("include/phpxd_0.21/include/cdatasection.php"); /** --- 7,27 ---- // $Id$ ! require("include/phpXD/include/node.php"); ! require("include/phpXD/include/attr.php"); ! require("include/phpXD/include/characterdata.php"); ! require("include/phpXD/include/comment.php"); ! require("include/phpXD/include/document.php"); ! require("include/phpXD/include/documentfragment.php"); ! require("include/phpXD/include/documenttype.php"); ! require("include/phpXD/include/domexception.php"); ! require("include/phpXD/include/domimplementation.php"); ! require("include/phpXD/include/element.php"); ! require("include/phpXD/include/entity.php"); ! require("include/phpXD/include/entityreference.php"); ! require("include/phpXD/include/namednodemap.php"); ! require("include/phpXD/include/nodelist.php"); ! require("include/phpXD/include/processinginstruction.php"); ! require("include/phpXD/include/text.php"); ! require("include/phpXD/include/cdatasection.php"); /** |
From: Thomas D. <th...@us...> - 2002-01-28 19:37:29
|
Update of /cvsroot/phpxd/phpXD.www/data/en In directory usw-pr-cvs1:/tmp/cvs-serv17710/data/en Modified Files: index.xml navigation.xml Added Files: readme.xml releases.xml Log Message: --- NEW FILE: readme.xml --- <?xml version="1.0" encoding="iso8859-1"?> <page> <title> ReadMe </title> <content> <h1>ReadMe</h1> <h2>Preface</h2> <p>This file relates to phpXD release 0.21.</p> <h2>What is phpXMLDOM?</h2> <p>phpXMLDOM is a XML DOM-Implementation for PHP4 written in PHP. It offers methods for accessing the nodes of a XML document using the W3C Document Object Model Level 2 Core (DOM). </p> <p>The differences to the PHP DOM XML functions (only available if PHP was configured with --with-dom=[DIR]) are that phpXMLDOM implements the official W3C DOM (see http://www.w3.org/DOM/) and that you do not need to recompile PHP to use phpXMLDOM. </p> <h2>Requirements</h2> <ul> <li>PHP 4.0.5 (or higher)</li> <li>PHP XML extension (configure PHP using --with-xml)</li> </ul> <h2>Features</h2> <p>Currently phpXMLDOM supports nearly all interfaces of DOM Level 2. Not supported are:</p> <ul> <li>Entity</li> <li>EntityReference</li> </ul> <p>DocumentType is still bad implemented, because the DTD of a XML file is not parsed. Only name, publicID, systemID and the internalSubset attribute are supported. If you load a XML file with a internal DTD and change the node tree, phpXMLDOM keeps the original DTD if you will save the file.</p> <p>Because PHP4 doesn't support exceptions, the DOMException interface is not really implemented. Instead of this, ExceptionCodes are defined. The functions which normally would like to raise a exception, returns an ExceptionCode.</p> <h2>Using phpXMLDOM</h2> <p>First, create a phpXD object:</p> <pre>$dom = new phpXD();</pre> <p>If you specify a XML file as the first parameter of the constructor, the file will be parsed and the DOM tree created:</p> <pre>$dom = new phpXD("sample.xml");</pre> <p>You can load a XML file with</p> <pre>$dom->loadFile("sample.xml");</pre> <p>To access the DOM tree, use the document attribute, e.g.:</p> <pre>$list =& $dom->document->getElementsByTagName("hello");</pre> <p>You can get the root node with</p> <pre>$root =& $dom->document->getDocumentElement();</pre> <p>Be sure, that you use "=&", if a function returns a DOM object, because PHP copies all objects with "=", while the "=&" operator saves a reference. Because the DOM tree is a list of references, only one "=" could destroy the hierarchy of the tree.</p> <p>For more informations about the DOM interfaces see: http://www.w3.org/DOM/</p> <p>Last but not least, you can save the DOM tree:</p> <pre>$dom->saveFile("new.xml");</pre> </content> </page> <!-- Keep this comment at the end of the file Local variables: mode: sgml sgml-omittag:t sgml-shorttag:t sgml-namecase-general:t sgml-general-insert-case:lower sgml-minimize-attributes:nil sgml-always-quote-attributes:t sgml-indent-step:2 sgml-indent-data:t sgml-parent-document:nil sgml-exposed-tags:nil sgml-local-catalogs:nil sgml-local-ecat-files:nil End: --> --- NEW FILE: releases.xml --- <?xml version="1.0" encoding="iso8859-1"?> <page> <title> Releases </title> <content> <h1>Releases</h1> <h2>Current Release: phpXD 0.21</h2> <h3>Release Notes</h3> <ul> <li>Now all classes have a source documentation in PHPDoc style (see <a href="http://www.callowayprints.com/phpdoc/"> http://www.callowayprints.com/phpdoc/</a>). With this the class documentation is created in doc/.</li> <li>Loading big xml-files tooks really long. The reason was the function uniqid() in Node(), which is now replaced by a combination of microtime() and rand(). I hope this is unique enough. ;=)</li> <li>Some litte bugs fixed...</li> </ul> <h3>Files</h3> <p> <a href="http://prdownloads.sf.net/phpxd/phpxd_0.21.tar.gz"> phpxd_0.21.tar.gz </a> (Size: 51620 Bytes) </p> </content> </page> <!-- Keep this comment at the end of the file Local variables: mode: sgml sgml-omittag:t sgml-shorttag:t sgml-namecase-general:t sgml-general-insert-case:lower sgml-minimize-attributes:nil sgml-always-quote-attributes:t sgml-indent-step:2 sgml-indent-data:t sgml-parent-document:nil sgml-exposed-tags:nil sgml-local-catalogs:nil sgml-local-ecat-files:nil End: --> Index: index.xml =================================================================== RCS file: /cvsroot/phpxd/phpXD.www/data/en/index.xml,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -r1.1 -r1.2 *** index.xml 2002/01/26 17:10:44 1.1 --- index.xml 2002/01/28 19:37:26 1.2 *************** *** 5,18 **** </title> <content> <p> ! This page is currently offline. Please take a look at the ! <a href="http://sf.net/projects/phpxd">project site at ! Sourceforge. </a> </p> <p> ! <a href="http://sourceforge.net"><img ! src="http://sourceforge.net/sflogo.php?group_id=29609" ! width="88" height="31" alt="SourceForge" /></a> </p> </content> </page> --- 5,46 ---- </title> <content> + <h1>phpXMLDOM</h1> <p> ! phpXMLDOM (phpXD) is a XML DOM-Implementation for PHP4 written ! in PHP. It offers methods for accessing the nodes of a XML ! document using the W3C Document Object Model (DOM) Level 2 ! Core. </p> + <p> ! phpXMLDOM and all associated files are released unter the ! <a href="http://www.gnu.org/licenses/gpl.html">GNU Public ! License (GPL)</a>. </p> + + <h2>Releases</h2> + <p> + The current release is 0.21, see + <a href="$URL$$SESSION_ID$releases">Releases</a>. There is a + short <a href="$URL$$SESSION_ID$readme">ReadMe</a> and some + <a href="http://phpxd.sourceforge.net/doc/index.html">API + Documentation</a>. + </p> + + <h2>Contact</h2> + <p> + If you found a bug or would like to help developing phpXMLDOM, + please send an email to <a href="mailto:th...@do...">Thomas + Dohmke</a>. + </p> + + <h2>Sourceforge</h2> + <p> + phpXMLDOM ist hosted at <a href="http://sf.net/projects/phpxd"> + Sourceforge</a>. + </p> + <a href="http://sourceforge.net"><img + src="http://sourceforge.net/sflogo.php?group_id=29609" + width="88" height="31" alt="SourceForge" /></a> </content> </page> Index: navigation.xml =================================================================== RCS file: /cvsroot/phpxd/phpXD.www/data/en/navigation.xml,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -r1.1 -r1.2 *** navigation.xml 2002/01/26 17:10:44 1.1 --- navigation.xml 2002/01/28 19:37:26 1.2 *************** *** 6,22 **** </li> <li> ! <!--<a href="$URL$$SESSION_ID$sourceforge">phpXMLDOM on Sourceforge</a>--> ! <a href="http://sf.net/projects/phpxd/">phpXMLDOM on Sourceforge</a> ! <ul class="navbar"> ! <li> ! <a href="http://sf.net/projects/phpxd">Summary</a> </li> <li> ! <a href="http://sourceforge.net/project/showfiles.php?group_id=29609">Files</a> </li> <li> ! <a href="http://sourceforge.net/docman/?group_id=29609">Docs</a> </li> ! </ul> </li> </ul> --- 6,19 ---- </li> <li> ! <a href="$URL$$SESSION_ID$releases">Releases</a> </li> <li> ! <a href="$URL$$SESSION_ID$readme">ReadMe</a> </li> <li> ! <a href="http://phpxd.sourceforge.net/doc/index.html">API Documentation</a> </li> ! <li> ! <a href="http://sf.net/projects/phpxd/">phpXMLDOM on Sourceforge</a> </li> </ul> |
From: Thomas D. <th...@us...> - 2002-01-28 19:37:29
|
Update of /cvsroot/phpxd/phpXD.www/templates In directory usw-pr-cvs1:/tmp/cvs-serv17710/templates Modified Files: template.html Log Message: Index: template.html =================================================================== RCS file: /cvsroot/phpxd/phpXD.www/templates/template.html,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -r1.1 -r1.2 *** template.html 2002/01/26 17:10:45 1.1 --- template.html 2002/01/28 19:37:26 1.2 *************** *** 34,37 **** --- 34,38 ---- <p class="bottombar"> Page created in $PROCESSING_TIME$ s. + </p> </div> </body> |
From: Thomas D. <th...@us...> - 2002-01-28 19:37:29
|
Update of /cvsroot/phpxd/phpXD.www In directory usw-pr-cvs1:/tmp/cvs-serv17710 Modified Files: default.php Log Message: Index: default.php =================================================================== RCS file: /cvsroot/phpxd/phpXD.www/default.php,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -r1.1 -r1.2 *** default.php 2002/01/26 17:10:44 1.1 --- default.php 2002/01/28 19:37:26 1.2 *************** *** 14,18 **** header("Content-Type: text/html; charset=ISO-8859-1"); ! require("include/phpxd_0.21/phpXD.php"); require("classes/Sites.php"); --- 14,18 ---- header("Content-Type: text/html; charset=ISO-8859-1"); ! require("include/phpXD/phpXD.php"); require("classes/Sites.php"); *************** *** 89,92 **** --- 89,95 ---- $site = "en/index"; } + if ($sites->getClass($site) == "") { + $site = "en/".$site; + } $class = $sites->getClass($site); } *************** *** 100,105 **** } - // No site found? Then go to the index site. - //header("Location: ".$URL); exit; ?> --- 103,106 ---- |
From: Thomas D. <th...@us...> - 2002-01-28 19:37:29
|
Update of /cvsroot/phpxd/phpXD.www/classes In directory usw-pr-cvs1:/tmp/cvs-serv17710/classes Modified Files: Site.php Sites.php StaticSite.php Log Message: Index: Site.php =================================================================== RCS file: /cvsroot/phpxd/phpXD.www/classes/Site.php,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -r1.1 -r1.2 *** Site.php 2002/01/26 17:10:44 1.1 --- Site.php 2002/01/28 19:37:26 1.2 *************** *** 109,112 **** --- 109,113 ---- if (file_exists("data/".$site."/navigation.xml")) { $linksDOM = new phpXD("data/".$site."/navigation.xml"); + $linksDOM->document->documentElement->normalize(); return $linksDOM->document->documentElement->firstChild; } *************** *** 116,119 **** --- 117,121 ---- function makeNavigation(&$linksDOM) { $this->navigation = ""; + $linksDOM->normalize(); $links =& $linksDOM->getElementsByTagName("li"); for ($i = 0; $i < $links->getLength(); ++$i) { Index: Sites.php =================================================================== RCS file: /cvsroot/phpxd/phpXD.www/classes/Sites.php,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -r1.1 -r1.2 *** Sites.php 2002/01/26 17:10:44 1.1 --- Sites.php 2002/01/28 19:37:26 1.2 *************** *** 14,17 **** --- 14,20 ---- function Sites() { $this->sites["en/index"] = "StaticSite"; + $this->sites["en/readme"] = "StaticSite"; + $this->sites["en/releases"] = "StaticSite"; + $this->title["en/readme"] = "ReadMe"; } Index: StaticSite.php =================================================================== RCS file: /cvsroot/phpxd/phpXD.www/classes/StaticSite.php,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -r1.1 -r1.2 *** StaticSite.php 2002/01/26 17:10:44 1.1 --- StaticSite.php 2002/01/28 19:37:26 1.2 *************** *** 35,38 **** --- 35,39 ---- if (file_exists($this->filepath.$this->site.".xml")) { $pageDOM = new phpXD($this->filepath.$this->site.".xml"); + $pageDOM->document->documentElement->normalize(); } *************** *** 57,60 **** --- 58,62 ---- if ($linksNode->getAttribute("ref") != "") { $linksDOM = new phpXD("data/".$linksNode->getAttribute("ref")); + $linksDOM->document->documentElement->normalize(); $linksNodes2 = $linksDOM->document->getElementsByTagName("links"); if ($linksNodes2->getLength() > 0) { |
From: Thomas D. <th...@us...> - 2002-01-27 01:23:14
|
Update of /cvsroot/phpxd/phpXD/include/parser In directory usw-pr-cvs1:/tmp/cvs-serv24978/include/parser Modified Files: DTDParser.php Log Message: Parsing of Element declarations implemented. Parameter Entities are supported, but it is just a hack (lines 26-43). Attlists, Entities and Notations are still missing. Index: DTDParser.php =================================================================== RCS file: /cvsroot/phpxd/phpXD/include/parser/DTDParser.php,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -r1.1 -r1.2 *** DTDParser.php 2002/01/26 13:20:01 1.1 --- DTDParser.php 2002/01/27 01:23:10 1.2 *************** *** 16,20 **** --- 16,24 ---- class DTDParser { var $parseDTD = false; + var $parseInternalDTD = false; + var $DTDTokens; var $parameterEntities; + var $elements; + var $currentElement; function parse($str) { *************** *** 22,40 **** while (preg_match('=(.*)\%([a-z,A-Z,0-9,\.]*);(.*)$=sU', $str, $ent)) { $str = preg_replace('=<!--.*-->=sU', '', $str); ! while (preg_match('=(.*)<!ENTITY[ ,\n,\r,\t]*\%[ ,\n,\r,\t]*([a-z,A-Z,0-9,\.]*)[ ,\n,\r,\t]*PUBLIC[ ,\n,\r,\t]*"([a-z,A-Z,0-9,\-,/, ]*)"[ ,\n,\r,\t]*"([a-z,A-Z,0-9,\.,\-,_,/]*)"[ ,\n,\r,\t]*>(.*)$=sU', $str, $ent)) { ! if ($this->file_exists($this->currentDir."/".$ent[4])) { ! $this->parameterEntities[$ent[2]] = ! preg_replace('=<!--.*-->=sU', '', implode("", file($this->currentDir."/".$ent[4]))); ! } ! $str = $ent[1].$ent[5]; ! } while (preg_match('=(.*)<!ENTITY[ ,\n,\r,\t]*\%[ ,\n,\r,\t]*([a-z,A-Z,0-9,\.]*)[ ,\n,\r,\t]*"(.*)"[ ,\n,\r,\t]*>(.*)$=sU', $str, $ent)) { $this->parameterEntities[$ent[2]] = $ent[3]; $str = $ent[1].$ent[4]; - } - while (preg_match('=(.*)\%([a-z,A-Z,0-9,\.]*);(.*)$=sU', $str, $ent)) { - $str = $ent[1].$this->parameterEntities[$ent[2]].$ent[3]; } } $parser = xml_parser_create(); --- 26,44 ---- while (preg_match('=(.*)\%([a-z,A-Z,0-9,\.]*);(.*)$=sU', $str, $ent)) { $str = preg_replace('=<!--.*-->=sU', '', $str); ! while (preg_match('=(.*)<!ENTITY[ ,\n,\r,\t]*\%[ ,\n,\r,\t]*([a-z,A-Z,0-9,\.]*)[ ,\n,\r,\t]*PUBLIC[ ,\n,\r,\t]*"([a-z,A-Z,0-9,\-,/, ]*)"[ ,\n,\r,\t]*"([a-z,A-Z,0-9,\.,\-,_,/]*)"[ ,\n,\r,\t]*>(.*)$=sU', $str, $ent)) { ! if ($this->file_exists($this->currentDir."/".$ent[4])) { ! $this->parameterEntities[$ent[2]] = ! preg_replace('=<!--.*-->=sU', '', implode("", file($this->currentDir."/".$ent[4]))); ! } ! $str = $ent[1].$ent[5]; ! } while (preg_match('=(.*)<!ENTITY[ ,\n,\r,\t]*\%[ ,\n,\r,\t]*([a-z,A-Z,0-9,\.]*)[ ,\n,\r,\t]*"(.*)"[ ,\n,\r,\t]*>(.*)$=sU', $str, $ent)) { $this->parameterEntities[$ent[2]] = $ent[3]; $str = $ent[1].$ent[4]; } + foreach ($this->parameterEntities as $ent => $body) { + $str = str_replace("%".$ent.";", $body, $str); + } } $parser = xml_parser_create(); *************** *** 86,118 **** function parseDoctype($tokens) { $token = $tokens[0]; ! if ($this->compareToken($token, "<!DOCTYPE")) { ! $this->parseDocumentElement(array_slice($tokens, 1)); } } ! function parseDocumentElement($tokens) { ! $token = $tokens[0]; $this->documentElement = $token; ! $token = $tokens[1]; ! if ($this->compareToken($token, "[")) { ! $this->parseInternalDTD(array_slice($tokens, 2)); } ! if ($this->compareToken($token, "SYSTEM")) { ! $this->parseExternalSystemDTD(array_slice($tokens, 2)); } ! if ($this->compareToken($token, "PUBLIC")) { ! $this->parseExternalPublicDTD(array_slice($tokens, 2)); } } ! function parseInternalDTD($tokens) { } ! function parseExternalSystemDTD($tokens) { } ! function parseExternalPublicDTD($tokens) { ! $tokenPublicID = $this->removeQuotes($tokens[0]); ! $tokenURI = $this->removeQuotes($tokens[1]); switch ($tokenPublicID) { case "-//W3C//DTD XHTML 1.0 Strict//EN": { --- 90,174 ---- function parseDoctype($tokens) { $token = $tokens[0]; ! if ($token == "<!DOCTYPE") { ! $this->parseDocumentElement($tokens, 1); } } ! function parseDocumentElement($tokens, $offset) { ! $token = $tokens[$offset]; $this->documentElement = $token; ! $token = $tokens[$offset + 1]; ! if ($token == "[") { ! $this->parseInternalDTD($tokens, $offset + 2); ! // foreach ($this->elements as $element) { ! // echo $element->tagName." -- "; ! // if ($element->children == null) { ! // echo "EMPTY"; ! // } ! // else { ! // echo $element->children->toString(); ! // } ! // echo "<br>"; ! // } ! exit; ! } ! if ($token == "SYSTEM") { ! $this->parseExternalSystemDTD($tokens, $offset + 2); ! } ! if ($token == "PUBLIC") { ! $this->parseExternalPublicDTD($tokens, $offset + 2); ! } ! } ! ! function parseInternalDTD($tokens, $offset) { ! $token = $tokens[$offset]; ! switch ($token) { ! case "<!ELEMENT": { ! $this->parseElement($tokens, $offset + 1); ! $currentElement = $this->currentElement; ! $currentElement->children =& $this->currentElement->children; ! echo $this->currentElement->tagName." -- "; ! unset($this->currentElement); ! if ($currentElement->children != null) { ! echo $currentElement->children->toString()."<br>"; ! } ! $this->elements[] =& $currentElement; ! $offset = $this->skipToGt($tokens, $offset + 1); ! break; ! } ! case "<!ATTLIST": { ! $offset = $this->skipToGt($tokens, $offset + 1); ! break; ! } ! case "<!ENTITY": { ! $offset = $this->skipToGt($tokens, $offset + 1); ! break; } ! case "<!NOTATION": { ! $offset = $this->skipToGt($tokens, $offset + 1); ! break; ! } } ! if (($tokens[$offset] != "]>") && ($tokens[$offset] != "]")) { ! $this->parseInternalDTD($tokens, $offset); } } ! function skipToGt($tokens, $offset) { ! while ($tokens[$offset] != ">") { ! $offset++; ! } ! return $offset + 1;; } ! function parseExternalSystemDTD($tokens, $offset) { ! $token = $this->removeQuotes($tokens[$offset]); ! $DTDParser = new DTDParser(); ! $DTDParser->parseFile($token); } ! function parseExternalPublicDTD($tokens, $offset) { ! $tokenPublicID = $this->removeQuotes($tokens[$offset]); ! $tokenURI = $this->removeQuotes($tokens[$offset + 1]); switch ($tokenPublicID) { case "-//W3C//DTD XHTML 1.0 Strict//EN": { *************** *** 123,135 **** } } - // echo $tokenURI; } ! function compareToken($tok1, $tok2) { ! if ($tok1 == $tok2) { ! return true; ! } else { ! return false; } } --- 179,300 ---- } } } ! function parseElement($tokens, $offset) { ! $name = $tokens[$offset]; ! $this->currentElement = new DTDElement($name); ! $this->parseElementChilds($tokens, $offset + 1); ! } ! ! function parseElementChilds($tokens, $offset) { ! $token = $tokens[$offset]; ! if ($token == "(") { ! $nestlevel = 1; $cursor = 1; ! while (($nestlevel > 0) && ! (($tokens[$offset + $cursor] != ",") || ($nestlevel > 1))) { ! if ($tokens[$offset + $cursor] == "(") { ! $nestlevel++; ! } ! if (substr($tokens[$offset + $cursor], 0, 1) == ")") { ! $nestlevel--; ! } ! $cursor++; ! } ! if ($nestlevel == 1) { ! if ($this->currentElement->children == null) { ! $this->currentElement->children = new DTDElementSequence(); ! } ! else { ! $newChild = new DTDElementSequence(); ! $newChild->parent =& $this->currentElement->children; ! $newChild->parent->appendChild($newChild); ! unset($this->currentElement->children); ! $this->currentElement->children =& $newChild; ! } ! } ! else { ! if ($this->currentElement->children == null) { ! $this->currentElement->children = new DTDElementChoice(); ! } ! else { ! $newChild = new DTDElementChoice(); ! $newChild->parent =& $this->currentElement->children; ! $newChild->parent->appendChild($newChild); ! unset($this->currentElement->children); ! $this->currentElement->children =& $newChild; ! } ! } ! $this->parseElementChilds($tokens, $offset + 1); ! return; ! } ! if ($token[0] == ")") { ! if (($token[strlen($token) - 1] == "?") || ! ($token[strlen($token) - 1] == "+") || ! ($token[strlen($token) - 1] == "*")) { ! $this->currentElement->children->setNumber($token[strlen($token) - 1]); ! } ! if ($this->currentElement->children->parent != null) { ! $parent =& $this->currentElement->children->parent; ! $this->currentElement->children =& $parent; ! $this->parseElementChilds($tokens, $offset + 1); ! return; ! } ! else { ! // assert: the dtd is correct, so it is the last return. ! return; ! } ! } ! if (($token == ",") || ($token == "|") || ! ($token == "?") || ($token == "+") || ($token == "*")) { ! $this->parseElementChilds($tokens, $offset + 1); ! return; ! } ! if ($token == ">") { ! return; ! } ! $this->parseElementChild($tokens, $offset); ! $this->parseElementChilds($tokens, $offset + 1); ! } ! ! function parseElementChild($tokens, $offset) { ! $token = $tokens[$offset]; ! if ($token == "ANY") { ! $this->currentElement->children = ! new DTDElementChild("", "", true); ! return; ! } ! if ($token == "EMPTY") { ! $this->currentElement->children = null; ! return; ! } ! if ($token == "#PCDATA") { ! if ($this->currentElement->children == null) { ! $this->currentElement->children = ! new DTDElementChild("", "", true, true); ! return; ! } ! else { ! $this->currentElement->children-> ! appendChild(new DTDElementChild("", "", true, true)); ! return; ! } ! } ! if (($token[strlen($token) - 1] == "?") || ! ($token[strlen($token) - 1] == "+") || ! ($token[strlen($token) - 1] == "*")) { ! $number = $token[strlen($token) - 1]; ! $token = substr($token, 0, strlen($token) - 1); ! } else { ! $number = ""; ! } ! $child = new DTDElementChild($token, $number); ! if ($this->currentElement->children == null) { ! $this->currentElement->children =& $child; ! return; ! } ! else { ! $this->currentElement->children->appendChild($child); ! return; } } *************** *** 146,151 **** $data = trim($data); - // echo "<pre>".$data."</pre>"; - if ($data == "<!DOCTYPE") { $this->DTDTokens[] = $data; --- 311,314 ---- *************** *** 155,159 **** if ($this->parseDTD) { ! $this->DTDTokens[] = $data; if ($data == "[") { $this->parseInternalDTD = true; --- 318,324 ---- if ($this->parseDTD) { ! if ($data != "") { ! $this->DTDTokens[] = $data; ! } if ($data == "[") { $this->parseInternalDTD = true; *************** *** 171,180 **** function handleExternalEntityRef($parser, $openEntityNames, $base, $systemId, $publicId) { - echo "hier"; return true; } function handleUnparsedEntityDecl($parser, $entityName, $base, $systemId, $publicId, $notationName) { - echo "hier"; return true; } --- 336,343 ---- *************** *** 211,214 **** --- 374,503 ---- echo "<strong>phpXD error:</strong> ".$message; exit; + } + } + + class DTDNode { + } + + class DTDElement extends DTDNode { + var $tagName; + var $children; + + function DTDElement($tagName) { + $this->tagName = $tagName; + $this->children = null; + } + } + + class DTDElementChild extends DTDNode { + // Number of that child + // 1 = one time + // 2 = ? - zero or one time + // 3 = * - zero or more times + // 4 = + - one or more times + var $number = 1; + + var $any = false; + var $pcdata = false; + var $tagName; + var $id; + + function DTDElementChild($tagName, $number, $any = false, $pcdata = false) { + if ($any) { + $this->any = true; + return; + } + + if ($pcdata) { + $this->pcdata = true; + return; + } + + $this->tagName = $tagName; + $this->setNumber($number); + } + + function setNumber($number) { + switch ($number) { + case "?": { + $this->number = 2; + break; + } + case "+": { + $this->number = 3; + break; + } + case "*": { + $this->number = 4; + break; + } + } + } + + function toString() { + if ($this->any) { + return "ANY"; + } + if ($this->pcdata) { + return "#PCDAZA"; + } + return $this->tagName." / ".$this->number; + } + } + + class DTDElementSequence extends DTDElementChild { + var $sequence; + var $length = 0; + var $parent = null; + + function DTDElementSequence() { + } + + function appendChild(&$child) { + $this->sequence[$this->length++] =& $child; + } + + function toString() { + $str = "("; + $count = 0; + for ($count = 0; $count < $this->length; ++$count) { + $child =& $this->sequence[$count]; + if ($count != 0) { + $str .= " , "; + } + $str .= $child->toString(); + } + $str .= ") / ".$this->number; + return $str; + } + } + + class DTDElementChoice extends DTDElementChild { + var $choices; + var $length = 0; + var $parent = null; + + function DTDElementChoice() { + } + + function DTDElementChoice() { + } + + function appendChild(&$child) { + $this->choices[$this->length++] =& $child; + } + + function toString() { + $str = "("; + $count = 0; + for ($count = 0; $count < $this->length; ++$count) { + $child =& $this->choices[$count]; + if ($count != 0) { + $str .= " | "; + } + $str .= $child->toString(); + } + $str .= ") / ".$this->number; + return $str; } } |
From: Thomas D. <th...@us...> - 2002-01-26 17:10:48
|
Update of /cvsroot/phpxd/phpXD.www/include/phpXD/include In directory usw-pr-cvs1:/tmp/cvs-serv21133/include/phpXD/include Added Files: attr.php cdatasection.php characterdata.php comment.php document.php documentfragment.php documenttype.php domexception.php domimplementation.php element.php entity.php entityreference.php namednodemap.php node.php nodelist.php processinginstruction.php text.php Log Message: Initial checkin of the phpxd homepage. --- NEW FILE: attr.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: attr.php,v 1.1 2002/01/26 17:10:44 thomi Exp $ /** * Class representing the DOM Attr interface. * * @package phpXD * @author Thomas Dohmke <th...@do...> * @version $Revision: 1.1 $ */ class Attr extends Node { /** * The name of the attribute.<br> * DOM-Level 1 * * @private * @type string */ var $name; /** * A link to the Element object that owns this attribute.<br> * DOM-Level 2 * * @private * @type Node */ var $ownerElement; /** * If this attribute was explicity set in the XML source for the parent * element or it is a default value in the DTD (currently not supported by * phpXD) specified is true.<br> * DOM-Level 1 * * @private * @type boolean */ var $specified; /** * The value of the attribute.<br> * DOM-Level 1 * * @private * @type string */ var $value; /** * Constructor of the class. * * @public */ function Attr() { Node::Node(); $this->nodeType = ATTRIBUTE_NODE; $this->specified = true; $this->name =& $this->nodeName; } /** * Returns the name of the attribute.<br> * DOM-Level 1 * * @public * @returns string */ function getName() { return $this->name; } /** * Returns a reference to the owner of the attribute.<br> * DOM-Level 2 * * @public * @returns Node */ function &getOwnerElement() { return $this->ownerElement; } /** * Returns true if the attribute was set explicity in the XML Source or in * the DTD (not supported).<br> * DOM-Level 1 * * @public * @returns boolean */ function getSpecified() { return $this->specified; } /** * Return the value of the attribute.<br> * DOM-Level 1 * * @public * @returns string */ function getValue() { if (isset($this->value)) { return $this->value; } } /** * Sets the value of the attribute<br> * DOM-Level 1 * * @public * @param $value <code>string</code> * @returns void */ function setValue($value) { if (isset($this->childNodes)) { $child =& $this->firstChild; while (isset($child)) { removeChild($child); $child =& $this->firstChild; } } $new = new Text(); $new->nodeValue = $value; $new->ownerDocument =& $this->ownerDocument; $this->firstChild =& $new; $this->lastChild =& $this->firstChild; $this->nodeValue =& $this->firstChild->nodeValue; $this->value =& $this->nodeValue; } /** * Sets the value of the attribute (inherited function from Node interface) * <br>DOM-Level 1 * * @public * @param $nodeValue <code>string</code> * @returns void */ function setNodeValue($nodeValue) { $this->setValue($nodeValue); } /** * This inherited function from Node interface is not supported by the Attr * interface.<br> * DOM-Level 1 * * @public * @returns NOT_SUPPORTED_ERR */ function &appendChild(&$newChild) { return NOT_SUPPORTED_ERR; } /** * This inherited function from Node interface is not supported by the Attr * interface.<br> * DOM-Level 1 * * @public * @returns NOT_SUPPORTED_ERR */ function &insertBefore(&$newChild, &$refChild) { return NOT_SUPPORTED_ERR; } /** * This inherited function from Node interface is not supported by the Attr * interface.<br> * DOM-Level 1 * * @public * @returns NOT_SUPPORTED_ERR */ function &replaceChild($newChild, $oldChild) { return NOT_SUPPORTED_ERR; } } ?> --- NEW FILE: cdatasection.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: cdatasection.php,v 1.1 2002/01/26 17:10:44 thomi Exp $ /** * Class representing the DOM CDataSection interface. * * @package phpXD * @author Thomas Dohmke <th...@do...> * @version $Revision: 1.1 $ */ class CDataSection extends Text { /** * Constructor of the class. * * @public */ function CDataSection() { Text::Text(); $this->nodeType = CDATA_SECTION_NODE; $this->nodeName = "#cdata-section"; } } ?> --- NEW FILE: characterdata.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: characterdata.php,v 1.1 2002/01/26 17:10:44 thomi Exp $ /** * Class representing the DOM CharacterData interface. * * @package phpXD * @author Thomas Dohmke <th...@do...> * @version $Revision: 1.1 $ */ class CharacterData extends Node { /** * The "raw" data of the CharacterData node.<br> * DOM-Level 1 * * @private * @type string */ var $data; /** * The size of the string stored in data.<br> * DOM-Level 1 * * @private * @type int */ var $length; /** * Constructor of the class. * * @public */ function CharacterData() { Node::Node(); $this->data =& $this->nodeValue; } /** * Returns the data stored in this node.<br> * DOM-Level 1 * * @public * @returns string */ function getData() { return $this->data; } /** * Sets the data stored in this node.<br> * DOM-Level 1 * * @public * @param $data <code>string</code> * @returns string */ function setData($data) { $this->nodeValue = $data; } /** * Returns the length of the data stored in this node.<br> * DOM-Level 1 * * @public * @returns string */ function getLength() { return strlen($this->data); } /** * Appends contents of the arg parameter to the current contents of the data * attribute.<br> * DOM-Level 1 * * @public * @param $arg <code>string</code> * @returns string */ function appendData($arg) { $this->nodeValue .= $arg; } /** * Truncates the data attribute; It removes count characters, starting at * the offset position.<br> * DOM-Level 1 * * @public * @param $offset <code>int</code> * @param $count <code>int</code> * @returns string */ function deleteData($offset, $count) { $this->nodeValue = substr($this->nodeValue, 0, $offset-1). substr($this->nodeValue, $offset+count); } /** * Takes a string, splits the data attributes current contents at the given * offset, then inserts the string arg between the two substrings.<br> * DOM-Level 1 * * @public * @param $offset <code>int</code> * @param $arg <code>string</code> * @returns string */ function insertData($offset, $arg) { $this->nodeValue = substr($this->nodeValue, 0, $offset-1).$arg. substr($this->nodeValue, $offset); } /** * Replaces a substring within the data attribute with another string.<br> * DOM-Level 1 * * @public * @param $offset <code>int</code> * @param $count <code>int</code> * @param $arg <code>string</code> * @returns string */ function replaceData($offset, $count, $arg) { if ($offset + $count > strlen($this->nodeValue)) { $count = strlen($this->nodeValue) - $offset; } $this->nodeValue = substr($this->nodeValue, 0, $offset-1). substr($arg, 0, $count) . substr($this->nodeValue, $offset+$count); } /** * Returns a string that contains a subset of the string stored in the data * attribute.<br> * DOM-Level 1 * * @public * @param $offset <code>int</code> * @param $count <code>int</code> * @returns string */ function substringData($offset, $count) { return substr($this->nodeValue, $offset, $count); } } ?> --- NEW FILE: comment.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: comment.php,v 1.1 2002/01/26 17:10:44 thomi Exp $ /** * Class representing the DOM Comment interface. * * @package phpXD * @author Thomas Dohmke <th...@do...> * @version $Revision: 1.1 $ */ class Comment extends CharacterData { /** * Constructor of the class. * * @public */ function Comment() { CharacterData::CharacterData(); $this->nodeName = "#comment"; $this->nodeType = COMMENT_NODE; } } ?> --- NEW FILE: document.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: document.php,v 1.1 2002/01/26 17:10:44 thomi Exp $ /** * Class representing the DOM Document interface. * * @package phpXD * @author Thomas Dohmke <th...@do...> * @version $Revision: 1.1 $ */ class Document extends Node { /** * An instance of the DocumentType interface representing the DTD; If no * DTD was declared in the document, this property is null.<br> * DOM-Level 1 * * @private * @type DocumentType */ var $doctype; /** * Points to the single Element node that is the root of the XML tree.<br> * DOM-Level 1 * * @private * @type Element */ var $documentElement; /** * An reference to the DOMImplementation that is responsible for this * document.<br> * DOM-Level 1 * * @private * @type DOMImplementation */ var $implementation; /** * Constructor of the class.<br> * * @public */ function Document() { Node::Node(); $this->nodeType = DOCUMENT_NODE; $this->nodeName = "#document"; } /** * Returns an reference to the DocumentType object.<br> * DOM-Level 1 * * @public * @returns DocumentType */ function &getDoctype() { return $this->doctype; } /** * Returns an reference to the root element.<br> * DOM-Level 1 * * @public * @returns Element */ function &getDocumentElement() { return $this->documentElement; } /** * Returns an reference to the DOMImplementation object.<br> * DOM-Level 1 * * @public * @returns DOMImplementation */ function &getImplementation() { return $this->implementation; } /** * Creates an Attribute node.<br> * DOM-Level 1 * * @public * @param $name <code>string</code> * @param $value <code>string</code> * @returns Attr */ function &createAttribute($name) { $new = new Attr(); $new->nodeName = $name; $new->ownerElement = NULL; $new->ownerDocument =& $this; return $new; } /** * Creates a CDataSection node.<br> * DOM-Level 1 * * @public * @param $data * @returns CDataSection */ function &createCDataSection($data) { $new = new CDataSection(); $new->nodeValue = $data; $new->ownerDocument = &$this; return $new; } /** * Creates a Comment node.<br> * DOM-Level 1 * * @public * @param $data <code>string</code> * @returns Comment */ function &createComment($data) { $new = new Comment(); $new->nodeValue = $data; $new->ownerDocument = &$this; return $new; } /** * Creates a DocumentFragment node.<br> * DOM-Level 1 * * @public * @returns DocumentFragment */ function &createDocumentFragment() { $new = new DocumentFragment(); return $new; } /** * Creates an Element node.<br> * DOM-Level 1 * * @public * @param $tagName <code>string</code> * @returns Element */ function &createElement($tagName) { $new = new Element(); $new->nodeName = $tagName; $new->ownerDocument = &$this; return $new; } /** * Creates an EntityReference node (not supported yet)<br> * DOM-Level 1 * * @public * @param $name <code>string</code> * @returns EntityReference */ function &createEntityReference($name) { return NOT_SUPPORTED_ERR; } /** * Creates a ProcessingInstruction node.<br> * DOM-Level 1 * * @public * @param $target <code>string</code> * @param $data <code>string</code> * @returns ProcessingInstruction */ function &createProcessingInstruction($target, $data) { $new = new ProcessingInstruction(); $new->nodeValue = $data; $new->nodeName = $target; $new->ownerDocument = &$this; return $new; } /** * Creates a Text node.<br> * DOM-Level 1 * * @public * @param $data <code>string</code> * @returns Text */ function &createTextNode($data) { $new = new Text(); $new->nodeValue = $data; $new->ownerDocument = &$this; return $new; } /** * Returns a NodeList of Element nodes from the current document whose * tagName attribute matches the given tagname.<br> * DOM-Level 1 * * @public * @param $tagName <code>string</code> * @returns NodeList */ function &getElementsByTagName($tagName) { $result = new NodeList(); $this->getElementsByTagNameList($tagName, $this->documentElement, $result); return $result; } /** * Same as createAttribute, but includes support for XML namespaces.<br> * DOM-Level 2 * * @public * @param $namespaceURI <code>string</code> * @param $qualifiedName <code>string</code> * @returns Attr */ function &createAttributeNS($namespaceURI, $qualifiedName) { $prefix = substr($qualifiedName, 0, strpos($qualifiedName, ":")); $localName = substr($qualifiedName, strpos($this->nodeName, ":")+1); if (empty($prefix) || empty($localName)) { return NAMESPACE_ERR; } if (empty($namespaceURI)) { return NAMESPACE_ERR; } if (($namespaceURI != "http://www.w3.org/XML/1998/namespace") && ($prefix == "xml")) { return NAMESPACE_ERR; } if (($this->namespaceURI != "http://www.w3.org/2000/xmlns/") && ($prefix == "xmlns")) { return NAMESPACE_ERR; } if ($this->qualifiedName == "xmlns") { return NAMESPACE_ERR; } $newAttr =& $this->createAttribute($qualifiedName); $newAttr->namespaceURI = $namespaceURI; $newAttr->localName = $localName; $newAttr->prefix = $prefix; return $newAttr; } /** * Same as createElement, but includes support for XML namespaces.<br> * DOM-Level 2 * * @public * @param $namespaceURI <code>string</code> * @param $qualifiedName <code>string</code> * @returns Element */ function &createElementNS($namespaceURI, $qualifiedName) { $prefix = substr($qualifiedName, 0, strpos($qualifiedName, ":")); $localName = substr($qualifiedName, strpos($this->nodeName, ":")+1); if (empty($prefix) || empty($localName)) { return NAMESPACE_ERR; } if (empty($namespaceURI)) { return NAMESPACE_ERR; } if (($namespaceURI != "http://www.w3.org/XML/1998/namespace") && ($prefix == "xml")) { return NAMESPACE_ERR; } $newElem =& $this->createElement($qualifiedName); $newElem->namespaceURI = $namespaceURI; $newElem->localName = $localName; $newElem->prefix = $prefix; return $newElem; } /** * Returns a Element node from the current document whose id attribute * matches the given id.<br> * DOM-Level 2 -- NYI * * @public * @param $elementID <code>string</code> * @returns Element */ function &getElementById($elementID) { // This could not be implemented, as long as the DTD is not parsed. return NOT_SUPPORTED_ERR; } /** * Same as getElementByTagName, but includes support for XML namespaces.<br> * DOM-Level 2 * * @public * @param $namespaceURI <code>string</code> * @param $localName <code>string</code> * @returns NodeList */ function &getElementsByTagNameNS($namespaceURI, $localName) { $result = new NodeList(); $this->getElementsByTagNameNSList($namespaceURI, $localName, $this->documentElement, $result); return $result; } /** * Creates a copy of a Node object from another document that can be * inserted within the current documents node hierarchy.<br> * DOM-Level 2 * * @public * @param $importedNode <a href="Node.html">Node</a> * @param $deep <code>boolean</code> * @returns Node */ function &importNode(&$importedNode, $deep) { if ($importedNode->nodeType == ATTRIBUTE_NODE) { $newNode =& $importedNode->cloneNode(true); $newNode->ownerElement = NULL; $newNode->specified = true; } else { if (($importedNode->nodeType == ELEMENT_NODE) || ($importedNode->nodeType == DOCUMENT_FRAGMENT_NODE) || ($importedNode->nodeType == PROCESSING_INSTRUCTION_NODE) || ($importedNode->nodeType == TEXT_NODE) || ($importedNode->nodeType == CDATA_SECTION_NODE) || ($importedNode->nodeType == COMMENT_NODE)) { $newNode =& $importedNode->cloneNode($deep); } else { return NOT_SUPPORTED_ERR; } } $newNode->ownerDocument =& $this; return $newNode; } /** * Runs recursively through the DOM-Tree and returns a NodeList with all * Element nodes that have the searched tagname. * * @private * @param $tagName <code>string</code> * @param $parent <a href="Node.html">Node</a> * @param $result <a href="NodeList.html">NodeList</a> * @returns void */ function getElementsByTagNameList($tagName, &$parent, &$result) { if ($parent->nodeType == ELEMENT_NODE) { if (($parent->tagName == $tagName) || ($tagName == "*")) { $result->insertNode($parent); } if ($parent->hasChildNodes()) { $this->getElementsByTagNameList($tagName, $parent->firstChild, $result); } } if (isset($parent->nextSibling)) { $this->getElementsByTagNameList($tagName, $parent->nextSibling, $result); } } /** * Runs recursively through the DOM-Tree and returns a NodeList with all * Element nodes that have the searched $namespaceURI and $localName. * * @private * @param $namespaceURI <code>string</code> * @param $localName <code>string</code> * @param $parent <a href="Node.html">Node</a> * @param $result <a href="NodeList.html">NodeList</a> * @returns void */ function getElementsByTagNameNSList($namespaceURI, $localName, &$parent, &$result) { if ($parent->nodeType == ELEMENT_NODE) { if ((($parent->namespaceURI == $namespaceURI) && ($parent->localName == $localName)) || (($namespaceURI == "*") && ($parent->localName == $localName)) || (($parent->namespaceURI == $namespaceURI) && ($localName == "*")) || (($namespaceURI == "*") && ($localName == "*"))) { $result->insertNode($parent); } if ($parent->hasChildNodes()) { $this->getElementsByTagNameNSList($namespaceURI, $localName, $parent->firstChild, $result); } } if (isset($parent->nextSibling)) { $this->getElementsByTagNameNSList($namespaceURI, $localName, $parent->nextSibling, $result); } } } ?> --- NEW FILE: documentfragment.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: documentfragment.php,v 1.1 2002/01/26 17:10:44 thomi Exp $ /** * Class representing the DOM DocumentFragment interface. * * @package phpXD * @author Thomas Dohmke <th...@do...> * @version $Revision: 1.1 $ */ class DocumentFragment extends Node { /** * Constructor of the class. * * @public */ function DocumentFragment() { Node::Node(); $this->nodeType = DOCUMENT_FRAGMENT_NODE; $this->nodeName = "#document-fragment"; } } ?> --- NEW FILE: documenttype.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: documenttype.php,v 1.1 2002/01/26 17:10:44 thomi Exp $ /** * Class representing the DOM DocumentType interface. * * @package phpXD * @author Thomas Dohmke <th...@do...> * @version $Revision: 1.1 $ */ class DocumentType extends Node { /** * A list of all generall entities declared in the DTD.<br> * DOM-Level 1-- NYI * * @private * @type string */ var $entities; /** * The name of the DTD.<br> * DOM-Level 1 * * @private * @type string */ var $name; /** * Contains a list of XML notation declarations.<br> * DOM-Level 1 -- NYI * * @private * @type string */ var $notations; /** * Contains the documents internat subset as a string value.<br> * DOM-Level 2 * * @private * @type string */ var $internalSubset; /** * The public identifier of the external subset.<br> * DOM-Level 2 * * @private * @type string */ var $publicId; /** * The system identifier of the external subset.<br> * DOM-Level 2 * * @private * @type string */ var $systemId; /** * Constructor of the class.<br> * * @public */ function DocumentType() { Node::Node(); $this->nodeType = DOCUMENT_TYPE_NODE; $this->name =& $this->nodeName; //$notation = new NamedNodeMap(); //$entities = new NamedNodeMap(); } /** * Returns a NamedNodeMap containing all general entities declared in the * DTD.<br> * DOM-Level 1 -- NYI * * @public * @returns NamedNodeMap */ function getEntities() { return NOT_SUPPORTED_ERR; } /** * Returns the internal subset.<br> * DOM-Level 2 * * @public * @returns string */ function getInternalSubset() { return $this->internalSubset; } /** * Returns the name of the DTD.<br> * DOM-Level 1 * * @public * @returns string */ function getName() { return $this->name; } /** * Returns a NamedNodeMap containing all notations declared in the * DTD.<br> * DOM-Level 1 -- NYI * * @public * @returns NamedNodeMap */ function getNotations() { return NOT_SUPPORTED_ERR; } /** * Returns the public identifier of an external subset.<br> * DOM-Level 2 * * @public * @returns string */ function getPublicId() { return $this->publicId; } /** * Returns the system identifier of an external subset.<br> * DOM-Level 2 * * @public * @returns string */ function getSystemId() { return $this->systemId; } } ?> --- NEW FILE: domexception.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: domexception.php,v 1.1 2002/01/26 17:10:44 thomi Exp $ /** * Because PHP4 doesn't support exceptions, only the ExceptionCodes are * defined. The Functions which normally would like to raise a exception, * returns one of this ExceptionCodes. * Currently not all ExceptionsCodes are used, only NOT_SUPPORTED_ERR is * really often returned. ;=) */ /** * If index or size is negative, or greater than the allowed value.<br> * DOM-Level 1 * * @const INDEX_SIZE_ERR */ define("INDEX_SIZE_ERR", 1); /** * If the specified range of text does not fit into a DOMString.<br> * DOM-Level 1 * * @const DOMSTRING_SIZE_ERR */ define("DOMSTRING_SIZE_ERR", 2); /** * If any node is inserted somewhere it doesn't belong.<br> * DOM-Level 1 * * @const HIERARCHY_REQUEST_ERR */ define("HIERARCHY_REQUEST_ERR", 3); /** * If a node is used in a different document than the one * that created it (that doesn't support it).<br> * DOM-Level 1 * * @const WRONG_DOCUMENT_ERR */ define("WRONG_DOCUMENT_ERR", 4); /** * If an invalid or illegal character is specified, such as in a name. <br> * DOM-Level 1 * * @const INVALID_CHARACTER_ERR */ define("INVALID_CHARACTER_ERR", 5); /** * If data is specified for a node which does not support data.<br> * DOM-Level 1 * * @const NO_DATA_ALLOWED_ERR */ define("NO_DATA_ALLOWED_ERR", 6); /** * If an attempt is made to modify an object where modifications * are not allowed.<br> * DOM-Level 1 * * @const NO_MODIFICATION_ALLOWED_ERR */ define("NO_MODIFICATION_ALLOWED_ERR", 7); /** * If an attempt is made to reference a node in a context where * it does not exist.<br> * DOM-Level 1 * * @const NOT_FOUND_ERR */ define("NOT_FOUND_ERR", 8); /** * If the implementation does not support the requested type of object * or operation.<br> * DOM-Level 1 * * @const NOT_SUPPORTED_ERR */ define("NOT_SUPPORTED_ERR", 9); /** * If an attempt is made to add an attribute that is already in * use elsewhere.<br> * DOM-Level 1 * * @const INUSE_ATTRIBUTE_ERR */ define("INUSE_ATTRIBUTE_ERR", 10); /** * If an attempt is made to use an object that is not, or is no * longer, usable.<br> * DOM-Level 2 * * @const INVALID_STATE_ERR */ define("INVALID_STATE_ERR", 11); /** * If an invalid or illegal string is specified.<br> * DOM-Level 2 * * @const SYNTAX_ERR */ define("SYNTAX_ERR", 12); /** * If an attempt is made to modify the type of the underlying object.<br> * DOM-Level 2 * * @const INVALID_MODIFICATION_ERR */ define("INVALID_MODIFICATION_ERR", 13); /** * If an attempt is made to create or change an object in a way which * is incorrect with regard to namespaces.<br> * DOM-Level 2 * * @const NAMESPACE_ERR */ define("NAMESPACE_ERR", 14); /** * If a parameter or an operation is not supported by the underlying object.<br> * DOM-Level 2 * * @const INVALID_ACCESS_ERR */ define("INVALID_ACCESS_ERR", 15); ?> --- NEW FILE: domimplementation.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: domimplementation.php,v 1.1 2002/01/26 17:10:44 thomi Exp $ /** * Class representing the DOM DOMImplementation interface. * * @package phpXD * @author Thomas Dohmke <th...@do...> * @version $Revision: 1.1 $ */ class DOMImplementation { /** * Tests to see if the DOM implementation supports a given named feature * package.<br> * DOM-Level 1 * * @public * @param $feature <code>string</code> * @param $version <code>string</code> * @returns boolean */ function hasFeature($feature, $version) { if (($feature == "XML") || ($feature == "Core")) { if ($version == "1.0") { return true; } } return false; } /** * Creates a new, empty Document with the given document type.<br> * DOM-Level 2 * * @public * @param $namespaceURI <code>string</code> * @param $qualifiedName <code>string</code> * @param $doctype <a href="DocumentType.html">DocumentType</a> * @returns Document */ function &createDocument($namespaceURI, $qualifiedName, &$doctype) { if (!(strpos($qualifiedName, ":") === false)) { $prefix = substr($qualifiedName, 0, strpos($qualifiedName, ":")); $localName = substr($qualifiedName, strpos($this->nodeName, ":")+1); if (empty($prefix) || empty($localName)) { return NAMESPACE_ERR; } } else { if (empty($qualifiedName)) { return NAMESPACE_ERR; } } if (empty($namespaceURI)) { return NAMESPACE_ERR; } if (($namespaceURI != "http://www.w3.org/XML/1998/namespace") && ($prefix == "xml")) { return NAMESPACE_ERR; } if (!empty($doctype->ownerDocument)) { return WRONG_DOCUMENT_ERR; } $doc = new Document(); $doc->doctype =& $doctype; $doc->doctype->ownerDocument =& $this; $doc->doctype->namespaceURI = $namespaceURI; $doc->namespaceURI = $namespaceURI; $doc->prefix = $prefix; $doc->localName = $localName; return $doc; } /** * Creates an empty DocumentType node that is not associated with any * document.<br> * DOM-Level 2 * * @public * @param $qualifiedName <code>string</code> * @param $publicId <code>string</code> * @param $systemId <code>string</code> * @returns DocumentType */ function createDocumentType($qualifiedName, $publicId, $systemId) { if (!(strpos($qualifiedName, ":") === false)) { $prefix = substr($qualifiedName, 0, strpos($qualifiedName, ":")); $localName = substr($qualifiedName, strpos($this->nodeName, ":")+1); if (empty($prefix) || empty($localName)) { return NAMESPACE_ERR; } } else { if (empty($qualifiedName)) { return NAMESPACE_ERR; } } $dtd = new DocumentType(); $dtd->publicId = $publicId; $dtd->systemId = $systemId; $dtd->nodeName = $qualifiedName; $dtd->prefix = $prefix; $dtd->localName = $localName; return $dtd; } } ?> --- NEW FILE: element.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: element.php,v 1.1 2002/01/26 17:10:44 thomi Exp $ /** * Class representing the DOM Element interface. * * @package phpXD * @author Thomas Dohmke <th...@do...> * @version $Revision: 1.1 $ */ class Element extends Node { /** * The XML tag name.<br> * DOM-Level 1 * * @private * @type string */ var $tagName; /** * Constructor of the class. * * @public */ function Element() { $this->Node(); $this->nodeType = ELEMENT_NODE; $this->tagName =& $this->nodeName; } /** * Returns the XML tag name of the element.<br> * DOM-Level 1 * * @public * @returns string */ function getTagName() { return $this->tagName; } /** * Returns the value of the attribute specified by the name parameter.<br> * DOM-Level 1 * * @public * @param $name <code>string</code> * @returns string */ function getAttribute($name) { $attr =& $this->getAttributeNode($name); if ($attr != null) { return $attr->getValue(); } else { return ""; } } /** * Returns the attribute specified by the name parameter.<br> * DOM-Level 1 * * @public * @param $name <code>string</code> * @returns Attr */ function &getAttributeNode($name) { if (isset($this->attributes)) { return $this->attributes->getNamedItem($name); } } /** * Returns a NodeList of all child Element nodes whose tagName attribute * matches the give name parameter.<br> * DOM-Level 1 * * @public * @param $name <code>string</code> * @returns NodeList */ function &getElementsByTagName($name) { $result = new NodeList(); $this->getElementsByTagNameList($name, $this->firstChild, $result); return $result; } /** * Removes the Attribute node specified by name.<br> * DOM-Level 1 * * @public * @param $name <code>string</code> * @returns void */ function removeAttribute($name) { if (isset($this->attributes)) { $this->attributes->removeNamedItem($name); } } /** * Removes the specified Attribute node.<br> * DOM-Level 1 * * @public * @param $oldAttr <a href="Attr.html">Attr</a> * @returns Attr */ function &removeAttributeNode(&$oldAttr) { if (isset($this->attributes)) { return $this->attributes->removeNamedItem($oldAttr->nodeName); } } /** * Set the Attribute name to the value. If the node does not exist, it is * created.<br> * DOM-Level 1 * * @public * @param $name string * @param $value string * @returns void */ function setAttribute($name, $value) { $new = new Attr(); $new->nodeName = $name; $new->setValue($value); $new->ownerElement = &$this; $new->ownerDocument = &$this->ownerDocument; if (empty($this->attributes)) { $this->attributes = new NamedNodeMap(); } $this->attributes->setNamedItem($new); } /** * Sets the specified Attribute node.<br> * DOM-Level 1 * * @public * @param $newAttr <a href="Attr.html">Attr</a> * @returns Attr */ function &setAttributeNode(&$newAttr) { if (empty($this->attributes)) { $this->attributes = new NamedNodeMap(); } return $this->attributes->setNamedItem($newAttr); } /** * Same as getAttribute, but includes support for XML namespaces.<br> * DOM-Level 2 * * @public * @param $namespaceURI <code>string</code> * @param $localName <code>string</code> * @returns string */ function getAttributeNS($namespaceURI, $localName) { if (isset($this->attributes)) { $attr =& $this->attributes->getNamedItemNS($namespaceURI, $localName); return $attr->getValue(); } } /** * Same as getAttributeNode, but includes support for XML namespaces.<br> * DOM-Level 2 * * @public * @param $namespaceURI <code>string</code> * @param $localName <code>string</code> * @returns Attr */ function &getAttributeNodeNS($namespaceURI, $localName) { if (isset($this->attributes)) { return $this->attributes->getNamedItemNS($namespaceURI, $localName); } } /** * Same as getElementsByTagName, but includes support for XML namespaces.<br> * DOM-Level 2 * * @public * @param $namespaceURI <code>string</code> * @param $localName <code>string</code> * @returns NodeList */ function &getElementsByTagNameNS($namespaceURI, $localName) { $result = new NodeList(); $this->getElementsByTagNameNSList($namespaceURI, $localName, $this->firstChild, $result); return $result; } /** * Returns true when an attribute with a given name is specified on this * element or has a default value, false otherwise. <br> * DOM-Level 2 * * @public * @param $name <code>string</code> * @returns boolean */ function hasAttribute($name) { if (empty($this->attributes)) { return false; } $attr =& $this->attributes->getNamedItem($name); if (!empty($attr)) { return true; } return false; } /** * Same as hasAttribute, but includes support for XML namespaces.<br> * DOM-Level 2 * * @public * @param $namespaceURI <code>string</code> * @param $localName <code>string</code> * @returns boolean */ function hasAttributeNS($namespaceURI, $localName) { if (empty($this->attributes)) { return false; } $attr =& $this->attributes->getNamedItemNS($namespaceURI, $localName); if (!empty($attr)) { return true; } return false; } /** * Same as removeAttribute, but includes support for XML namespaces.<br> * DOM-Level 2 * * @public * @param $namespaceURI <code>string</code> * @param $localName <code>string</code> * @returns void */ function removeAttributeNS($namespaceURI, $localName) { if (isset($this->attributes)) { $this->attributes->removeNamedItemNS($namespaceURI, $localName); } } /** * Same as setAttribute, but includes support for XML namespaces.<br> * DOM-Level 2 * * @public * @param $namespaceURI <code>string</code> * @param $localName <code>string</code> * @returns void */ function setAttributeNS($namespaceURI, $qualifiedName, $value) { $prefix = substr($qualifiedName, 0, strpos($qualifiedName, ":")); $localName = substr($qualifiedName, strpos($this->nodeName, ":")+1); if (empty($prefix) || empty($localName)) { return NAMESPACE_ERR; } if (empty($namespaceURI)) { return NAMESPACE_ERR; } if (($namespaceURI != "http://www.w3.org/XML/1998/namespace") && ($prefix == "xml")) { return NAMESPACE_ERR; } if (($this->namespaceURI != "http://www.w3.org/2000/xmlns/") && ($prefix == "xmlns")) { return NAMESPACE_ERR; } if ($this->qualifiedName == "xmlns") { return NAMESPACE_ERR; } $new = new Attr(); $new->nodeName = $qualifiedName; $new->prefix = $prefix; $new->localName = $localName; $new->setValue($value); $new->ownerElement = &$this; $new->ownerDocument = &$this->ownerDocument; if (empty($this->attributes)) { $this->attributes = new NamedNodeMap(); } $this->attributes->setNamedItemNS($new); } /** * Same as setAttributeNode, but includes support for XML namespaces.<br> * DOM-Level 2 * * @public * @param $newAttr <a href="Attr.html">Attr</a> * @returns Attr */ function setAttributeNodeNS(&$newAttr) { if (empty($this->attributes)) { $this->attributes = new NamedNodeMap(); } return $this->attributes->setNamedItemNS($newAttr); } /** * Runs recursively through the DOM-Tree and returns a NodeList with all * Element nodes that have the searched tagname. * * @private * @param $tagName <code>string</code> * @param $parent <a href="Node.html">Node</a> * @param $result <a href="NodeList.html">NodeList</a> * @returns void */ function getElementsByTagNameList($tagName, &$parent, &$result) { if ($parent->nodeType == ELEMENT_NODE) { if (($parent->tagName == $tagName) || ($tagName == "*")) { $result->insertNode($parent); } if ($parent->hasChildNodes()) { $this->getElementsByTagNameList($tagName, $parent->firstChild, $result); } } if (isset($parent->nextSibling)) { $this->getElementsByTagNameList($tagName, $parent->nextSibling, $result); } } /** * Runs recursively through the DOM-Tree and returns a NodeList with all * Element nodes that have the searched $namespaceURI and $localName. * * @private * @param $namespaceURI <code>string</code> * @param $localName <code>string</code> * @param $parent <a href="Node.html">Node</a> * @param $result <a href="NodeList.html">NodeList</a> * @returns void */ function getElementsByTagNameNSList($namespaceURI, $localName, &$parent, &$result) { if ($parent->nodeType == ELEMENT_NODE) { if ((($parent->namespaceURI == $namespaceURI) && ($parent->localName == $localName)) || (($namespaceURI == "*") && ($parent->localName == $localName)) || (($parent->namespaceURI == $namespaceURI) && ($localName == "*")) || (($namespaceURI == "*") && ($localName == "*"))) { $result->insertNode($parent); } if ($parent->hasChildNodes()) { $this->getElementsByTagNameNSList($namespaceURI, $localName, $parent->firstChild, $result); } } if (isset($parent->nextSibling)) { $this->getElementsByTagNameNSList($namespaceURI, $localName, $parent->nextSibling, $result); } } } ?> --- NEW FILE: entity.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: entity.php,v 1.1 2002/01/26 17:10:44 thomi Exp $ /** * Class representing the DOM Entity interface. Not supported yet. * * @package phpXD * @author Thomas Dohmke <th...@do...> * @version $Revision: 1.1 $ */ class Entity extends Node { // Sorry, not supported yet! } ?> --- NEW FILE: entityreference.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: entityreference.php,v 1.1 2002/01/26 17:10:44 thomi Exp $ /** * Class representing the DOM EntityReference interface. Not supported yet. * * @package phpXD * @author Thomas Dohmke <th...@do...> * @version $Revision: 1.1 $ */ class EntityReference extends Node { // Sorry, not supported yet. } ?> --- NEW FILE: namednodemap.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: namednodemap.php,v 1.1 2002/01/26 17:10:44 thomi Exp $ /** * Class representing the DOM NamedNodeMap interface * * @package phpXD * @author Thomas Dohmke <th...@do...> * @version $Revision: 1.1 $ */ class NamedNodeMap { /** * Contains all items of tbe NamedNodeMap.<br> * * @private * @type array */ var $nodes; /** * The number of nodes in this map.<br> * DOM-Level 1 * * @private * @type int */ var $length = 0; /** * Returns the number of nodes in the map.<br> * DOM-Level 1 * * @public * @returns int */ function getLength() { return $this->length; } /** * Retrieves a node specified by name<br> * DOM-Level 1 * * @public * @param $name <code>string</code> * @returns Node */ function &getNamedItem($name) { return $this->nodes[$name]; } /** * Returns the indexth item in this map.<br> * DOM-Level 1 * * @public * @param $index <code>int</code> * @returns Node */ function &item($index) { $count = 0; reset($this->nodes); while (list($key, $value) = each($this->nodes)) { if ($count == $index) { return $this->nodes[$key]; } $count++; } return null; } /** * Removes a node specified by name.<br> * DOM-Level 1 * * @public * @param $name <code>string</code> * @returns Node */ function &removeNamedItem($name) { if (isset($this->nodes[$name])) { $removed =& $this->nodes[$name]; unset($this->nodes[$name]); $this->length--; return $removed; } else { return NOT_FOUND_ERR; } } /** * Adds a node using its nodeName attribute.<br> * DOM-Level 1 * * @public * @param $arg <a href="Node.html">Node</a> * @returns Node */ function &setNamedItem(&$arg) { if (!isset($this->nodes[$arg->nodeName])) { $this->length++; $save = null; } else { $save =& $this->nodes[$arg->nodeName]; } $this->nodes[$arg->nodeName] =& $arg; return $save; } /** * Retrieves a node specified by local name and namespace URI.<br> * DOM-Level 2 * * @public * @param $namespaceURI <code>string</code> * @param $localName <code>string</code> * @returns Node */ function &getNamedItemNS($namespaceURI, $localName) { return $this->getNamedItem($namespaceURI.":".$localName); } /** * Removes a node specified by local name and namespace URI.<br> * DOM-Level 2 * * @public * @param $namespaceURI <code>string</code> * @param $localName <code>string</code> * @returns Node */ function &removeNamedItemNS($namespaceURI, $localName) { return $this->removeNamedItem($namespaceURI.":".$localName); } /** * Adds a node using its $namespaceURI and $localName<br> * DOM-Level 2 * * @public * @param $arg <a href="Node.html">Node</a> * @returns Node */ function &setNamedItemNS(&$arg) { if (!isset($this->nodes[$arg->namespaceURI.":".$arg->localName])) { $this->length++; $save = null; } else { $save =& $this->nodes[$arg->namespaceURI.":".$arg->localName]; } $this->nodes[$arg->namespaceURI.":".$arg->localName] =& $arg; return $save; } } ?> --- NEW FILE: node.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: node.php,v 1.1 2002/01/26 17:10:44 thomi Exp $ /** * @const ELEMENT_NODE */ define("ELEMENT_NODE", 1); /** * @const ATTRIBUTE_NODE */ define("ATTRIBUTE_NODE", 2); /** * @const TEXT_NODE */ define("TEXT_NODE", 3); /** * @const CDATA_SECTION_NODE */ define("CDATA_SECTION_NODE", 4); /** * @const ENTITY_REFERENCE_NODE */ define("ENTITY_REFERENCE_NODE", 5); /** * @const ENTITY_NODE */ define("ENTITY_NODE", 6); /** * @const PROCESSING_INSTRUCTION_NODE */ define("PROCESSING_INSTRUCTION_NODE", 7); /** * @const COMMENT_NODE */ define("COMMENT_NODE", 8); /** * @const DOCUMENT_NODE */ define("DOCUMENT_NODE", 9); /** * @const DOCUMENT_TYPE_NODE */ define("DOCUMENT_TYPE_NODE", 10); /** * @const DOCUMENT_FRAGMENT_NODE */ define("DOCUMENT_FRAGMENT_NODE", 11); /** * @const NOTATION_NODE */ define("NOTATION_NODE", 12); /** * Class representing the DOM Node interface * * @package phpXD * @author Thomas Dohmke <th...@do...> * @version $Revision: 1.1 $ */ class Node { /** * MD5-Hash to compare two nodes. * * This ID is necessary to compare two nodes, because the operator == * is not implemented for objects/references in PHP4. * * @private * @type string */ var $nodeID; /** * Provides access to a list of Attr objects in a NamedNodeMap.<br> * DOM-Level 1 * * @private * @type NamedNodeMap */ var $attributes; /** * A NodeList containing a reference to every child in this Node.<br> * DOM-Level 1 * * @private * @type NodeList */ var $childNodes; /** * Points to the head of the linked list of children in this node.<br> * DOM-Level 1 * * @private * @type Node */ var $firstChild; /** * Points to the end of the linked list of children in the node.<br> * DOM-Level 1 * * @private * @type Node */ var $lastChild; /** * Points to the next Node in the siblings list.<br> * DOM-Level 1 * * @private * @type Node */ var $nextSibling; /** * Depending on the object type (nodeType), this attribute may map to * another attribute of the object or a constant string.<br> * DOM-Level 1 * * @private * @type string */ var $nodeName; /** * Contains a value that indicates the true type of the Node.<br> * DOM-Level 1 * * @private * @type int */ var $nodeType; /** * Depending on the nodeType, this attribute contains null or the * content/value of the node.<br> * DOM-Level 1 * * @private * @type string */ var $nodeValue; /** * Points to the Document used to create this Node object.<br> * DOM-Level 1 * * @private * @type Document */ var $ownerDocument; /** * Points to the parent of this node.<br> * DOM-Level 1 * * @private * @type Node */ var $parentNode; /** * Points to the previous Node in the siblings list.<br> * DOM-Level 1 * * @private * @type Node */ var $previousSibling; /** * Contains the local part of the fully qualified node name.<br> * DOM-Level 2 * * @private * @type string */ var $localName; /** * The namespace URI given to this Node object at creation time, null * if no namespace was given.<br> * DOM-Level 2 * * @private * @type string */ var $namespaceURI; /** * The namespace prefix of this Node, used for nodes that support namespace * prefixes.<br> * DOM-Level 2 * * @private * @type string */ var $prefix; /** * Constructor of the class. * * @public */ function Node() { $this->nodeID = microtime()." ".rand(); } /** * Provides access to a list of Attr objects in a NamedNodeMap.<br> * DOM-Level 1 * * @public * @returns NamedNodeMap */ function &getAttributes() { return $this->attributes; } /** * Returns a NodeList containing a reference to every child in this Node.<br> * DOM-Level 1 * * @public * @returns NodeList */ function &getChildNodes() { return $this->childNodes; } /** * Returns a reference to the head of the linked list of children * in this node.<br> * DOM-Level 1 * * @public * @returns Node */ function &getFirstChild() { return $this->firstChild; } /** * Returns a reference to the end of the linked list of children * in this node.<br> * DOM-Level 1 * * @public * @returns Node */ function &getLastChild() { return $this->lastChild; } /** * Returns a reference to the next node in the siblings list.<br> * DOM-Level 1 * * @public * @returns Node */ function &getNextSibling() { return $this->nextSibling; } /** * Returns the name of the node or null if the node has no name.<br> * DOM-Level 1 * * @public * @returns string */ function getNodeName() { return $this->nodeName; } /** * Returns the type of the node.<br> * DOM-Level 1 * * @public * @returns int */ function getNodeType() { return $this->nodeType; } /** * Returns the value of the node or null if the node has no value.<br> * DOM-Level 1 * * @public * @returns string */ function getNodeValue() { return $this->nodeValue; } /** * Sets the value of this node.<br> * DOM-Level 1 * * @public * @param $nodeValue <code>string</code> * @returns void */ function setNodeValue($nodeValue) { if (($this->nodeType == ELEMENT_NODE) || ($this->nodeType == ENTITY_REFERENCE_NODE) || ($this->nodeType == ENTITY_NODE) || ($this->nodeType == DOCUMENT_NODE) || ($this->nodeType == DOCUMENT_TYPE_NODE) || ($this->nodeType == DOCUMENT_FRAGMENT_NODE) || ($this->nodeType == NOTATION)) { return NO_MODIFICATION_ALLOWED_ERR; } $this->nodeValue = $nodeValue; return null; } /** * Returns a reference to the Document used to create this node.<br> * DOM-Level 1 * * @public * @returns Document */ function &getOwnerDocument() { return $this->ownerDocument; } /** * Returns the parent of this node.<br> * DOM-Level 1 * * @public * @returns Node */ function &getParentNode() { return $this->parentNode; } /** * Returns the previous node in the siblings list.<br> * DOM-Level 1 * * @public * @returns Node */ function &getPreviousSibling() { return $this->previousSibling; } /** * Appends the $newChild node to the end of the child list if the node is * a permitted child of this node.<br> * DOM-Level 1 * * @public * @param $newChild <a href="Node.html">Node</a> * @returns Node */ function &appendChild(&$newChild) { if (($newChild->nodeType == DOCUMENT_FRAGMENT_NODE) && ($this->nodeType != DOCUMENT_FRAGMENT_NODE)) { for ($i = 0; $i < $newChild->childNodes->getLength(); $i++) { $save = &$this->appendChild($newChild->childNodes->item($i)); } return $save; } $check = $this->checkHierarchy($newChild); if ($check > 0) { return $check; } $check = $this->checkDocument($newChild); if ($check > 0) { return $check; } if (isset($newChild->parentNode)) { $result = $newChild->parentNode->removeChild($newChild); } $newChild->parentNode = &$this; $newChild->ownerDocument = &$this->ownerDocument; unset($newChild->nextSibling); unset($newChild->previousSibling); if (!isset($this->firstChild)) { $this->firstChild = &$newChild; $this->lastChild = &$newChild; $this->childNodes = new NodeList(); } else { $this->lastChild->nextSibling = &$newChild; $newChild->previousSibling = &$this->lastChild; $this->lastChild = &$newChild; } $this->childNodes->insertNode($newChild); return $newChild; } /** * Returns a copy of the node without the parent node; If $deep is true, * all children are also copied.<br> * DOM-Level 1 * * @public * @param $deep <code>boolean</code> * @returns Node */ function &cloneNode($deep) { $clone = $this; $clone->Node(); unset($clone->attributes); unset($clone->childNodes); unset($clone->firstChild); unset($clone->lastChild); unset($clone->nextSibling); unset($clone->parentNode); unset($clone->previousSibling); if (isset($this->attributes)) { $clone->attributes = new NamedNodeMap(); unset($oldAttr); for ($i = 0; $i < $this->attributes->getLength(); $i++) { $attr =& $this->attributes->item($i); $newAttr[$i] =& $attr->cloneNode(true); $newAttr[$i]->specified = true; if (!isset($oldAttr)) { $clone->firstAttr = &$newAttr[$i]; } else { $oldAttr->nextSibling = &$newAttr[$i]; $newAttr[$i]->previousSibling = &$oldAttr; } $clone->attributes->setNamedItem($newAttr[$i]); $oldAttr = &$newAttr[$i]; } $clone->lastAttr = &$oldAttr; } if ($deep) { if (isset($this->childNodes)) { $clone->childNodes = new NodeList(); $oldChild = null; for ($i = 0; $i < $this->childNodes->getLength(); $i++) { $child =& $this->childNodes->item($i); $newChild[$i] =& $child->cloneNode($deep); if (!isset($oldChild)) { $clone->firstChild = &$newChild[$i]; } else { $oldChild->nextSibling = &$newChild[$i]; $newChild[$i]->previousSibling = &$oldChild; } $clone->childNodes->insertNode($newChild[$i]); $oldChild = &$newChild[$i]; } $clone->lastChild = &$oldChild; } } return $clone; } /** * This method provides a quick way to check if a node has children.<br> * DOM-Level 1 * * @public * @returns boolean */ function hasChildNodes() { if (isset($this->firstChild)) { return true; } return false; } /** * Inserts the Node object $newChild into the child list of the parent node; * The $refChild parameter allows you to specify where to insert the new * node; If $refChild is null, newChild is inserted at the end of the child * list; If $newChild is linked into the document tree, it is removed before * it is inserted in its new position.<br> * DOM-Level 1 * * @public * @param $newChild <a href="Node.html">Node</a> * @param $refChild <a href="Node.html">Node</a> * @returns Node */ function &insertBefore(&$newChild, &$refChild) { if (($newChild->nodeType == DOCUMENT_FRAGMENT_NODE) && ($this->nodeType != DOCUMENT_FRAGMENT_NODE)) { for ($i = 0; $i < $newChild->childNodes->getLength(); $i++) { $save = &$this->insertBefore($newChild->childNodes->item($i), $refChild); } return $save; } $check = $this->checkHierarchy($newChild); if ($check > 0) { return $check; } $check = $this->checkDocument($newChild); if ($check > 0) { return $check; } if (isset($newChild->parentNode)) { $result = $newChild->parentNode->removeChild($newChild); } $newChild->parentNode = &$this; $newChild->ownerDocument = &$this->ownerDocument; unset($newChild->nextSibling); unset($newChild->previousSibling); if (isset($this->childNodes)) { for ($i = 0; $i < $this->childNodes->getLength(); $i++) { $child =& $this->childNodes->item($i); if ($child->nodeID == $refChild->nodeID && !$inserted) { if ($i > 0) { $prevChild = &$this->childNodes->item($i-1); $prevChild->nextSibling = &$newChild; $newChild->previousSibling = &$prevChild; } else { $this->firstChild = &$newChild; } $newChild->nextSibling = &$child; $child->previousSibling = &$newChild; $this->childNodes->insertNode($newChild, $i); return $newChild; } } } else { $this->firstChild = &$newChild; $this->lastChild = &$this->firstChild; $this->childNodes = new NodeList(); $this->childNodes->insertNode($newChild); return $newChild; } if (!isset($refChild)) { $this->lastChild->nextSibling = &$newChild; $newChild->previousSibling = &$this->lastChild; $this->lastChild = &$newChild; $this->childNodes->insertNode($newChild); return $newChild; } else { return NOT_FOUND_ERR; } } /** * Unlinks the $oldChild node from the child list.<br> * DOM-Level 1 * * @public * @param $oldChild <a href="Node.html">Node</a> * @returns Node */ function &removeChild($oldChild) { if (isset($this->childNodes)) { for ($i = 0; $i < $this->childNodes->getLength(); $i++) { $child =& $this->childNodes->item($i); if ($child->nodeID == $oldChild->nodeID) { if ($i > 0) { $prevChild = &$this->childNodes->item($i-1); $prevChild->nextSibling = &$child->nextSibling; if (isset($child->nextSibling)) { $child->nextSibling->previousSibling = &$prevChild; } else { $this->lastChild = &$prevChild; } } else { $this->firstChild = &$child->nextSibling; } $removedNode = &$this->childNodes->nodes[$i]; $this->childNodes->removeNode($i); return $removedNode; } } } return NOT_FOUND_ERR; } /** * Replaces the child node $oldChild with $newChild; If $newChild is linked * into the document tree, it is removed before the replace is performed.<br> * DOM-Level 1 * * @public * @param $newChild <a href="Node.html">Node</a> * @param $oldChild <a href="Node.html">Node</a> * @returns Node */ function &replaceChild($newChild, $oldChild) { if (($newChild->nodeType == DOCUMENT_FRAGMENT_NODE) && ($this->nodeType != DOCUMENT_FRAGMENT_NODE)) { for ($i = 0; $i < $newChild->childNodes->getLength(); $i++) { $save = &$this->insertBefore($newChild->childNodes->item($i), $oldChild); } return $this->removeChild($oldChild); } $check = $this->checkHierarchy($newChild); if ($check > 0) { return $check; } $check = $this->checkDocument($newChild); if ($check > 0) { return $check; } if (isset($newChild->parentNode)) { $result = $newChild->parentNode->removeChild($newChild); } $newChild->parentNode = &$this; $newChild->ownerDocument = &$this->ownerDocument; if (isset($this->childNodes)) { for ($i = 0; $i < $this->childNodes->getLength(); $i++) { $child =& $this->childNodes->item($i); if ($child->nodeID == $oldChild->nodeID) { if ($i > 0) { $prevChild = &$this->childNodes->item($i-1); $prevChild->nextSibling = &$newChild; } else { $this->firstChild = &$newChild; } $newChild->nextSibling = &$child->nextSibling; $newChild->previousSibling = &$child->previousSibling; if (isset($newChild->nextSibling)) { $newChild->nextSibling->previousSibling = &$newChild; } else { $this->lastChild = &$newChild; } $this->childNodes->replaceNode($newChild, $i); return $oldChild; } } } return NOT_FOUND_ERR; } /** * Returns the local part of the fully qualified node name.<br> * DOM-Level 2 * * @public * @returns string */ function getLocalName() { return $this->localName;... [truncated message content] |
From: Thomas D. <th...@us...> - 2002-01-26 17:10:48
|
Update of /cvsroot/phpxd/phpXD.www/stylesheets In directory usw-pr-cvs1:/tmp/cvs-serv21133/stylesheets Added Files: netscape.css print.css screen.css Log Message: Initial checkin of the phpxd homepage. --- NEW FILE: netscape.css --- /* ******************************************************************* thomas.dohmke.de - Cascading StyleSheet media: screen for Netscape4 ******************************************************************* author: Thomas Dohmke last modified: 21/12/2001 ******************************************************************* */ --- NEW FILE: print.css --- /* ******************************************************************* thomas.dohmke.de - Cascading StyleSheet media: print ******************************************************************* author: Thomas Dohmke last modified: 26/02/2001 ******************************************************************* */ body { background: #ffffff; color: #000000; font-family: sans-serif; font-size: 1em; margin: 0cm; padding: 0cm; } h1 { margin-top: 0cm; } p { font-family: sans-serif; margin-top: 0px; } img { border: none; } .dokument { background: #ffffff; color: #000000; height: 1em; position: relative; top: 0px; } .content { margin: 0cm; padding: 0cm; position: relative; top: 0px; z-index: 1; } .navbar { display: none; } .topbar { display: none; } .bottombar { display: none; } table { margin-bottom: 1em; } --- NEW FILE: screen.css --- /* ******************************************************************* thomas.dohmke.de - Cascading StyleSheet media: screen, projection ******************************************************************* author: Thomas Dohmke last modified: 06/11/2001 ******************************************************************* */ body { background: #ffffff; color: #000000; font-family: sans-serif; font-size: 1em; margin: 1em; padding: 0px; } a:link { background: none transparent; color: #0000ff; text-decoration: underline; } a:visited { background: none transparent; color: #990099; text-decoration: underline; } a:hover { background: none transparent; color: #ff0000; text-decoration: underline; } a:active { background: none transparent; color: #ff00ff; text-decoration: underline; } h1 { background: #ffffee; color: #000000; font-size: 1.5em; margin-top: 0px; } h1.hidden { background: #ffffff; color: #000000; display: none; font-size: 0.1em; margin: 0em; padding: 0em; visibility: hidden; } h2 { background: #ffffee; color: #000000; font-size: 1.25em; } h3 { background: #ffffee; color: #000000; font-size: 1em; } h2.navbar { background: #eeeeff; color: #000000; font-size: 0.9em; margin: 0em; padding: 0em; } p { background: #ffffee; color: #000000; margin-top: 0em; } ul { background: #ffffee; color: #000000; margin-top: 0px; margin-bottom: 0px; padding-bottom: 1em; } dd { padding-bottom: 1em; } img { background: #ffffee; color: #000000; border: none; margin: 5px; position: relative; z-index: 0; } .dokument { bottom: 0px; color: #000000; margin: 0px; padding: 0px; position: relative; right: 0px; width: 100%; z-index: 10; } div.content { background: #ffffee; border-top: 2px solid #ffcc00; border-bottom: 2px solid #ffcc00; color: #000000; margin: 0px; margin-left: 10em; padding-left: 5px; padding-right: 5px; padding-top: 10px; padding-bottom: 12px; position: relative; z-index: 10; } div.standalone { background: #ffffee; border-top: 2px solid #ffcc00; border-bottom: 2px solid #ffcc00; color: #000000; margin: 0px; padding-left: 5px; padding-right: 5px; padding-top: 10px; padding-bottom: 12px; position: relative; z-index: 10; } div.navbar { background: #eeeeff; border-top: 2px solid #6666ff; border-bottom: 2px solid #6666ff; color: #000000; left: 0px; margin: 0px; padding-bottom: 1em; padding-top: 0.6em; position: absolute; top: 0px; width: 10em; } div.topbar { background: #ffffff; color: #000000; display: block; height: 1.4em; left: 0px; margin: 0px; padding: 0px; position: relative; right: 0px; } p.topbar { background: #ffffff; color:#000000; display: block; font-size:1em; margin: 0px; padding-top: 0.2em; padding-bottom: 0.2em; padding-right: 0.2em; padding-left: 5px; } div.bottombar { background: #ffffff; color: #000000; display: block; height: 1.4em; margin: 0px; right: 0px; text-align: right; top: 0px; padding: 0px; position: relative; } p.bottombar { background: #ffffff; color: #000000; display: block; font-size:1em; margin: 0px; padding-top: 0.2em; padding-bottom: 0.2em; padding-left: 0.2em; padding-right: 5px; } tr, tr p, tr ul { background: #ffffcc; } ul.navbar { background: #eeeeff; color: #000000; list-style-type: none; margin: 0px; padding: 0px; padding-left: 0.2em; padding-right: 0.2em; padding-bottom: 0em; } ul.navbar li { background: #eeeeff; color: #000000; list-style-type: none; margin: 0px; padding: 0px; padding-left: 0.3em; padding-right: 0.3em; padding-bottom: 0.2em; padding-top: 0.2em; } ul.navbar li ul { padding-top: 0.2em; } ul.navbar li a { font-size: 0.9em; font-weight: bold; } ul.navbar li span { font-size: 0.9em; font-weight: bold; } ul.cv { background: #ffffee; color: #000000; list-style-type: none; margin: 0px; padding: 0px; } ul.cv li { margin-bottom: 1em; } table { margin-bottom: 1em; } |
From: Thomas D. <th...@us...> - 2002-01-26 17:10:48
|
Update of /cvsroot/phpxd/phpXD.www/templates In directory usw-pr-cvs1:/tmp/cvs-serv21133/templates Added Files: .htaccess template.html Log Message: Initial checkin of the phpxd homepage. --- NEW FILE: .htaccess --- Deny From All --- NEW FILE: template.html --- <?xml version=\"1.0\"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="de" lang="de"> <head> <title> $URL_TITLE$: $PAGE_TITLE$ </title> <link rel="stylesheet" media="screen" type="text/css" href="$URL$stylesheets/netscape.css" /> <link rel="stylesheet" title="Standard" media="screen, projection" type="text/css" href="$URL$stylesheets/screen.css" /> <link rel="stylesheet" media="print" type="text/css" href="$URL$stylesheets/print.css" /> </head> <body> <div class="topbar"> <p class="topbar"> <a class="toplinks" href="$URL$">$URL_TITLE$</a> > $PAGE_HIERARCHY$</p> </div> <div class="dokument"> <div class="content"> $PAGE_CONTENT$ </div> <div class="navbar"> <h1 class="hidden">Navigation</h1> $PAGE_NAVIGATION$ </div> </div> <div class="bottombar"> <p class="bottombar"> [<a class="toplinks" href="http://validator.w3.org/check/referer">Valid XHTML 1.0!</a>] + [<a class="toplinks" href="http://jigsaw.w3.org/css-validator/validator?uri=http://dohmke.de/stylesheets/screen.css&warning=no">Valid CSS!</a>] </p> <p class="bottombar"> Page created in $PROCESSING_TIME$ s. </div> </body> </html> |
From: Thomas D. <th...@us...> - 2002-01-26 17:10:48
|
Update of /cvsroot/phpxd/phpXD.www/include/phpXD In directory usw-pr-cvs1:/tmp/cvs-serv21133/include/phpXD Added Files: LICENSE phpXD.php Log Message: Initial checkin of the phpxd homepage. --- NEW FILE: LICENSE --- // phpXD - a XML DOM Implementation // // This Software and all associated files are released unter the // GNU Public License (GPL), see LICENSE for details. // // $Id: LICENSE,v 1.1 2002/01/26 17:10:44 thomi Exp $ The General Public License (GPL) Version 2, June 1991 Copyright (C) 1989, 1991 Free Software Foundation, Inc. 675 Mass Ave, Cambridge, MA 02139, USA. Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This General Public License applies to most of the Free Software Foundation's software and to any other program whose authors commit to using it. (Some other Free Software Foundation software is covered by the GNU Library General Public License instead.) You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things. To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it. For example, if you distribute copies of such a program, whether gratis or for a fee, you must give the recipients all the rights that you have. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. We protect your rights with two steps: (1) copyright the software, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the software. Also, for each author's protection and ours, we want to make certain that everyone understands that there is no warranty for this free software. If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original authors' reputations. Finally, any free program is threatened constantly by software patents. We wish to avoid the danger that redistributors of a free program will individually obtain patent licenses, in effect making the program proprietary. To prevent this, we have made it clear that any patent must be licensed for everyone's free use or not licensed at all. The precise terms and conditions for copying, distribution and modification follow. GNU GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License. The "Program", below, refers to any such program or work, and a "work based on the Program" means either the Program or any derivative work under copyright law: that is to say, a work containing the Program or a portion of it, either verbatim or with modifications and/or translated into another language. (Hereinafter, translation is included without limitation in the term "modification".) Each licensee is addressed as "you". Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running the Program is not restricted, and the output from the Program is covered only if its contents constitute a work based on the Program (independent of having been made by running the Program). Whether that is true depends on what the Program does. 1. You may copy and distribute verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and give any other recipients of the Program a copy of this License along with the Program. You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. 2. You may modify your copy or copies of the Program or any portion of it, thus forming a work based on the Program, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: a) You must cause the modified files to carry prominent notices stating that you changed the files and the date of any change. b) You must cause any work that you distribute or publish, that in whole or in part contains or is derived from the Program or any part thereof, to be licensed as a whole at no charge to all third parties under the terms of this License. c) If the modified program normally reads commands interactively when run, you must cause it, when started running for such interactive use in the most ordinary way, to print or display an announcement including an appropriate copyright notice and a notice that there is no warranty (or else, saying that you provide a warranty) and that users may redistribute the program under these conditions, and telling the user how to view a copy of this License. (Exception: if the Program itself is interactive but does not normally print such an announcement, your work based on the Program is not required to print an announcement.) These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Program, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Program, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Program. In addition, mere aggregation of another work not based on the Program with the Program (or with a work based on the Program) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. 3. You may copy and distribute the Program (or a work based on it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you also do one of the following: a) Accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, b) Accompany it with a written offer, valid for at least three years, to give any third party, for a charge no more than your cost of physically performing source distribution, a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, c) Accompany it with the information you received as to the offer to distribute corresponding source code. (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form with such an offer, in accord with Subsection b above.) The source code for a work means the preferred form of the work for making modifications to it. For an executable work, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the executable. However, as a special exception, the source code distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. If distribution of executable or object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place counts as distribution of the source code, even though third parties are not compelled to copy the source along with the object code. 4. You may not copy, modify, sublicense, or distribute the Program except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense or distribute the Program is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. 5. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Program or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Program (or any work based on the Program), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Program or works based on it. 6. Each time you redistribute the Program (or any work based on the Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties to this License. 7. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Program at all. For example, if a patent license would not permit royalty-free redistribution of the Program by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Program. If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply and the section as a whole is intended to apply in other circumstances. It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system, which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. 8. If the distribution and/or use of the Program is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Program under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. 9. The Free Software Foundation may publish revised and/or new versions of the General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of this License, you may choose any version ever published by the Free Software Foundation. 10. If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS --- NEW FILE: phpXD.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: phpXD.php,v 1.1 2002/01/26 17:10:44 thomi Exp $ require("include/phpxd_0.21/include/node.php"); require("include/phpxd_0.21/include/attr.php"); require("include/phpxd_0.21/include/characterdata.php"); require("include/phpxd_0.21/include/comment.php"); require("include/phpxd_0.21/include/document.php"); require("include/phpxd_0.21/include/documentfragment.php"); require("include/phpxd_0.21/include/documenttype.php"); require("include/phpxd_0.21/include/domexception.php"); require("include/phpxd_0.21/include/domimplementation.php"); require("include/phpxd_0.21/include/element.php"); require("include/phpxd_0.21/include/entity.php"); require("include/phpxd_0.21/include/entityreference.php"); require("include/phpxd_0.21/include/namednodemap.php"); require("include/phpxd_0.21/include/nodelist.php"); require("include/phpxd_0.21/include/processinginstruction.php"); require("include/phpxd_0.21/include/text.php"); require("include/phpxd_0.21/include/cdatasection.php"); /** * This class offers methods for accessing the nodes of a XML document using * the Document Object Model Level 1 (DOM). For parsing the XML files, the PHP * XML extension (libexpat) is used. Some interface supports DOM Level 2 yet. * * @package phpXD * @author Thomas Dohmke <th...@do...> * @version $Revision: 1.1 $ */ class phpXD { /** * The Document node. * * @private * @type Document */ var $document; /** * The current Element node which is parsed. Only valid while * parsing a XML file! * * @private * @type Node */ var $currentNode; /** * The last node which is parsed. Only valid while parsing a XML file! * * @private * @type Node */ var $lastNode; /** * A CDataSection is parsed. All strings will be collected to one * CDataSection node. Only valid while parsing a XML file! * * @private * @type boolean */ var $parseCData = false; /** * The parsed DTD string. Only valid while parsing a XML file! * * @private * @type string */ var $parsedDTD = false; /** * The parsed DTD is an internal DTD. Only valid while parsing * a XML file! * * @private * @type boolean */ var $parsedDTDInternal = false; /** * A array with the defined namespaces. * * @private * @type array */ var $namespaces = false; /** * The Constructor of the class. If $file is set, the XML file * is loaded. * * @public * @param $file <code>string</code> * @returns phpXD */ function phpXD($file = "") { $this->namespaces["xml"] = "http://www.w3.org/XML/1998/namespace"; $this->namespaces["xmlns"] = "http://www.w3.org/2000/xmlns/"; if (!empty($file)) { $this->loadFile($file); } } /** * Loads the XML file specified by $file and creates the DOM tree. * * @public * @param $file <code>string</code> * @returns phpXD */ function loadFile($file) { if (file_exists($file) && is_readable($file)) { $content = implode("", file($file)); if (!empty($content)) { $this->document = new Document(); $parser = xml_parser_create(); xml_parser_set_option($parser, XML_OPTION_CASE_FOLDING, 0); xml_set_object($parser, $this); xml_set_element_handler($parser, "handleStartElement", "handleEndElement"); xml_set_character_data_handler($parser, "handleCharacterData"); xml_set_processing_instruction_handler($parser, "handleProcessingInstruction"); xml_set_external_entity_ref_handler($parser, "handleExternalEntity"); // xml_set_default_handler($parser, "handleDefault"); if (!xml_parse($parser, $content, true)) { $this->displayError("XML error in file %s, line %d: %s", $file, xml_get_current_line_number($parser), xml_error_string(xml_get_error_code($parser))); } xml_parser_free($parser); } } else { $this->displayError("File %s could not be found or read.", $file); } } /** * Saves the DOM tree recursively to the XML file specified by $file. * If $trim is set to true, all whitespaces from beginning and end of a * the XML markup are stripped. * * @public * @param $dom <a href="Document.html">Document</a> * @param $trim <code>boolean</code> * @returns void */ function saveFile($file, $trim = false) { $fp = fopen($file, "w"); fwrite($fp, "<?xml version=\"1.0\"?>\n"); $this->saveTree($this->document, 0, $trim, $text); fwrite($fp, $text); fclose($fp); } /** * Writes the DOM tree recursively to the string $text as XML. * * @private * @param $dom <a href="Document.html">Document</a> * @param $deep <code>boolean</code> * @param $trim <code>boolean</code> * @param $text <code>string</code> * @returns void */ function saveTree(&$dom, $deep, $trim, &$text) { $space = ""; if (!$trim) { for ($i = 0; $i < $deep; $i++) $space .= "\t"; } if ($dom->nodeType == CDATA_SECTION_NODE) { $text .= $space; $text .= "<![CDATA["; $output = $dom->getData(); $text .= $output; $text .= "]]>\n"; } if ($dom->nodeType == COMMENT_NODE) { $text .= $space; $text .= "<!--"; $output = $dom->getData(); if (!(strpos($output, "\n") === false)) { $break = "\n"; } else { $break = ""; $space = ""; } $text .= $break.$space; $output = str_replace("\n", "\n".$space, $output); $text .= $output; $text .= $break.$space; $text .= "-->\n"; } if ($dom->nodeType == DOCUMENT_NODE) { if (!empty($dom->doctype)) { if (!empty($dom->doctype->publicId) && !empty($dom->doctype->systemId)) { $text .= "<!DOCTYPE ".$dom->doctype->name." PUBLIC ". $dom->doctype->systemId." ".$dom->doctype->publicId.">\n"; } else { if (!empty($dom->doctype->systemId)) { $text .= "<!DOCTYPE ".$dom->doctype->name." SYSTEM ". $dom->doctype->systemId.">\n"; } else { $text .= $dom->doctype->internalSubset."\n"; } } } if ($dom->hasChildNodes()) { $this->saveTree($dom->firstChild, $deep, $trim, $text); } $this->saveTree($dom->documentElement, $deep, $trim, $text); } if ($dom->nodeType == DOCUMENT_FRAGMENT_NODE) { $this->saveTree($dom->firstChild, $trim, $text); } if ($dom->nodeType == ELEMENT_NODE) { $text .= $space; $text .= "<".$dom->tagName; if (isset($dom->attributes)) { for ($i = 0; $i < $dom->attributes->getLength(); $i++) { $elem =& $dom->attributes->item($i); $text .= " ".$elem->getName()."=\"".$elem->getValue()."\""; } } if ($dom->hasChildNodes()) { $text .= ">\n"; $this->saveTree($dom->firstChild, $deep+1, $trim, $text); $text .= $space; $text .= "</".$dom->tagName.">\n"; } else { $text .= " />\n"; } } if ($dom->nodeType == PROCESSING_INSTRUCTION_NODE) { $text .= $space; $output = $dom->getData(); $text .= "<?".$dom->getTarget()." "; $text .= $output; $text .= " ?>\n"; // <? } if ($dom->nodeType == TEXT_NODE) { $text .= $space; $text .= $dom->getData(); $text .= "\n"; } if (isset($dom->nextSibling)) { $this->saveTree($dom->nextSibling, $deep, $trim, $text); } } /** * The Element Start Handler for Expat. * * @private * @returns void */ function handleStartElement($parser, $name, $attributes) { if (!(strpos($name, ":") === false)) { $prefix = substr($name, 0, strpos($name, ":")); if (is_array($attributes) && !empty($attributes["xmlns:".$prefix])) { $namespace = $attributes["xmlns:".$prefix]; } else { if (is_array($this->namespaces) && !empty($this->namespaces[$prefix])) { $namespace = $this->namespaces[$prefix]; } else { $this->displayError("XML error: unknown namespace in line %d.", xml_get_current_line_number($parser)); } } $this->namespaces[$prefix] = $namespace; } if (!(strpos($name, ":") === false)) { $newChild =& $this->document->createElementNS($namespace, $name); if ($newChild == NAME_SPACE_ERR) { $this->displayError("XML error: namespace not valid in line %d.", xml_get_current_line_number($parser)); } } else { $newChild =& $this->document->createElement($name); } if (!isset($this->document->documentElement)) { $this->document->documentElement =& $newChild; $this->currentNode =& $this->document->documentElement; } else { $this->currentNode->appendChild($newChild); $this->currentNode =& $newChild; } if (is_array($attributes)) { while (list($name, $value) = each($attributes)) { if (!(strpos($name, ":") === false)) { $prefix = substr($name, 0, strpos($name, ":")); $localName = substr($name, strpos($this->nodeName, ":")+1); if ($prefix == "xmlns") { $this->namespaces[$localName] = $value; $namespace = $this->namespaces["xmlns"]; } else { if (is_array($attributes) && !empty($attributes["xmlns:".$prefix])) { $namespace = $attributes["xmlns:".$prefix]; } else { if (is_array($this->namespaces) && !empty($this->namespaces[$prefix])) { $namespace = $this->namespaces[$prefix]; } else { $this->displayError("XML error: unknown namespace". " in line %d.", xml_get_current_line_number($parser)); } } } $result = $this->currentNode->setAttributeNS($namespace, $name, $value); if ($result == NAME_SPACE_ERR) { $this->displayError("XML error: namespace not valid in line %d.", xml_get_current_line_number($parser)); } $attr =& $this->currentNode->getAttributeNode($name); $attr->specified = true; } else { $this->currentNode->setAttribute($name, $value); $attr =& $this->currentNode->getAttributeNode($name); $attr->specified = true; } } } $this->lastNode =& $this->currentNode; } /** * The Element End Handler for Expat. * * @private * @returns void */ function handleEndElement($parser, $name) { $this->currentNode =& $this->currentNode->parentNode; $this->lastNode =& $this->currentNode; } /** * The CharacterData Handler for Expat. * * @private * @returns void */ function handleCharacterData($parser, $text) { if ($this->parseCData) { if ($this->lastNode->nodeType == CDATA_SECTION_NODE) { $this->lastNode->appendData($text); } else { $this->lastNode =& $this->currentNode->appendChild( $this->document->createCDataSection($text)); } } else { $text = str_replace("\t", " ", $text); $text = str_replace("\n", " ", $text); $text = str_replace("\r", " ", $text); $text = str_replace(" ", " ", $text); if (trim($text) != "") { $this->lastNode =& $this->currentNode->appendChild( $this->document->createTextNode($text)); } } } /** * The ProcessingInstruction Handler for Expat. * * @private * @returns void */ function handleProcessingInstruction($parser, $target, $data) { if (!isset($this->document->documentElement)) { $this->document->appendChild( $this->document->createProcessingInstruction($target, $data)); } else { $this->lastNode =& $this->currentNode->appendChild( $this->document->createProcessingInstruction( $target, $data)); } } function handleExternalEntity($parser, $openEntityName, $base, $systemId, $publicId) { $newDOM = new phpXD($systemId); if (!isset($this->document->documentElement)) { echo "hier"; $this->document->appendChild($this->document->importNode( $newDOM->document->documentElement, true)); } else { $this->lastNode =& $this->currentNode->appendChild($this->document->importNode( $newDOM->document->documentElement, true)); } return true; } /** * The DTD Handler. Expat has no DTD Handler callback, so this * is set by handleDefault. * * @private * @returns void */ function handleDTD($parser, $data) { $data = trim($data); if (!empty($data)) { $this->parsedDTD .= " ".$data; } if ($data == "[") { $this->parseDTDInternal = true; } if ($data == "]") { $this->parseDTDInternal = false; } if ((substr($this->parsedDTD, strlen($this->parsedDTD)-1) == ">") && !$this->parseDTDInternal) { $this->document->doctype = new DocumentType(); // this is just a hack to differ between internal and external DTDs $DTD = explode(" ", $this->parsedDTD); $this->document->doctype->name = $DTD[1]; if ($DTD[2] == "SYSTEM") { $this->document->doctype->systemId = $DTD[3]; } else { if ($DTD[2] == "PUBLIC") { $this->document->doctype->publicId = $DTD[3]; $this->document->doctype->systemId = $DTD[4]; } else { $this->document->doctype->internalSubset = $this->parsedDTD; } } xml_set_default_handler($parser, "handleDefault"); return true; } } /** * The Default Handler for Expat. * * @private * @returns void */ function handleDefault($parser, $data) { $data = trim($data); if (!(strpos($data, "<!--") === false)) { $data = str_replace("<!--", "", $data); $data = str_replace("-->", "", $data); if (!isset($this->document->documentElement)) { $this->document->appendChild( $this->document->createComment($data)); } else { $this->lastNode =& $this->currentNode->appendChild( $this->document->createComment($data)); } return true; } if ($data == "<![CDATA[") { $this->parseCData = true; return true; } if ($data == "]]>" && $this->parseCData) { $this->parseCData = false; return true; } if ($data == "<!DOCTYPE") { $this->parsedDTD .= $data; xml_set_default_handler($parser, "handleDTD"); return true; } return false; } /** * Displays errors, which occur while parsing. * * @private * @returns void */ function displayError($message) { if (func_num_args() > 1) { $arguments = func_get_args(); $command = "\$message = sprintf(\$message, "; for ( $i = 1; $i < sizeof($arguments); $i++ ) { $command .= "\$arguments[".$i."], "; } $command = eregi_replace(", $", ");", $command); eval($command); } echo "<strong>phpXD error:</strong> ".$message; exit; } } ?> |
From: Thomas D. <th...@us...> - 2002-01-26 17:10:48
|
Update of /cvsroot/phpxd/phpXD.www/data/en In directory usw-pr-cvs1:/tmp/cvs-serv21133/data/en Added Files: index.xml navigation.xml Log Message: Initial checkin of the phpxd homepage. --- NEW FILE: index.xml --- <?xml version="1.0" encoding="iso8859-1"?> <page> <title> Homepage </title> <content> <p> This page is currently offline. Please take a look at the <a href="http://sf.net/projects/phpxd">project site at Sourceforge. </a> </p> <p> <a href="http://sourceforge.net"><img src="http://sourceforge.net/sflogo.php?group_id=29609" width="88" height="31" alt="SourceForge" /></a> </p> </content> </page> <!-- Keep this comment at the end of the file Local variables: mode: sgml sgml-omittag:t sgml-shorttag:t sgml-namecase-general:t sgml-general-insert-case:lower sgml-minimize-attributes:nil sgml-always-quote-attributes:t sgml-indent-step:2 sgml-indent-data:t sgml-parent-document:nil sgml-exposed-tags:nil sgml-local-catalogs:nil sgml-local-ecat-files:nil End: --> --- NEW FILE: navigation.xml --- <?xml version="1.0" encoding="iso8859-1"?> <links> <ul class="navbar"> <li> <a href="$URL$$SESSION_ID$">Homepage</a> </li> <li> <!--<a href="$URL$$SESSION_ID$sourceforge">phpXMLDOM on Sourceforge</a>--> <a href="http://sf.net/projects/phpxd/">phpXMLDOM on Sourceforge</a> <ul class="navbar"> <li> <a href="http://sf.net/projects/phpxd">Summary</a> </li> <li> <a href="http://sourceforge.net/project/showfiles.php?group_id=29609">Files</a> </li> <li> <a href="http://sourceforge.net/docman/?group_id=29609">Docs</a> </li> </ul> </li> </ul> </links> <!-- Keep this comment at the end of the file Local variables: mode: sgml sgml-omittag:t sgml-shorttag:t sgml-namecase-general:t sgml-general-insert-case:lower sgml-minimize-attributes:nil sgml-always-quote-attributes:t sgml-indent-step:2 sgml-indent-data:t sgml-parent-document:nil sgml-exposed-tags:nil sgml-local-catalogs:nil sgml-local-ecat-files:nil End: --> |
From: Thomas D. <th...@us...> - 2002-01-26 17:10:48
|
Update of /cvsroot/phpxd/phpXD.www/include In directory usw-pr-cvs1:/tmp/cvs-serv21133/include Added Files: .htaccess Log Message: Initial checkin of the phpxd homepage. --- NEW FILE: .htaccess --- Deny From All |
From: Thomas D. <th...@us...> - 2002-01-26 17:10:47
|
Update of /cvsroot/phpxd/phpXD.www/classes In directory usw-pr-cvs1:/tmp/cvs-serv21133/classes Added Files: .htaccess Site.php Sites.php StaticSite.php Log Message: Initial checkin of the phpxd homepage. --- NEW FILE: .htaccess --- Deny From All --- NEW FILE: Site.php --- <?php // phpXD-Homepage - EXPERIMENTAL // // This Software and all associated files are released unter the // GNU Public License (GPL), see LICENSE for details. // // $Id: Site.php,v 1.1 2002/01/26 17:10:44 thomi Exp $ class Site { var $site = ""; var $filepath = ""; var $template = ""; var $style = ""; var $xhtml = ""; var $pageTitle; var $hierarchy; var $content; var $navigation; var $url; var $urlTitle; var $sessionID; var $xhtml; var $timeStart; /* * Renders a site to a string. * @private * @return string */ function renderToString() { $page = implode("", file($this->template)); $page = str_replace("\$URL_TITLE\$", $this->urlTitle, $page); $page = str_replace("\$PAGE_STYLE\$", $this->style, $page); $page = str_replace("\$PAGE_TITLE\$", $this->pageTitle, $page); $page = str_replace("\$PAGE_HIERARCHY\$", $this->hierarchy, $page); $page = str_replace("\$PAGE_CONTENT\$", $this->content, $page); $page = str_replace("\$PAGE_NAVIGATION\$", $this->navigation, $page); $page = str_replace("\$URL\$", $this->url, $page); $page = str_replace("\$SESSION_ID\$", $this->sessionID, $page); $timeStop = microtime(); list($usecStart, $secStart) = explode(" ", $this->timeStart); list($usecStop, $secStop) = explode(" ", $timeStop); $page = str_replace("\$PROCESSING_TIME\$", sprintf("%.2f", ($secStop + $usecStop - $secStart - $usecStart)), $page); $this->xhtml = $page; return $this->xhtml; } /* * Renders a site and outputs it. * @private * @return void */ function render() { echo $this->renderToString(); } /* * Runs the site. This could mean, that the site is created (static sites) * or handled (dynamic sites). * @public * @param $url * @param $sessionID * @param $getVars A copy of $HTTP_GET_VARS or $_GET; * @param $postVars A copy of $HTTP_POST_VARS or $_POST; * @return string */ function run($sessionID, $getVars, $postVars, &$sessionVars) { } function makeHierarchy() { $sites = new Sites(); $subDirs = explode("/", $this->site); $this->hierarchy = ""; $path = ""; array_pop($subDirs); if (sizeof($subDirs) > 0) { foreach ($subDirs as $key => $subDir) { if (($key != "en") && ($key != "de")) { if ($this->hierarchy != "") { $this->hierarchy .= " > "; } $title = $sites->getTitle($subDir); $this->hierarchy .= "<a href=\"".$this->url.$path.$subDir."\">". $title."</a>"; $path .= $subDir."/"; } } } if ($this->hierarchy != "") { $this->hierarchy .= " > "; } $this->hierarchy .= $this->pageTitle; } function &loadNavigation() { $site = $this->site; do { $splitSite = explode("/", $site); unset($splitSite[count($splitSite) - 1]); $site = implode("/", $splitSite); if (file_exists("data/".$site."/navigation.xml")) { $linksDOM = new phpXD("data/".$site."/navigation.xml"); return $linksDOM->document->documentElement->firstChild; } } while ($site != ""); } function makeNavigation(&$linksDOM) { $this->navigation = ""; $links =& $linksDOM->getElementsByTagName("li"); for ($i = 0; $i < $links->getLength(); ++$i) { $link =& $links->item($i); $firstChild =& $link->firstChild; while (($firstChild != null) && ($firstChild->nodeName != "a")) { $firstChild =& $firstChild->nextSibling; } if (($firstChild->nodeType == ELEMENT_NODE) && ($firstChild->nodeName == "a")) { $href = $firstChild->getAttribute("href"); $href = str_replace("\$URL\$", "", $href); $href = str_replace("\$SESSION_ID\$", "", $href); if ($href == "") { $href = "index"; } if ($href == $this->site) { $class = $firstChild->getAttribute("class"); $firstChild->setAttribute("class", $class." selected"); } else { if ((strpos($this->site, $href) === false) || !(strpos($this->site, $href) == 0)) { if (($link->parentNode->parentNode->nodeName == "li") && (strpos($href, $this->site) === false)) { $link->parentNode->removeChild($link); } unset($prevChild); $child =& $firstChild; while ($child != null) { if (($child->nodeType == ELEMENT_NODE) && ($child->nodeName != "a")) { if ($prevChild != null) { $prevChild->nextSibling =& $child->nextSibling; } } else { $prevChild =& $child; } $child =& $child->nextSibling; } } } } } $this->XMLToXHTML($linksDOM, $this->navigation); } function XMLToXHTML(&$dom, &$output) { if ($dom->nodeType == CDATA_SECTION_NODE) { $output .= "<![CDATA["; $output .= $dom->getData(); $output .= "]]>"; } if ($dom->nodeType == COMMENT_NODE) { $output .= "<!--"; $output .= htmlspecialchars($dom->getData()); $output .= "-->"; } if ($dom->nodeType == ELEMENT_NODE) { $output .= "<".$dom->tagName; if (isset($dom->attributes)) { for ($i = 0; $i < $dom->attributes->getLength(); $i++) { $elem =& $dom->attributes->item($i); $output .= " ".$elem->getName()."=\"".$elem->getValue()."\""; } } if ($dom->hasChildNodes()) { $output .= ">"; $this->XMLToXHTML($dom->firstChild, $output); $output .= "</".$dom->tagName.">"; } else { $output .= " />"; } } if ($dom->nodeType == TEXT_NODE) { $text = str_replace("&", "&", $dom->getData()); $text = str_replace("<", "<", $text); $output .= str_replace(">", ">", $text); } if (isset($dom->nextSibling)) { $this->XMLToXHTML($dom->nextSibling, $output); } } function destroy(&$dom) { if ($dom != null) { if ($dom->hasChildNodes()) { $this->destroy($dom->firstChild); } if ((isset($dom->nextSibling)) && ($dom->nextSibling != null)) { $this->destroy($dom->nextSibling); } unset($dom); } } } ?> --- NEW FILE: Sites.php --- <?php // phpXD-Homepage - EXPERIMENTAL // // This Software and all associated files are released unter the // GNU Public License (GPL), see LICENSE for details. // // $Id: Sites.php,v 1.1 2002/01/26 17:10:44 thomi Exp $ class Sites { var $sites; var $titles; var $styles; function Sites() { $this->sites["en/index"] = "StaticSite"; } // Which site is handled by which class. function getClass($site) { if (isset($this->sites[$site])) { return $this->sites[$site]; } else { return ""; } } function getTitle($site) { if (isset($this->titles[$site]) && ($this->titles[$site] != "")) { return $this->titles[$site]; } else { return ucfirst($site); } } function getStyle($site) { if (isset($this->styles[$site]) && ($this->styles[$site] != "")) { return $this->styles[$site]; } else { return "stylesheets/screen.css"; } } } ?> --- NEW FILE: StaticSite.php --- <?php // phpXD-Homepage - EXPERIMENTAL // // This Software and all associated files are released unter the // GNU Public License (GPL), see LICENSE for details. // // $Id: StaticSite.php,v 1.1 2002/01/26 17:10:44 thomi Exp $ class StaticSite extends Site { function StaticSite($site, $filepath, $template, $style) { $this->site = $site; $this->filepath = $filepath; $this->template = $template; $this->style = $style; } /* * Runs the site. This could mean, that the site is created (static sites) * or handled (dynamic sites). * @public * @param $url * @param $sessionID * @param $getVars A copy of $HTTP_GET_VARS or $_GET; * @param $postVars A copy of $HTTP_POST_VARS or $_POST; * @return string */ function run($url, $urlTitle, $sessionID, $getVars, $postVars, &$sessionVars) { $this->timeStart = microtime(); $this->url = $url; $this->urlTitle = $urlTitle; $this->sessionID = $sessionID; if (file_exists($this->filepath.$this->site.".xml")) { $pageDOM = new phpXD($this->filepath.$this->site.".xml"); } $titleNodes = $pageDOM->document->getElementsByTagName("title"); if ($titleNodes->getLength() > 0) { $titleNode = $titleNodes->item(0); $titleNode->normalize(); $this->pageTitle = $titleNode->firstChild->getData(); $this->makeHierarchy(); } $contentNodes = $pageDOM->document->getElementsByTagName("content"); if ($contentNodes->getLength() > 0) { $contentNode = $contentNodes->item(0); $content = ""; $this->XMLToXHTML($contentNode->firstChild, $this->content); } $linksNodes = $pageDOM->document->getElementsByTagName("links"); if ($linksNodes->getLength() > 0) { $linksNode = $linksNodes->item(0); if ($linksNode->getAttribute("ref") != "") { $linksDOM = new phpXD("data/".$linksNode->getAttribute("ref")); $linksNodes2 = $linksDOM->document->getElementsByTagName("links"); if ($linksNodes2->getLength() > 0) { $temp = $linksNodes2->item(0); $linksNode2 = $temp->firstChild; } } else { $linksNode2 = $linksNode->firstChild; } } else { $linksNode2 = $this->loadNavigation(); } $this->makeNavigation($linksNode2); $this->destroy($pageDOM->document->documentElement); unset($pageDOM); $this->destroy($linksDOM->document->documentElement); unset($linksDOM); } } ?> |
From: Thomas D. <th...@us...> - 2002-01-26 17:10:47
|
Update of /cvsroot/phpxd/phpXD.www/data In directory usw-pr-cvs1:/tmp/cvs-serv21133/data Added Files: .htaccess Log Message: Initial checkin of the phpxd homepage. --- NEW FILE: .htaccess --- Deny From All |
From: Thomas D. <th...@us...> - 2002-01-26 17:10:47
|
Update of /cvsroot/phpxd/phpXD.www In directory usw-pr-cvs1:/tmp/cvs-serv21133 Added Files: default.php Log Message: Initial checkin of the phpxd homepage. --- NEW FILE: default.php --- <?php // phpXD-Homepage - EXPERIMENTAL // // This Software and all associated files are released unter the // GNU Public License (GPL), see LICENSE for details. // // $Id: default.php,v 1.1 2002/01/26 17:10:44 thomi Exp $ ini_set("track_vars", true); ini_set("session.use_trans_sid", false); ini_set("session.gc_maxlifetime", 3600); header("Accept-Charset: iso-8859-1"); header("Content-Type: text/html; charset=ISO-8859-1"); require("include/phpxd_0.21/phpXD.php"); require("classes/Sites.php"); require("classes/Site.php"); require("classes/StaticSite.php"); $URL = "http://phpxd.sf.net/"; $URL_TITLE = "phpXMLDOM"; // no sessions $sessionHandling = false; // Split parameter site. if (!isset($HTTP_GET_VARS["site"])) { $splitRequest = explode("/", ""); } else { $splitRequest = explode("/", $HTTP_GET_VARS["site"]); } if ($sessionHandling) { // Is a sessionId included? if (strlen($splitRequest[0]) == 32) { session_name("SESSIONID"); session_id($splitRequest[0]); @session_start(); $sessionId = $splitRequest[0]."/"; unset($splitRequest[0]); } else { session_name("SESSIONID"); session_set_cookie_params(time() + 9999999, "", $URL); @session_start(); if ((isset($HTTP_COOKIE_VARS["SESSIONID"])) && ($HTTP_COOKIE_VARS["SESSIONID"] != session_id())) { $sessionID = session_id()."/"; } else { $sessionID = ""; } } } else { $sessionID = ""; } // Which resource is requested? $site = implode("/", $splitRequest); // Create page. $sites = new Sites(); $class = $sites->getClass($site); if ($class == "") { $languages = explode(",", getenv("HTTP_ACCEPT_LANGUAGE")); $langCount = 0; while (($site == "") && ($langCount < count($languages))) { $lang = explode(";", $languages[$langCount]); // if (trim($lang[0]) == "de") { // $site = "de/".$site; // } // else { { if (substr(trim($lang[0]), 0, 2) == "en") { $site = "en/".$site; } } ++$langCount; } if ($site == "") { $site = "en/index"; } if ($site == "en/") { $site = "en/index"; } $class = $sites->getClass($site); } if (!empty($class)) { $site = new $class($site, "data/", "templates/template.html", $sites->getStyle($site)); $site->run($URL, $URL_TITLE, $sessionID, $HTTP_GET_VARS, $HTTP_POST_VARS, $HTTP_SESSION_VARS); $site->render(); exit; } // No site found? Then go to the index site. //header("Location: ".$URL); exit; ?> |
From: Thomas D. <th...@us...> - 2002-01-26 17:09:17
|
Update of /cvsroot/phpxd/phpXD.www/include/phpXD/include In directory usw-pr-cvs1:/tmp/cvs-serv20858/include/phpXD/include Log Message: Directory /cvsroot/phpxd/phpXD.www/include/phpXD/include added to the repository |
From: Thomas D. <th...@us...> - 2002-01-26 17:08:39
|
Update of /cvsroot/phpxd/phpXD.www/include/phpXD In directory usw-pr-cvs1:/tmp/cvs-serv20687/include/phpXD Log Message: Directory /cvsroot/phpxd/phpXD.www/include/phpXD added to the repository |
From: Thomas D. <th...@us...> - 2002-01-26 17:08:04
|
Update of /cvsroot/phpxd/phpXD.www/data/en In directory usw-pr-cvs1:/tmp/cvs-serv20549/data/en Log Message: Directory /cvsroot/phpxd/phpXD.www/data/en added to the repository |
From: Thomas D. <th...@us...> - 2002-01-26 17:07:30
|
Update of /cvsroot/phpxd/phpXD.www/templates In directory usw-pr-cvs1:/tmp/cvs-serv20404/templates Log Message: Directory /cvsroot/phpxd/phpXD.www/templates added to the repository |
From: Thomas D. <th...@us...> - 2002-01-26 17:07:29
|
Update of /cvsroot/phpxd/phpXD.www/stylesheets In directory usw-pr-cvs1:/tmp/cvs-serv20404/stylesheets Log Message: Directory /cvsroot/phpxd/phpXD.www/stylesheets added to the repository |
From: Thomas D. <th...@us...> - 2002-01-26 17:07:28
|
Update of /cvsroot/phpxd/phpXD.www/include In directory usw-pr-cvs1:/tmp/cvs-serv20404/include Log Message: Directory /cvsroot/phpxd/phpXD.www/include added to the repository |