phpxd-commits Mailing List for phpXD (Page 2)
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: Growbal K. <gr...@us...> - 2002-03-03 06:23:21
|
Update of /cvsroot/phpxd/phpXD/include/dom
In directory usw-pr-cvs1:/tmp/cvs-serv8265/include/dom
Added Files:
DOMWriter.php
Log Message:
Add DOMWriter.php
sample_big5.xml
dwtest.php
Modify dom.php for including DOMWriter.php
by Growbal
--- NEW FILE: DOMWriter.php ---
<?php
// phpXMLDOM - an XML DOM Implementation
//
// This Software and all associated files are released unter the
// GNU Public License (GPL), see LICENSE for details.
//
// $Id: DOMWriter.php,v 1.1 2002/03/03 06:23:16 growbal Exp $
/**
* Class representing the DOMWriter interface.
*
*
* @package phpXD
* @author Growbal Kuo <gr...@ta...>
* @author Thomas Dohmke <th...@do...>
* @version $Revision: 1.1 $
*/
class DOMWriter {
/**
* An array for saving DOMWriter's names features.<br>
* array keys are feature names. array values are feature states(true or false).<br>
*
* DOM-Level 3
*
* @private
* @type array
*/
var $namedFeatures;
/**
* The character encoding in which the output will be written.<br>
* The encoding to use when writing is determined as follows: <br>
* <li>If the encoding attribute has been set, that value will be used. <br>
* <li>If the encoding attribute is null or empty, but the item to be <br>
* written includes an encoding declaration, that value will be used. <br>
* <li>If neither of the above provides an encoding name, a default encoding <br>
* of "UTF-8" will be used. <br>
* DOM-Level 3
*
* @public
* @type string
*/
var $encoding;
/**
* The actual character encoding that was last used by this formatter.<br>
* This convenience method allows the encoding that was used <br>
* when serializing a document to be directly obtained.<br>
* Readonly<br>
*
* DOM-Level 3
*
* @private
* @type string
*/
var $lastEncoding;
/**
* The error handler that will receive error notifications <br>
* during serialization. The node where the error occured is <br>
* passed to this error handler, any modification to nodes <br>
* from within an error callback should be avoided since this<br>
* will result in undefined, implementation dependent behavior.<br>
*
* DOM-Level 3
*
* @public
* @type string
*/
var $errorHandler;
/**
* The end-of-line sequence of characters to be used in<br>
* the XML being written out. The only permitted values are these: <br>
* <li> null<br>
* <li> CR <br>
* <li> CR-LF <br>
* <li> LF <br>
*
* DOM-Level 3
*
* @public
* @type string
*/
var $newLine;
/**
* Constructor of the class.<br>
*
* @public
*/
function DOMWriter() {
$this->namedFeatures = array(
"normalize-characters" => true,
"split-cdata-sections" => true,
"validation" => false,
"expand-entity-references" => false,
"whitespace-in-element-content" => true,
"discard-default-content" => true,
"format-canonical" => false,
"format-pretty-print" => false
);
$this->encoding = "UTF-8";
$this->$newLine = "\n"; //LF
}
/**
* Returns true if the feature could be successfully set to the specified value.<br>
* DOM-Level 3
*
* @public
* @param $name <code>string</code>
* @param $state <code>boolean</code>
* @returns void
*/
function setFeature($name, $state) {
if ($this->canSetFeatureName($name))
if ($this->canSetFeature($name, $state)) {
$this->namedFeatures[$name] = $state;
if ($name=="format-pretty-print") {
$this->namedFeatures["format-canonical"] = ! $state;
} else if ($name=="format-canonical") {
$this->namedFeatures["format-pretty-print"] = ! $state;
}
} else
return NOT_SUPPORTED_ERR;
else
return NOT_FOUND_ERR;
}
/**
* Returns true if the feature could be successfully set.<br>
*
* @private
* @param $name <code>string</code>
* @returns boolean
*/
function canRecognizeFeatureName($name) {
$ret = in_array($name, $this->namedFeatures);
return $ret;
}
/**
* Returns true if the feature could be successfully set to the specified value.<br>
* DOM-Level 3
*
* @public
* @param $name <code>string</code>
* @param $state <code>boolean</code>
* @returns boolean
*/
function canSetFeature($name, $state) {
$canSetState = ($state===true || $state===false);
return canRecognizeFeatureName($name) && $canSetState;
}
/**
* Returns the current state of the feature (true or false).<br>
* DOM-Level 3
*
* @public
* @param $name <code>string</code>
* @returns boolean
*/
function getFeature($name) {
if ($this->canRecognizeFeatureName($name))
return $this->namedFeatures[$name];
else
return NOT_FOUND_ERR;
}
/**
* Write out the specified node in the description of DOMWriter. <br>
*
* Destination can be in these PHP supported output:
* <li> "/home/rasmus/file.xml"
* <li> "ftp://user:pas...@ex.../file.xml"
* <li> "php://stdout", or "php://stderr"
*
* On the Windows platform, be careful to escape any backslashes <br>
* used in the path to the file, or use forward slashes:
* "c:\\data\\file.xml"
*
*
* DOM-Level 3
*
* @public
* @param $destination <code>string</code>
* @param $wnode <code>Node</code>
* @returns boolean
*/
function writeNode($destination, $wnode) {
$ok = true;
if ($fp = fopen($destination, "w")) {
$text = "";
$this->writeToString2($wnode, false, 0, $text);
if (! fwrite($fp, $text) >=0 )
$ok = false;
fclose($fp);
}
else
$ok = false;
return $ok;
}
/**
* Serialize the specified node in the description of DOMWriter.<br>
* DOM-Level 3
*
* @public
* @param $wnode <code>Node</code>
* @returns string
*/
function writeToString($wnode) {
$str = "";
$this->writeToString2($wnode, $trim, 0, $str);
return $str;
}
/**
* Print indents for pretty format<br>
*
*
* @private
* @param $indent <code>int</code>
* @returns string
*/
function printIndent($indent) {
$ret = "";
//if ($this->getFeature("format-pretty-print")) {
for ($i=0; $i<$indent; $i++) {
$ret .= "\t";
}
//}
return $ret;
}
/**
* Serialize the specified node in the description of DOMWriter.<br>
*
*
* @private
* @param $dom <code>Node</code>
* @param $trim <code>boolean</code>
* @param $indent <code>string</code>
* @param &$text <code>string</code>
* @returns void
*/
function writeToString2(&$dom, $trim, $indent, &$text) {
$newLine=$this->$newLine;
$indentStr = $this->printIndent($indent);
if ($dom->nodeType == CDATA_SECTION_NODE) {
$text .= $indentStr."<![CDATA[";
$text .= $dom->getData();
$text .= $indentStr."]]>".$newLine;
}
if ($dom->nodeType == COMMENT_NODE) {
$text .= $indentStr."<!--";
$text .= $dom->getData();
$text .= $indentStr."-->".$newLine;
}
if ($dom->nodeType == DOCUMENT_NODE) {
$text ="";
$encodingDecl = sprintf(' encoding="%s"', $this->encoding);
// $SDDecl = "";
$text .= sprintf('<?xml version="1.0"%s?>', $encodingDecl).$newLine;
if ($dom->hasChildNodes()) {
$this->writeToString2($dom->firstChild, $trim, $indent, $text);
}
}
if ($dom->nodeType == DOCUMENT_FRAGMENT_NODE) {
$this->writeToString2($dom->firstChild, $trim, $text);
}
if ($dom->nodeType == ELEMENT_NODE) {
$text .= $indentStr."<".$dom->tagName;
if (isset($dom->attributes)) {
for ($i = 0; $i < $dom->attributes->getLength(); $i++) {
$elem =& $dom->attributes->item($i);
if ($elem->specified) {
$text .= " ".$elem->getName()."=\"".$elem->getValue()."\"";
}
}
}
if ($dom->hasChildNodes()) {
$text .= ">".$newLine;
$this->writeToString2($dom->firstChild, $trim, $indent+1, $text);
$text .= $indentStr."</".$dom->tagName.">".$newLine;
}
else {
$text .= " />".$newLine;
}
}
if ($dom->nodeType == ENTITY_REFERENCE_NODE) {
if ($dom->hasChildNodes()) {
$this->writeToStrring2($dom->firstChild, $text,$indent, $trim);
}
}
if ($dom->nodeType == PROCESSING_INSTRUCTION_NODE) {
$output = $dom->getData();
if ($trim) {
$output = str_replace("\t", " ", $output);
$output = preg_replace('= =', ' ', $output);
$output = str_replace("\n ", "\n", $output);
}
$text .= $indentStr."<?".$dom->getTarget()." ";
$text .= $output;
$text .= "?>".$newLine;
}
if ($dom->nodeType == TEXT_NODE) {
$output = trim($dom->getData());
if ($output!="") {
//$output = ereg_replace("^[\n\t ](.*)[\n\t ]$", "\\1",$output);
$output = preg_replace("/^\s(.*)\s$/", "$1",$output);
if ($trim) {
$output = str_replace("\t", " ", $output);
$output = preg_replace('= =', ' ', $output);
$output = str_replace("\n ", "\n", $output);
$text .= $indentStr.$output.$newLine;
}
else {
$text .= $indentStr.$output.$newLine;
}
}
}
if (isset($dom->nextSibling)) {
$this->writeToString2($dom->nextSibling, $trim, $indent, $text);
}
}
}
|
|
From: Growbal K. <gr...@us...> - 2002-03-03 06:01:14
|
Update of /cvsroot/phpxd/phpXD/samples/dwtest In directory usw-pr-cvs1:/tmp/cvs-serv4098/dwtest Log Message: Directory /cvsroot/phpxd/phpXD/samples/dwtest added to the repository |
|
From: Thomas D. <th...@us...> - 2002-02-14 13:28:21
|
Update of /cvsroot/phpxd/phpXD.www/data/en
In directory usw-pr-cvs1:/tmp/cvs-serv15199/data/en
Modified Files:
releases.xml
Log Message:
Index: releases.xml
===================================================================
RCS file: /cvsroot/phpxd/phpXD.www/data/en/releases.xml,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -r1.3 -r1.4
*** releases.xml 14 Feb 2002 13:26:31 -0000 1.3
--- releases.xml 14 Feb 2002 13:28:18 -0000 1.4
***************
*** 10,15 ****
<p>
<a href="http://prdownloads.sf.net/phpxd/phpxd_0.3.tar.gz">
! phpxd_0.3.tar.gz
! </a> (Size: 60812 Bytes)
</p>
--- 10,14 ----
<p>
<a href="http://prdownloads.sf.net/phpxd/phpxd_0.3.tar.gz">
! phpxd_0.3.tar.gz</a> (Size: 60812 Bytes)
</p>
***************
*** 98,103 ****
<p>
<a href="http://prdownloads.sf.net/phpxd/phpxd_0.21.tar.gz">
! phpxd_0.21.tar.gz
! </a> (Size: 51620 Bytes)
</p>
--- 97,101 ----
<p>
<a href="http://prdownloads.sf.net/phpxd/phpxd_0.21.tar.gz">
! phpxd_0.21.tar.gz</a> (Size: 51620 Bytes)
</p>
|
|
From: Thomas D. <th...@us...> - 2002-02-14 13:26:35
|
Update of /cvsroot/phpxd/phpXD.www/data/en
In directory usw-pr-cvs1:/tmp/cvs-serv14738/data/en
Modified Files:
index.xml releases.xml
Log Message:
Index: index.xml
===================================================================
RCS file: /cvsroot/phpxd/phpXD.www/data/en/index.xml,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -r1.4 -r1.5
*** index.xml 7 Feb 2002 08:43:31 -0000 1.4
--- index.xml 14 Feb 2002 13:26:31 -0000 1.5
***************
*** 21,25 ****
<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
--- 21,25 ----
<h2>Releases</h2>
<p>
! The current release is <strong>0.3</strong>, see
<a href="$URL$$SESSION_ID$releases">Releases</a>. There is a
short <a href="$URL$$SESSION_ID$readme">ReadMe</a> and some
Index: releases.xml
===================================================================
RCS file: /cvsroot/phpxd/phpXD.www/data/en/releases.xml,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -r1.2 -r1.3
*** releases.xml 14 Feb 2002 13:17:14 -0000 1.2
--- releases.xml 14 Feb 2002 13:26:31 -0000 1.3
***************
*** 11,15 ****
<a href="http://prdownloads.sf.net/phpxd/phpxd_0.3.tar.gz">
phpxd_0.3.tar.gz
! </a> (Size: 60568 Bytes)
</p>
--- 11,15 ----
<a href="http://prdownloads.sf.net/phpxd/phpxd_0.3.tar.gz">
phpxd_0.3.tar.gz
! </a> (Size: 60812 Bytes)
</p>
***************
*** 81,85 ****
(see above section)</li>
<li>EntityReferences are not expanded</li>
! <li>there is synchronization between Entities and
EntityReferences; thus if you're looking within one of the
EntityReference's children and the Entity changes, you won't
--- 81,85 ----
(see above section)</li>
<li>EntityReferences are not expanded</li>
! <li>there is no synchronization between Entities and
EntityReferences; thus if you're looking within one of the
EntityReference's children and the Entity changes, you won't
|
|
From: Thomas D. <th...@us...> - 2002-02-14 13:26:19
|
Update of /cvsroot/phpxd/phpXD/include/dom
In directory usw-pr-cvs1:/tmp/cvs-serv14657/include/dom
Modified Files:
Entity.php
Log Message:
Index: Entity.php
===================================================================
RCS file: /cvsroot/phpxd/phpXD/include/dom/Entity.php,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -r1.3 -r1.4
*** Entity.php 13 Feb 2002 21:21:47 -0000 1.3
--- Entity.php 14 Feb 2002 13:26:16 -0000 1.4
***************
*** 17,21 ****
/**
* If the entity is unparsed, notationName is the entity's notation
! * name. For parsed entities , this attribute is null.<br>
* DOM-Level 1
*
--- 17,21 ----
/**
* If the entity is unparsed, notationName is the entity's notation
! * name; for parsed entities, this attribute is null.<br>
* DOM-Level 1
*
|
|
From: Thomas D. <th...@us...> - 2002-02-14 13:17:45
|
Update of /cvsroot/phpxd/phpXD.www
In directory usw-pr-cvs1:/tmp/cvs-serv12373
Modified Files:
default.php
Log Message:
Index: default.php
===================================================================
RCS file: /cvsroot/phpxd/phpXD.www/default.php,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -r1.2 -r1.3
*** default.php 28 Jan 2002 19:37:26 -0000 1.2
--- default.php 14 Feb 2002 13:17:09 -0000 1.3
***************
*** 20,24 ****
require("classes/StaticSite.php");
! $URL = "http://phpxd.sf.net/";
$URL_TITLE = "phpXMLDOM";
--- 20,25 ----
require("classes/StaticSite.php");
! //$URL = "http://phpxd.sf.net/";
! $URL = "http://localhost/phpXDwww/";
$URL_TITLE = "phpXMLDOM";
|
|
From: Thomas D. <th...@us...> - 2002-02-14 13:17:19
|
Update of /cvsroot/phpxd/phpXD.www/include/phpXD
In directory usw-pr-cvs1:/tmp/cvs-serv12373/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.2
retrieving revision 1.3
diff -C2 -r1.2 -r1.3
*** phpXD.php 28 Jan 2002 19:37:26 -0000 1.2
--- phpXD.php 14 Feb 2002 13:17:14 -0000 1.3
***************
*** 399,411 ****
}
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));
! }
}
}
--- 399,404 ----
}
else {
! $this->lastNode =& $this->currentNode->appendChild(
! $this->document->createTextNode($text));
}
}
|
|
From: Thomas D. <th...@us...> - 2002-02-14 13:17:18
|
Update of /cvsroot/phpxd/phpXD.www/stylesheets
In directory usw-pr-cvs1:/tmp/cvs-serv12373/stylesheets
Modified Files:
screen.css
Log Message:
Index: screen.css
===================================================================
RCS file: /cvsroot/phpxd/phpXD.www/stylesheets/screen.css,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -r1.2 -r1.3
*** screen.css 7 Feb 2002 08:43:32 -0000 1.2
--- screen.css 14 Feb 2002 13:17:15 -0000 1.3
***************
*** 14,18 ****
color: #000000;
font-family: sans-serif;
- font-size: 1em;
margin: 1em;
padding: 0px;
--- 14,17 ----
***************
*** 44,47 ****
--- 43,56 ----
}
+ a:link.selected,
+ a:visited.selected,
+ a:hover.selected,
+ a:active.selected
+ {
+ background: none transparent;
+ color: #ff0000;
+ text-decoration: none;
+ }
+
h1
{
***************
*** 77,85 ****
}
! h2.navbar
{
! background: #eeeeff;
color: #000000;
! font-size: 0.9em;
margin: 0em;
padding: 0em;
--- 86,100 ----
}
! h4
{
! background: #ffffee;
color: #000000;
! font-size: 1em;
! font-weight: normal;
! font-style: italic;
! }
!
! ul li h3
! {
margin: 0em;
padding: 0em;
***************
*** 91,94 ****
--- 106,110 ----
color: #000000;
margin-top: 0em;
+ font-size: 1em;
}
***************
*** 102,105 ****
--- 118,127 ----
}
+ li pre
+ {
+ margin-bottom: 0em;
+ padding-bottom: 0em;
+ }
+
dd
{
***************
*** 117,126 ****
}
- p.bottombar img
- {
- background: #ffffff;
- margin: 0px;
- padding: 0px;
- }
.dokument
--- 139,142 ----
|
|
From: Thomas D. <th...@us...> - 2002-02-14 13:17:18
|
Update of /cvsroot/phpxd/phpXD.www/classes
In directory usw-pr-cvs1:/tmp/cvs-serv12373/classes
Modified Files:
Site.php
Log Message:
Index: Site.php
===================================================================
RCS file: /cvsroot/phpxd/phpXD.www/classes/Site.php,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -r1.2 -r1.3
*** Site.php 28 Jan 2002 19:37:26 -0000 1.2
--- Site.php 14 Feb 2002 13:17:13 -0000 1.3
***************
*** 118,122 ****
$this->navigation = "";
$linksDOM->normalize();
! $links =& $linksDOM->getElementsByTagName("li");
for ($i = 0; $i < $links->getLength(); ++$i) {
$link =& $links->item($i);
--- 118,127 ----
$this->navigation = "";
$linksDOM->normalize();
! $linksElem =& $linksDOM;
! while (($linksElem != null) &&
! ($linksElem->nodeType != ELEMENT_NODE)) {
! $linksElem =& $linksElem->nextSibling;
! }
! $links =& $linksElem->getElementsByTagName("li");
for ($i = 0; $i < $links->getLength(); ++$i) {
$link =& $links->item($i);
|
|
From: Thomas D. <th...@us...> - 2002-02-14 13:17:17
|
Update of /cvsroot/phpxd/phpXD.www/data/en
In directory usw-pr-cvs1:/tmp/cvs-serv12373/data/en
Modified Files:
readme.xml releases.xml
Log Message:
Index: readme.xml
===================================================================
RCS file: /cvsroot/phpxd/phpXD.www/data/en/readme.xml,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -r1.1 -r1.2
*** readme.xml 28 Jan 2002 19:37:26 -0000 1.1
--- readme.xml 14 Feb 2002 13:17:14 -0000 1.2
***************
*** 7,19 ****
<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>
--- 7,19 ----
<h1>ReadMe</h1>
<h2>Preface</h2>
! <p>This file relates to phpXD release 0.3.</p>
!
<h2>What is phpXMLDOM?</h2>
! <p>
! phpXMLDOM (phpXD) is an XML DOM-Implementation for PHP written in PHP.
! It offers methods for accessing the nodes of an XML document
! using the W3C Document Object Model Level 2 Core
! (DOM). phpXMLDOM does not require the PHP DOM XML extension.
! </p>
<h2>Requirements</h2>
***************
*** 22,66 ****
<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>
--- 22,102 ----
<li>PHP XML extension (configure PHP using --with-xml)</li>
</ul>
!
! <h2>Installation</h2>
<ul>
! <li>Unpack the files with
! <pre>
! tar -xzf phpxd_x.xx.tar.gz
! </pre></li>
! <li>Change variable $path in phpXD.php to the home directory of
! phpXMLDOM, for example:
! <pre>
! $path = "/home/thomi/phpXD";
! </pre></li>
</ul>
!
! <h2>Features</h2>
! <p>
! phpXMLDOM supports all interfaces of DOM Level 2 Core.
! </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>
! To read an XML file, create a DOMParser object:
! </p>
! <pre>
! $parser = new DOMParser();
! </pre>
!
! <p>
! You can parse an XML file and create the DOM tree with
! </p>
! <pre>
! $document =& $parser->parseFile("sample.xml");
! </pre>
!
! <p>
! or an XML string with
! </p>
! <pre>
! $document =& $parser->parse("<hello>1</hello>");
! </pre>
!
! <p>
! Both functions have an optional second parameter. You can set it
! "true" if you want to parse the DTD of your XML.
! </p>
!
! <p>
! If the document was succesfully parsed, $document contains the
! implementation of the DOM interface Document.
! </p>
! <p>
! You can get the root node with
! </p>
! <pre>
! $root =& $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
! <a href="http://www.w3.org/DOM/">http://www.w3.org/DOM/</a> or
! the <a href="$URL$doc/index.html">phpXMLDOM API documentation</a>.
! </p>
!
</content>
</page>
Index: releases.xml
===================================================================
RCS file: /cvsroot/phpxd/phpXD.www/data/en/releases.xml,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -r1.1 -r1.2
*** releases.xml 28 Jan 2002 19:37:26 -0000 1.1
--- releases.xml 14 Feb 2002 13:17:14 -0000 1.2
***************
*** 6,10 ****
<content>
<h1>Releases</h1>
! <h2>Current Release: phpXD 0.21</h2>
<h3>Release Notes</h3>
<ul>
--- 6,105 ----
<content>
<h1>Releases</h1>
! <h2>Current Release: phpXD 0.3</h2>
! <h3>Files</h3>
! <p>
! <a href="http://prdownloads.sf.net/phpxd/phpxd_0.3.tar.gz">
! phpxd_0.3.tar.gz
! </a> (Size: 60568 Bytes)
! </p>
!
! <h3>Release Notes</h3>
! <h4>Fixed Bugs</h4>
! <ul>
! <li>NodeList::removeNode did not decrease the length of the nodeList</li>
! <li>Node::normalize did not remove Text Nodes, whose data has been
! appended to a previous sibling during "normalization"</li>
! <li>bug in several functions handling XML Namespaces in Element.php
! and Document.php - the localname was not set correctly</li>
! </ul>
! <h4>New Directory/Files:</h4>
! <ul>
! <li>samples moved to /samples</li>
! <li>DOM classes moved to /include/dom</li>
! <li>Parser classes moved to /include/parser</li>
! <li>new DTD classes in /include/parser (DTDParser) and /include/dtd</li>
! <li>filenames have now the same spelling as classnames</li>
! </ul>
!
! <h4>New interface</h4>
! <ul>
! <li>class phpXD no longer exists</li>
! <li>to parse an XML file or string, use the functions
! DOMParser::parseFile and DOMParser::parse, for example:
! <pre>
! <?php
! $parser = new DOMParser();
! $document = $parser->parse("<hello>world</hello>");
! // $document is an instance of class Document!
! // echo documentElement
! echo $document->getDocumentElement();
! ?>
! </pre></li>
! <li>there is no longer a function to save XML; there are two
! new samples writer1 and writer2, which show how to output or
! save XML</li>
! </ul>
!
! <h4>Simple DTD parser</h4>
! <ul>
! <li>new class DTDParser to parse a DTD</li>
! <li>it is still experimental!</li>
! <li>DTDParser could be used from DOMParser, simply set the
! second parameter of DOMParser::parseFile or DOMParser:parse to
! true:
! <pre>
! <?php
! $parser = new DOMParser();
! // now the DTD is parsed
! $document = $parser->parse("<hello>world</hello>", true);
! // ...
! ?>
! </pre></li>
! <li>to use DTDParser without DOMParser use functions
! DTDParser::parse($str, $dtdonly) or DTDParser::parseFile($filename,
! $dtdonly); set $dtdonly to true, if $str or $filename is a single dtd
! without any XML markup, or to false, if the dtd is part of an XML
! document</li>
! </ul>
!
! <h4>Support for interfaces Entity, EntityReference and
! Notation added</h4>
! <ul>
! <li>DOM interfaces Entity, EntityReference and Notation are
! supported now</li>
! <li>to use them, the DTD must be parsed within DOMParser
! (see above section)</li>
! <li>EntityReferences are not expanded</li>
! <li>there is synchronization between Entities and
! EntityReferences; thus if you're looking within one of the
! EntityReference's children and the Entity changes, you won't
! be informed; instead you will continue to access the same
! object (in fact there is no valid way to change an Entity)</li>
! <li>also default attributes and the flag Attr::specified are
! supported now</li>
! <li>the behaviour of Attr::specified is a little different from DOM
! specification; it is set to false, if a default attribute is not set
! and if a attribute is set to the default value (because the
! XML parser makes no difference between this two cases)</li>
! </ul>
!
! <h2>Last Release: phpXD 0.21</h2>
! <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>
!
<h3>Release Notes</h3>
<ul>
***************
*** 19,28 ****
<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>
--- 114,117 ----
|
|
From: Thomas D. <th...@us...> - 2002-02-13 22:47:44
|
Update of /cvsroot/phpxd/phpXD/include/dom
In directory usw-pr-cvs1:/tmp/cvs-serv30957
Modified Files:
Document.php
Log Message:
Index: Document.php
===================================================================
RCS file: /cvsroot/phpxd/phpXD/include/dom/Document.php,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -r1.5 -r1.6
*** Document.php 13 Feb 2002 21:21:47 -0000 1.5
--- Document.php 13 Feb 2002 22:47:40 -0000 1.6
***************
*** 237,241 ****
function &createAttributeNS($namespaceURI, $qualifiedName) {
$prefix = substr($qualifiedName, 0, strpos($qualifiedName, ":"));
! $localName = substr($qualifiedName, strpos($this->nodeName, ":")+1);
if (empty($prefix) || empty($localName)) {
--- 237,241 ----
function &createAttributeNS($namespaceURI, $qualifiedName) {
$prefix = substr($qualifiedName, 0, strpos($qualifiedName, ":"));
! $localName = substr($qualifiedName, strpos($qualifiedName, ":")+1);
if (empty($prefix) || empty($localName)) {
***************
*** 279,283 ****
function &createElementNS($namespaceURI, $qualifiedName) {
$prefix = substr($qualifiedName, 0, strpos($qualifiedName, ":"));
! $localName = substr($qualifiedName, strpos($this->nodeName, ":")+1);
if (empty($prefix) || empty($localName)) {
--- 279,283 ----
function &createElementNS($namespaceURI, $qualifiedName) {
$prefix = substr($qualifiedName, 0, strpos($qualifiedName, ":"));
! $localName = substr($qualifiedName, strpos($qualifiedName, ":")+1);
if (empty($prefix) || empty($localName)) {
|
|
From: Thomas D. <th...@us...> - 2002-02-13 21:21:55
|
Update of /cvsroot/phpxd/phpXD/include/parser
In directory usw-pr-cvs1:/tmp/cvs-serv5097/include/parser
Modified Files:
DOMParser.php DTDParser.php
Log Message:
Index: DOMParser.php
===================================================================
RCS file: /cvsroot/phpxd/phpXD/include/parser/DOMParser.php,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -r1.6 -r1.7
*** DOMParser.php 8 Feb 2002 17:50:05 -0000 1.6
--- DOMParser.php 13 Feb 2002 21:21:48 -0000 1.7
***************
*** 1,4 ****
<?php
! // phpXD - a XML DOM Implementation
//
// This Software and all associated files are released unter the
--- 1,4 ----
<?php
! // phpXMLDOM - an XML DOM Implementation
//
// This Software and all associated files are released unter the
***************
*** 25,29 ****
/**
* The current Element node which is parsed. Only valid while
! * parsing a XML file!
*
* @private
--- 25,29 ----
/**
* The current Element node which is parsed. Only valid while
! * parsing an XML file!
*
* @private
***************
*** 33,37 ****
/**
! * The last node which is parsed. Only valid while parsing a XML file!
*
* @private
--- 33,37 ----
/**
! * The last node which is parsed. Only valid while parsing an XML file!
*
* @private
***************
*** 42,46 ****
/**
* A CDataSection is parsed. All strings will be collected to one
! * CDataSection node. Only valid while parsing a XML file!
*
* @private
--- 42,46 ----
/**
* A CDataSection is parsed. All strings will be collected to one
! * CDataSection node. Only valid while parsing an XML file!
*
* @private
Index: DTDParser.php
===================================================================
RCS file: /cvsroot/phpxd/phpXD/include/parser/DTDParser.php,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -r1.5 -r1.6
*** DTDParser.php 6 Feb 2002 23:10:48 -0000 1.5
--- DTDParser.php 13 Feb 2002 21:21:48 -0000 1.6
***************
*** 1,4 ****
<?php
! // phpXD - a XML DOM Implementation
//
// This Software and all associated files are released unter the
--- 1,4 ----
<?php
! // phpXMLDOM - an XML DOM Implementation
//
// This Software and all associated files are released unter the
|
|
From: Thomas D. <th...@us...> - 2002-02-13 21:21:55
|
Update of /cvsroot/phpxd/phpXD/include/dom In directory usw-pr-cvs1:/tmp/cvs-serv5097/include/dom Modified Files: Attr.php CDataSection.php CharacterData.php Comment.php DOMException.php DOMImplementation.php Document.php DocumentFragment.php DocumentType.php Element.php Entity.php EntityReference.php NamedNodeMap.php Node.php NodeList.php Notation.php ProcessingInstruction.php Text.php Log Message: Index: Attr.php =================================================================== RCS file: /cvsroot/phpxd/phpXD/include/dom/Attr.php,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -r1.2 -r1.3 *** Attr.php 6 Feb 2002 23:07:51 -0000 1.2 --- Attr.php 13 Feb 2002 21:21:47 -0000 1.3 *************** *** 1,4 **** <?php ! // phpXD - a XML DOM Implementation // // This Software and all associated files are released unter the --- 1,4 ---- <?php ! // phpXMLDOM - an XML DOM Implementation // // This Software and all associated files are released unter the Index: CDataSection.php =================================================================== RCS file: /cvsroot/phpxd/phpXD/include/dom/CDataSection.php,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -r1.2 -r1.3 *** CDataSection.php 6 Feb 2002 23:07:51 -0000 1.2 --- CDataSection.php 13 Feb 2002 21:21:47 -0000 1.3 *************** *** 1,4 **** <?php ! // phpXD - a XML DOM Implementation // // This Software and all associated files are released unter the --- 1,4 ---- <?php ! // phpXMLDOM - an XML DOM Implementation // // This Software and all associated files are released unter the Index: CharacterData.php =================================================================== RCS file: /cvsroot/phpxd/phpXD/include/dom/CharacterData.php,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -r1.2 -r1.3 *** CharacterData.php 6 Feb 2002 23:07:51 -0000 1.2 --- CharacterData.php 13 Feb 2002 21:21:47 -0000 1.3 *************** *** 1,4 **** <?php ! // phpXD - a XML DOM Implementation // // This Software and all associated files are released unter the --- 1,4 ---- <?php ! // phpXMLDOM - an XML DOM Implementation // // This Software and all associated files are released unter the Index: Comment.php =================================================================== RCS file: /cvsroot/phpxd/phpXD/include/dom/Comment.php,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -r1.2 -r1.3 *** Comment.php 6 Feb 2002 23:08:33 -0000 1.2 --- Comment.php 13 Feb 2002 21:21:47 -0000 1.3 *************** *** 1,4 **** <?php ! // phpXD - a XML DOM Implementation // // This Software and all associated files are released unter the --- 1,4 ---- <?php ! // phpXMLDOM - an XML DOM Implementation // // This Software and all associated files are released unter the Index: DOMException.php =================================================================== RCS file: /cvsroot/phpxd/phpXD/include/dom/DOMException.php,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -r1.2 -r1.3 *** DOMException.php 6 Feb 2002 23:07:51 -0000 1.2 --- DOMException.php 13 Feb 2002 21:21:47 -0000 1.3 *************** *** 1,4 **** <?php ! // phpXD - a XML DOM Implementation // // This Software and all associated files are released unter the --- 1,4 ---- <?php ! // phpXMLDOM - an XML DOM Implementation // // This Software and all associated files are released unter the Index: DOMImplementation.php =================================================================== RCS file: /cvsroot/phpxd/phpXD/include/dom/DOMImplementation.php,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -r1.4 -r1.5 *** DOMImplementation.php 6 Feb 2002 23:07:51 -0000 1.4 --- DOMImplementation.php 13 Feb 2002 21:21:47 -0000 1.5 *************** *** 1,4 **** <?php ! // phpXD - a XML DOM Implementation // // This Software and all associated files are released unter the --- 1,4 ---- <?php ! // phpXMLDOM - an XML DOM Implementation // // This Software and all associated files are released unter the Index: Document.php =================================================================== RCS file: /cvsroot/phpxd/phpXD/include/dom/Document.php,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -r1.4 -r1.5 *** Document.php 8 Feb 2002 17:48:12 -0000 1.4 --- Document.php 13 Feb 2002 21:21:47 -0000 1.5 *************** *** 1,4 **** <?php ! // phpXD - a XML DOM Implementation // // This Software and all associated files are released unter the --- 1,4 ---- <?php ! // phpXMLDOM - an XML DOM Implementation // // This Software and all associated files are released unter the Index: DocumentFragment.php =================================================================== RCS file: /cvsroot/phpxd/phpXD/include/dom/DocumentFragment.php,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -r1.2 -r1.3 *** DocumentFragment.php 6 Feb 2002 23:07:51 -0000 1.2 --- DocumentFragment.php 13 Feb 2002 21:21:47 -0000 1.3 *************** *** 1,4 **** <?php ! // phpXD - a XML DOM Implementation // // This Software and all associated files are released unter the --- 1,4 ---- <?php ! // phpXMLDOM - an XML DOM Implementation // // This Software and all associated files are released unter the Index: DocumentType.php =================================================================== RCS file: /cvsroot/phpxd/phpXD/include/dom/DocumentType.php,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -r1.2 -r1.3 *** DocumentType.php 6 Feb 2002 23:07:51 -0000 1.2 --- DocumentType.php 13 Feb 2002 21:21:47 -0000 1.3 *************** *** 1,4 **** <?php ! // phpXD - a XML DOM Implementation // // This Software and all associated files are released unter the --- 1,4 ---- <?php ! // phpXMLDOM - an XML DOM Implementation // // This Software and all associated files are released unter the Index: Element.php =================================================================== RCS file: /cvsroot/phpxd/phpXD/include/dom/Element.php,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -r1.3 -r1.4 *** Element.php 8 Feb 2002 17:48:12 -0000 1.3 --- Element.php 13 Feb 2002 21:21:47 -0000 1.4 *************** *** 1,4 **** <?php ! // phpXD - a XML DOM Implementation // // This Software and all associated files are released unter the --- 1,4 ---- <?php ! // phpXMLDOM - an XML DOM Implementation // // This Software and all associated files are released unter the Index: Entity.php =================================================================== RCS file: /cvsroot/phpxd/phpXD/include/dom/Entity.php,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -r1.2 -r1.3 *** Entity.php 6 Feb 2002 23:07:51 -0000 1.2 --- Entity.php 13 Feb 2002 21:21:47 -0000 1.3 *************** *** 1,4 **** <?php ! // phpXD - a XML DOM Implementation // // This Software and all associated files are released unter the --- 1,4 ---- <?php ! // phpXMLDOM - an XML DOM Implementation // // This Software and all associated files are released unter the Index: EntityReference.php =================================================================== RCS file: /cvsroot/phpxd/phpXD/include/dom/EntityReference.php,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -r1.2 -r1.3 *** EntityReference.php 6 Feb 2002 23:07:51 -0000 1.2 --- EntityReference.php 13 Feb 2002 21:21:47 -0000 1.3 *************** *** 1,4 **** <?php ! // phpXD - a XML DOM Implementation // // This Software and all associated files are released unter the --- 1,4 ---- <?php ! // phpXMLDOM - an XML DOM Implementation // // This Software and all associated files are released unter the Index: NamedNodeMap.php =================================================================== RCS file: /cvsroot/phpxd/phpXD/include/dom/NamedNodeMap.php,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -r1.2 -r1.3 *** NamedNodeMap.php 6 Feb 2002 23:07:51 -0000 1.2 --- NamedNodeMap.php 13 Feb 2002 21:21:47 -0000 1.3 *************** *** 1,4 **** <?php ! // phpXD - a XML DOM Implementation // // This Software and all associated files are released unter the --- 1,4 ---- <?php ! // phpXMLDOM - an XML DOM Implementation // // This Software and all associated files are released unter the Index: Node.php =================================================================== RCS file: /cvsroot/phpxd/phpXD/include/dom/Node.php,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -r1.3 -r1.4 *** Node.php 6 Feb 2002 23:07:51 -0000 1.3 --- Node.php 13 Feb 2002 21:21:47 -0000 1.4 *************** *** 1,4 **** <?php ! // phpXD - a XML DOM Implementation // // This Software and all associated files are released unter the --- 1,4 ---- <?php ! // phpXMLDOM - an XML DOM Implementation // // This Software and all associated files are released unter the Index: NodeList.php =================================================================== RCS file: /cvsroot/phpxd/phpXD/include/dom/NodeList.php,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -r1.4 -r1.5 *** NodeList.php 6 Feb 2002 23:07:51 -0000 1.4 --- NodeList.php 13 Feb 2002 21:21:47 -0000 1.5 *************** *** 1,4 **** <?php ! // phpXD - a XML DOM Implementation // // This Software and all associated files are released unter the --- 1,4 ---- <?php ! // phpXMLDOM - an XML DOM Implementation // // This Software and all associated files are released unter the Index: Notation.php =================================================================== RCS file: /cvsroot/phpxd/phpXD/include/dom/Notation.php,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -r1.1 -r1.2 *** Notation.php 6 Feb 2002 23:07:51 -0000 1.1 --- Notation.php 13 Feb 2002 21:21:47 -0000 1.2 *************** *** 1,4 **** <?php ! // phpXD - a XML DOM Implementation // // This Software and all associated files are released unter the --- 1,4 ---- <?php ! // phpXMLDOM - an XML DOM Implementation // // This Software and all associated files are released unter the Index: ProcessingInstruction.php =================================================================== RCS file: /cvsroot/phpxd/phpXD/include/dom/ProcessingInstruction.php,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -r1.2 -r1.3 *** ProcessingInstruction.php 6 Feb 2002 23:07:51 -0000 1.2 --- ProcessingInstruction.php 13 Feb 2002 21:21:47 -0000 1.3 *************** *** 1,4 **** <?php ! // phpXD - a XML DOM Implementation // // This Software and all associated files are released unter the --- 1,4 ---- <?php ! // phpXMLDOM - an XML DOM Implementation // // This Software and all associated files are released unter the Index: Text.php =================================================================== RCS file: /cvsroot/phpxd/phpXD/include/dom/Text.php,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -r1.2 -r1.3 *** Text.php 6 Feb 2002 23:07:51 -0000 1.2 --- Text.php 13 Feb 2002 21:21:47 -0000 1.3 *************** *** 1,4 **** <?php ! // phpXD - a XML DOM Implementation // // This Software and all associated files are released unter the --- 1,4 ---- <?php ! // phpXMLDOM - an XML DOM Implementation // // This Software and all associated files are released unter the |
|
From: Thomas D. <th...@us...> - 2002-02-13 21:21:55
|
Update of /cvsroot/phpxd/phpXD/include/dtd In directory usw-pr-cvs1:/tmp/cvs-serv5097/include/dtd Modified Files: DTDAttList.php DTDAttribute.php DTDElement.php DTDElementChild.php DTDElementChoice.php DTDElementSequence.php Log Message: Index: DTDAttList.php =================================================================== RCS file: /cvsroot/phpxd/phpXD/include/dtd/DTDAttList.php,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -r1.1 -r1.2 *** DTDAttList.php 6 Feb 2002 23:00:41 -0000 1.1 --- DTDAttList.php 13 Feb 2002 21:21:48 -0000 1.2 *************** *** 1,4 **** <?php ! // phpXD - a XML DOM Implementation // // This Software and all associated files are released unter the --- 1,4 ---- <?php ! // phpXMLDOM - an XML DOM Implementation // // This Software and all associated files are released unter the Index: DTDAttribute.php =================================================================== RCS file: /cvsroot/phpxd/phpXD/include/dtd/DTDAttribute.php,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -r1.1 -r1.2 *** DTDAttribute.php 6 Feb 2002 23:00:42 -0000 1.1 --- DTDAttribute.php 13 Feb 2002 21:21:48 -0000 1.2 *************** *** 1,4 **** <?php ! // phpXD - a XML DOM Implementation // // This Software and all associated files are released unter the --- 1,4 ---- <?php ! // phpXMLDOM - an XML DOM Implementation // // This Software and all associated files are released unter the Index: DTDElement.php =================================================================== RCS file: /cvsroot/phpxd/phpXD/include/dtd/DTDElement.php,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -r1.1 -r1.2 *** DTDElement.php 6 Feb 2002 23:00:42 -0000 1.1 --- DTDElement.php 13 Feb 2002 21:21:48 -0000 1.2 *************** *** 1,4 **** <?php ! // phpXD - a XML DOM Implementation // // This Software and all associated files are released unter the --- 1,4 ---- <?php ! // phpXMLDOM - an XML DOM Implementation // // This Software and all associated files are released unter the Index: DTDElementChild.php =================================================================== RCS file: /cvsroot/phpxd/phpXD/include/dtd/DTDElementChild.php,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -r1.1 -r1.2 *** DTDElementChild.php 6 Feb 2002 23:00:42 -0000 1.1 --- DTDElementChild.php 13 Feb 2002 21:21:48 -0000 1.2 *************** *** 1,4 **** <?php ! // phpXD - a XML DOM Implementation // // This Software and all associated files are released unter the --- 1,4 ---- <?php ! // phpXMLDOM - an XML DOM Implementation // // This Software and all associated files are released unter the Index: DTDElementChoice.php =================================================================== RCS file: /cvsroot/phpxd/phpXD/include/dtd/DTDElementChoice.php,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -r1.1 -r1.2 *** DTDElementChoice.php 6 Feb 2002 23:00:42 -0000 1.1 --- DTDElementChoice.php 13 Feb 2002 21:21:48 -0000 1.2 *************** *** 1,4 **** <?php ! // phpXD - a XML DOM Implementation // // This Software and all associated files are released unter the --- 1,4 ---- <?php ! // phpXMLDOM - an XML DOM Implementation // // This Software and all associated files are released unter the Index: DTDElementSequence.php =================================================================== RCS file: /cvsroot/phpxd/phpXD/include/dtd/DTDElementSequence.php,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -r1.1 -r1.2 *** DTDElementSequence.php 6 Feb 2002 23:00:42 -0000 1.1 --- DTDElementSequence.php 13 Feb 2002 21:21:48 -0000 1.2 *************** *** 1,4 **** <?php ! // phpXD - a XML DOM Implementation // // This Software and all associated files are released unter the --- 1,4 ---- <?php ! // phpXMLDOM - an XML DOM Implementation // // This Software and all associated files are released unter the |
|
From: Thomas D. <th...@us...> - 2002-02-13 21:21:54
|
Update of /cvsroot/phpxd/phpXD/include In directory usw-pr-cvs1:/tmp/cvs-serv5097/include Modified Files: dom.php dtd.php parser.php Log Message: Index: dom.php =================================================================== RCS file: /cvsroot/phpxd/phpXD/include/dom.php,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -r1.2 -r1.3 *** dom.php 6 Feb 2002 23:23:22 -0000 1.2 --- dom.php 13 Feb 2002 21:21:47 -0000 1.3 *************** *** 1,4 **** <?php ! // phpXD - a XML DOM Implementation // // This Software and all associated files are released unter the --- 1,4 ---- <?php ! // phpXMLDOM - an XML DOM Implementation // // This Software and all associated files are released unter the Index: dtd.php =================================================================== RCS file: /cvsroot/phpxd/phpXD/include/dtd.php,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -r1.1 -r1.2 *** dtd.php 6 Feb 2002 22:58:43 -0000 1.1 --- dtd.php 13 Feb 2002 21:21:47 -0000 1.2 *************** *** 1,4 **** <?php ! // phpXD - a XML DOM Implementation // // This Software and all associated files are released unter the --- 1,4 ---- <?php ! // phpXMLDOM - an XML DOM Implementation // // This Software and all associated files are released unter the Index: parser.php =================================================================== RCS file: /cvsroot/phpxd/phpXD/include/parser.php,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -r1.1 -r1.2 *** parser.php 26 Jan 2002 13:20:01 -0000 1.1 --- parser.php 13 Feb 2002 21:21:47 -0000 1.2 *************** *** 1,4 **** <?php ! // phpXD - a XML DOM Implementation // // This Software and all associated files are released unter the --- 1,4 ---- <?php ! // phpXMLDOM - an XML DOM Implementation // // This Software and all associated files are released unter the |
|
From: Thomas D. <th...@us...> - 2002-02-13 21:21:53
|
Update of /cvsroot/phpxd/phpXD In directory usw-pr-cvs1:/tmp/cvs-serv5097 Modified Files: phpXD.php Log Message: Index: phpXD.php =================================================================== RCS file: /cvsroot/phpxd/phpXD/phpXD.php,v retrieving revision 1.27 retrieving revision 1.28 diff -C2 -r1.27 -r1.28 *** phpXD.php 9 Feb 2002 17:46:11 -0000 1.27 --- phpXD.php 13 Feb 2002 21:21:47 -0000 1.28 *************** *** 1,4 **** <?php ! // phpXD - a XML DOM Implementation // // This Software and all associated files are released unter the --- 1,4 ---- <?php ! // phpXMLDOM - an XML DOM Implementation // // This Software and all associated files are released unter the *************** *** 7,12 **** // $Id$ ! // Set the phpXD install path. ! $path = "f:/www/phpXD/"; require($path."include/dom.php"); --- 7,12 ---- // $Id$ ! // Set $path to the home directory of phpXMLDOM: ! $path = "."; require($path."include/dom.php"); |
|
From: Thomas D. <th...@us...> - 2002-02-13 21:12:39
|
Update of /cvsroot/phpxd/phpXD/samples/writer1
In directory usw-pr-cvs1:/tmp/cvs-serv2640/samples/writer1
Added Files:
writer1.php
Log Message:
The beginning of more samples... :=)
--- NEW FILE: writer1.php ---
<?php
// phpXMLDOM - an XML DOM Implementation
//
// This Software and all associated files are released unter the
// GNU Public License (GPL), see LICENSE for details.
//
// $Id: writer1.php,v 1.1 2002/02/13 21:12:25 thomi Exp $
/**
* Sample PHP script for using phpXMLDOM. Loads the file ../files/sample.xml
* and prints it as HTML.
*
* @package phpXD
* @author Thomas Dohmke <th...@do...>
* @version $Revision: 1.1 $
*/
require("../../phpXD.php");
function write(&$document, $trim = false) {
writeToString($document, $trim, $text);
echo $text;
}
function writeToString(&$dom, $deep = 0, &$text) {
$space = "";
for ($i = 0; $i < $deep; $i++) $space .= " ";
if ($dom->nodeType == CDATA_SECTION_NODE) {
$text .= $space;
$text .= "<span style=\"color:#990000\">";
$text .= "<![CDATA[";
$output = htmlspecialchars($dom->getData());
if (!(strpos($output, "\n") === false)) {
$break = "<br />";
}
else {
$break = "";
$space = "";
}
$text .= $break.$space;
$output = str_replace(" ", " ", $output);
$output = str_replace("\n", "<br />".$space, $output);
$output = str_replace("\t", " ", $output);
$text .= $output;
$text .= $break.$space;
$text .= "]]><br />";
$text .= "</span>";
}
if ($dom->nodeType == COMMENT_NODE) {
$text .= $space;
$text .= "<span style=\"color:#990099\">";
$text .= "<!--";
$output = htmlspecialchars($dom->getData());
if (!(strpos($output, "\n") === false)) {
$break = "<br />";
}
else {
$break = "";
$space = "";
}
$text .= $break.$space;
$output = str_replace(" ", " ", $output);
$output = str_replace("\n", "<br />".$space, $output);
$output = str_replace("\t", " ", $output);
$text .= $output;
$text .= $break.$space;
$text .= "--><br />";
$text .= "</span>";
}
if ($dom->nodeType == DOCUMENT_NODE) {
$text .= "<pre>";
$text .= "<span style=\"color:#009900\">";
$text .= "<?xml version=\"1.0\"?><br />";
$text .= "</span>";
if (!empty($dom->doctype)) {
if (!empty($dom->doctype->publicId) && !empty($dom->doctype->systemId)) {
$text .= "<!DOCTYPE ".$dom->doctype->name." PUBLIC ".
$dom->doctype->publicId." ".$dom->doctype->systemId;
}
else {
if (!empty($dom->doctype->systemId)) {
$text .= "<!DOCTYPE ".$dom->doctype->name." SYSTEM ".
$dom->doctype->systemId;
}
else {
$text .= "<!DOCTYPE ".$dom->doctype->name;
}
}
$text .= " (...)";
$text .= ">\n";
}
if ($dom->hasChildNodes()) {
writeToString($dom->firstChild, $deep, $text);
}
$text .= "</pre>";
}
if ($dom->nodeType == DOCUMENT_FRAGMENT_NODE) {
writeToString($dom->firstChild, $deep, $text);
}
if ($dom->nodeType == ELEMENT_NODE) {
$text .= $space;
$text .= "<span style=\"color:#000099\">";
$text .= "<".$dom->tagName;
if (isset($dom->attributes)) {
for ($i = 0; $i < $dom->attributes->getLength(); $i++) {
$elem =& $dom->attributes->item($i);
if ($elem->specified == true) {
$text .= " ".$elem->getName()."=\"".$elem->getValue()."\"";
}
}
}
if ($dom->hasChildNodes()) {
$text .= "><br />";
$text .= "</span>";
writeToString($dom->firstChild, $deep+4, $text);
$text .= $space;
$text .= "<span style=\"color:#000099\">";
$text .= "</".$dom->tagName."><br />";
$text .= "</span>";
}
else {
$text .= " /><br />";
$text .= "</span>";
}
}
if ($dom->nodeType == ENTITY_REFERENCE_NODE) {
if ($dom->hasChildNodes()) {
writeToString($dom->firstChild, $deep, $text);
}
}
if ($dom->nodeType == TEXT_NODE) {
$text .= "<span style=\"color:#000000\">";
if (trim($dom->getData()) != "") {
$text .= $space;
$data = trim($dom->getData());
$data = str_replace("\t", " ", $data);
while (!(strpos($data, " ") === false)) {
$data = str_replace(" ", " ", $data);
}
$data = htmlspecialchars($data);
$data = str_replace("\n ", "\n", $data);
$data = str_replace("\n", "\n".$space, $data);
$text .= $data;
if (trim($dom->getData()) != "") {
$text .= "<br />";
}
}
$text .= "</span>";
}
if ($dom->nodeType == PROCESSING_INSTRUCTION_NODE) {
$text .= $space;
$text .= "<span style=\"color:#999900\">";
$text .= "<?".$dom->getTarget()." ";
$output = htmlspecialchars($dom->getData());
$output = trim($output);
$output = str_replace(" ", " ", $output);
$output = str_replace("\t", " ", $output);
if (!(strpos($output, "\n")) === false) {
$output = "<br />".$space.$output."<br />".$space;
$output = str_replace("\n", "<br />".$space, $output);
$text .= $output;
$text .= "?><br />";
}
else {
$text .= $output;
$text .= " ?><br />";
}
$text .= "</span>";
}
if (isset($dom->nextSibling)) {
writeToString($dom->nextSibling, $deep, $text);
}
}
function htmlHeader() {
echo '<?xml version="1.0"?>';
echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" '.
'"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">';
echo '<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">';
echo '<head><title>phpXMLDOM: Samples - writer2.php</title></head>';
echo '<body>';
}
function htmlFooter() {
echo '</body>';
echo '</html>';
}
htmlHeader();
$parser = new DOMParser();
$document = $parser->parseFile("../files/sample.xml", true);
write($document);
htmlFooter();
?>
|
|
From: Thomas D. <th...@us...> - 2002-02-13 21:12:38
|
Update of /cvsroot/phpxd/phpXD/samples/writer2
In directory usw-pr-cvs1:/tmp/cvs-serv2640/samples/writer2
Added Files:
writer2.php
Log Message:
The beginning of more samples... :=)
--- NEW FILE: writer2.php ---
<?php
// phpXMLDOM - an XML DOM Implementation
//
// This Software and all associated files are released unter the
// GNU Public License (GPL), see LICENSE for details.
//
// $Id: writer2.php,v 1.1 2002/02/13 21:12:26 thomi Exp $
/**
* Sample PHP script for using phpXMLDOM. Loads the file ../files/sample.xml
* and prints it as XML.
*
* @package phpXD
* @author Thomas Dohmke <th...@do...>
* @version $Revision: 1.1 $
*/
require("../../phpXD.php");
function write(&$document, $trim = false) {
writeToString($document, $trim, $text);
echo $text;
}
function writeToFile(&$document, $file, $trim = false) {
$fp = fopen($file, "w");
fwrite($fp, "<?xml version=\"1.0\"?>\n");
writeToString($document, $trim, $text);
fwrite($fp, $text);
fclose($fp);
}
function writeToString(&$dom, $trim, &$text) {
if ($dom->nodeType == CDATA_SECTION_NODE) {
$text .= "<![CDATA[";
$text .= $dom->getData();
$text .= "]]>";
}
if ($dom->nodeType == COMMENT_NODE) {
$text .= "<!--";
$text .= $dom->getData();
$text .= "-->";
}
if ($dom->nodeType == DOCUMENT_NODE) {
$text .= "<?xml version=\"1.0\"?>\n";
if ($dom->hasChildNodes()) {
writeToString($dom->firstChild, $trim, $text);
}
}
if ($dom->nodeType == DOCUMENT_FRAGMENT_NODE) {
writeToString($dom->firstChild, $trim, $text);
}
if ($dom->nodeType == ELEMENT_NODE) {
$text .= "<".$dom->tagName;
if (isset($dom->attributes)) {
for ($i = 0; $i < $dom->attributes->getLength(); $i++) {
$elem =& $dom->attributes->item($i);
if ($elem->specified) {
$text .= " ".$elem->getName()."=\"".$elem->getValue()."\"";
}
}
}
if ($dom->hasChildNodes()) {
$text .= ">";
writeToString($dom->firstChild, $trim, $text);
$text .= "</".$dom->tagName.">";
}
else {
$text .= " />";
}
}
if ($dom->nodeType == ENTITY_REFERENCE_NODE) {
if ($dom->hasChildNodes()) {
writeToStrring($dom->firstChild, $text, $trim);
}
}
if ($dom->nodeType == PROCESSING_INSTRUCTION_NODE) {
$output = $dom->getData();
if ($trim) {
$output = str_replace("\t", " ", $output);
$output = preg_replace('= =', ' ', $output);
$output = str_replace("\n ", "\n", $output);
}
$text .= "<?".$dom->getTarget()." ";
$text .= $output;
$text .= "?>";
}
if ($dom->nodeType == TEXT_NODE) {
if ($trim) {
$output = $dom->getData();
$output = str_replace("\t", " ", $output);
$output = preg_replace('= =', ' ', $output);
$output = str_replace("\n ", "\n", $output);
$text .= $output;
}
else {
$text .= $dom->getData();
}
}
if (isset($dom->nextSibling)) {
writeToString($dom->nextSibling, $trim, $text);
}
}
$parser = new DOMParser();
$document = $parser->parseFile("../files/sample.xml");
header("Content-Type: text/xml");
write($document, true);
?>
|
|
From: Thomas D. <th...@us...> - 2002-02-13 21:12:38
|
Update of /cvsroot/phpxd/phpXD/samples/files In directory usw-pr-cvs1:/tmp/cvs-serv2640/samples/files Added Files: sample.xml Log Message: The beginning of more samples... :=) --- NEW FILE: sample.xml --- <?xml version="1.0"?> <hello> This is a sample dokument. Here are some XML features. <a_child attribute="value"> Hello World. </a_child> <an_empty_child /> <!-- This is a comment... --> <![CDATA[ ... and this a CDATA-Section ... ]]> <?php // ... and this a Processing-Instruction echo "PHP is cool"; ?> </hello> |
|
From: Thomas D. <th...@us...> - 2002-02-13 21:12:37
|
Update of /cvsroot/phpxd/phpXD/samples In directory usw-pr-cvs1:/tmp/cvs-serv2640/samples Removed Files: sample.php sample.xml Log Message: The beginning of more samples... :=) --- sample.php DELETED --- --- sample.xml DELETED --- |
|
From: Thomas D. <th...@us...> - 2002-02-13 20:48:39
|
Update of /cvsroot/phpxd/phpXD/samples/writer1 In directory usw-pr-cvs1:/tmp/cvs-serv23757/samples/writer1 Log Message: Directory /cvsroot/phpxd/phpXD/samples/writer1 added to the repository |
|
From: Thomas D. <th...@us...> - 2002-02-13 20:48:39
|
Update of /cvsroot/phpxd/phpXD/samples/files In directory usw-pr-cvs1:/tmp/cvs-serv23757/samples/files Log Message: Directory /cvsroot/phpxd/phpXD/samples/files added to the repository |
|
From: Thomas D. <th...@us...> - 2002-02-13 20:48:37
|
Update of /cvsroot/phpxd/phpXD/samples/writer2 In directory usw-pr-cvs1:/tmp/cvs-serv23757/samples/writer2 Log Message: Directory /cvsroot/phpxd/phpXD/samples/writer2 added to the repository |
|
From: Thomas D. <th...@us...> - 2002-02-13 20:18:59
|
Update of /cvsroot/phpxd/phpXD In directory usw-pr-cvs1:/tmp/cvs-serv15017 Modified Files: README_DE Log Message: Index: README_DE =================================================================== RCS file: /cvsroot/phpxd/phpXD/README_DE,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -r1.3 -r1.4 *** README_DE 25 Nov 2001 17:52:19 -0000 1.3 --- README_DE 13 Feb 2002 20:18:50 -0000 1.4 *************** *** 8,28 **** README_DE ! 0. Vorwort ! Diese Readme ist erst der Anfang einer vollständigen Dokumentation für ! phpXD. Eine bessere Beschreibung von phpXD und seinen Klassen/Methoden ! bieten die Kommentare im Quellcode. ! ! 1. Was ist phpXD? ! ! phpXD ist eine Implementierung des XML DOM für PHP4. Es ermöglicht PHP ! Skripten den Zugriff auf XML Dokumente durch das W3C Document Object ! Model Level 2 (DOM). ! ! Die Unterschiede zu den PHP DOM XML Funktionen (die nur dann ! verfügbar sind, wenn PHP mit der Compileroption --with-dom=[DIR] ! konfiguriert wurde) sind, daß phpXD das offizielle W3C DOM (siehe ! http://www.w3.org/DOM/) implementiert und man PHP nicht neu ! compilieren muß, um phpXD zu benutzen. 2. Voraussetzungen --- 8,17 ---- README_DE ! 1. Was ist phpXMLDOM? ! phpXMLDOM (phpXD) ist eine Implementierung des XML DOM für PHP. Es ! ermöglicht PHP Skripten den Zugriff auf XML Dokumente durch das W3C ! Document Object Model Level 2 (DOM). phpXMLDOM benötigt nicht die PHP ! DOM XML Erweiterung. 2. Voraussetzungen *************** *** 31,81 **** - PHP XML Erweiterung (PHP muß mit der Option --with-xml compiliert werden) ! 3. Eigenschaften ! Im Moment unterstützt phpXD fast alle Schnittstellen des DOM Level 2. ! Nicht unterstützt werden: ! - Entity ! - EntityReference ! Die Klasse DocumentType ist noch nicht vollständig implementiert, da ! phpXD die DTD einer XML-Datei nicht interpretiert. Lediglich die ! Eigenschaften name, publicId, systemId und internalSubset werden ! gesetzt. Wenn man mit phpXD eine XML Datei mit DTD einliest und ! Änderungen an vornimmt, so wird beim Speichern die ursprüngliche DTD ! gespeichert. Da PHP4 keine Ausnahmen (Exceptions) unterstützt, ist die DOMException Klasse nicht implementiert. Stattdessen sind Fehlercodes definiert, die von einer Funktion, welche eine Ausnahme auslösen würde, als ! Rückgabewert zurückgegeben werden. ! 4. phpXD benutzen ! Zunächst muß man ein phpXD Objekt erstellen: ! $dom = new phpXD(); ! Als Parameter kann man dem Konstruktor einen Dateinamen auf eine ! XML-Datei übergeben: ! $dom = new phpXD("sample.xml"); ! Zum laden einer XML-Datei dient die loadFile-Funktion: ! $dom->loadFile("sample.xml"); ! Nach dem Laden steht das Document Objekt als Eigenschaft des phpXD ! Objektes zur Verfügung: ! $list =& $dom->document->getElementsByTagName("hello"); ! Auf das Root-Element hat man mit ! $root =& $dom->document->getDocumentElement(); Zugriff. Beim Benutzen der DOM Funktionen muß man, wenn ein DOM Objekt ! zurückgegeben werden soll, den "=&" Operator benutzen, da PHP bei "=" ! immer die Objekte kopiert, während der "=&" Operator Referenzen zurückgibt. Da das DOM letztlich ein Liste von Referenzen darstellt, könnte ein einziges "=" die gesamte Hierachie des DOM zerstören. ! Mehr Infos über das DOM und seine Klassen und Funktionen: ! http://www.w3.org/DOM/ - Schließlich kann man die XML Datei auch wieder abspeichern: - $dom->saveFile("new.xml"); --- 20,85 ---- - PHP XML Erweiterung (PHP muß mit der Option --with-xml compiliert werden) ! 3. Installation ! - Entpacken Sie die Datei mit ! tar -xzf phpxd_x.xx.tar.gz ! ! - Ändern Sie die Variable $path in der Datei phpXD.php auf das ! Home-Verzeichnis von phpXMLDOM, z.B.: ! $path = "/home/thomi/phpXMLDOM"; ! ! 4. Eigenschaften ! ! phpXMLDOM unterstützt alle Schnittstellen des DOM Level 2 Core. Da PHP4 keine Ausnahmen (Exceptions) unterstützt, ist die DOMException Klasse nicht implementiert. Stattdessen sind Fehlercodes definiert, die von einer Funktion, welche eine Ausnahme auslösen würde, als ! Rückgabewert zurückgegeben wird. ! 5. phpXMLDOM benutzen ! Um eine XML-Datei zu lesen, erstellen Sie zunächst ein DOMParser Objekt: ! $parser = new DOMParser(); ! Aus einer Datei können Sie nun das DOM wie folgt erzeugen: ! $document = $parser->parseFile("sample.xml"); ! und aus einem String: ! $document = $parser->parse("<hello>1</hello>"); ! Beide Funktionen haben einen zweiten, optionalen Parameter. Wird dieser ! auf "true" gesetzt, so wird beim Parsen des XML auch die DTD berücksichtigt. ! Wenn das Parsen erfolgreich war, beinhaltet die Variable $document die ! Implementierung des DOM-Interfaces Document. ! ! Auf das Root-Element hat man nun mit ! $root =& $document->getDocumentElement(); Zugriff. Beim Benutzen der DOM Funktionen muß man, wenn ein DOM Objekt ! zurückgegeben wird, den "=&" Operator benutzen, da PHP bei "=" ! immer die Objekte kopiert, während der "=&" Operator Referenzen ! zurückgegeben werden. Da das DOM letztlich ein Liste von Referenzen darstellt, könnte ein einziges "=" die gesamte Hierachie des DOM zerstören. ! Mehr Infos über das DOM und seine Klassen und Funktionen finden sich ! unter http://www.w3.org/DOM/ oder in der API Dokumentation von ! phpXMLDOM im Verzeichnis "doc/". ! ! 6. Homepage, Bugs, Feature Requests ! ! phpXMLDOM wird bei Sourceforge gehostet: http://sf.net/projects/phpd ! ! Wenn Sie Fehler finden oder Anregungen haben, benutzen Sie bitte den ! Bug Tracker auf ! http://sourceforge.net/tracker/?group_id=29609&atid=396748&func=browse ! ! oder den Tracker für "Feature Requests" unter ! http://sourceforge.net/tracker/?atid=396751&group_id=29609&func=browse ! ! oder senden Sie eine E-Mail mich: ! th...@do... |
|
From: Thomas D. <th...@us...> - 2002-02-13 20:18:44
|
Update of /cvsroot/phpxd/phpXD In directory usw-pr-cvs1:/tmp/cvs-serv14918 Modified Files: README Log Message: Index: README =================================================================== RCS file: /cvsroot/phpxd/phpXD/README,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -r1.4 -r1.5 *** README 25 Nov 2001 17:49:36 -0000 1.4 --- README 13 Feb 2002 20:18:35 -0000 1.5 *************** *** 8,27 **** README ! 0. Preface ! This Readme is only the beginning of a full documentation for ! phpXD. Please read the sources to get a better description of the ! classes and methods of phpXD. ! ! 1. What is phpXD? ! ! 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 Level 2 Core (DOM). ! ! The differences to the PHP DOM XML functions (only available if ! PHP was configured with --with-dom=[DIR]) are that phpXD ! implements the official W3C DOM (see http://www.w3.org/DOM/) and that ! you do not need to recompile PHP to use phpXD. 2. Requirements --- 8,17 ---- README ! 1. What is phpXMLDOM? ! phpXMLDOM (phpXD) is an XML DOM-Implementation for PHP written in PHP. ! It offers methods for accessing the nodes of an XML document using the W3C ! Document Object Model Level 2 Core (DOM). phpXMLDOM does not require ! the PHP DOM XML extension. 2. Requirements *************** *** 30,43 **** - PHP XML extension (configure PHP using --with-xml) ! 3. Features ! Currently phpXD supports nearly all interfaces of DOM Level 2. Not ! supported are: ! - Entity ! - EntityReference ! 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, phpXD keeps the original DTD if you will save the file. Because PHP4 doesn't support exceptions, the DOMException interface is --- 20,35 ---- - PHP XML extension (configure PHP using --with-xml) ! 3. Installation ! - Unpack the files with ! tar -xzf phpxd_x.xx.tar.gz ! ! - Change variable $path in phpXD.php to the home directory of ! phpXMLDOM, for example: ! $path = "/home/thomi/phpXD"; ! ! 4. Features ! ! phpXMLDOM supports all interfaces of DOM Level 2 Core. Because PHP4 doesn't support exceptions, the DOMException interface is *************** *** 46,75 **** returns an ExceptionCode. ! 4. Using phpXD ! First, create a phpXD object: ! $dom = new phpXD(); ! If you specify a XML file as the first parameter of the constructor, ! the file will be parsed and the DOM tree created: ! $dom = new phpXD("sample.xml"); ! You can load a XML file with ! $dom->loadFile("sample.xml"); ! To access the DOM tree, use the document attribute, e.g.: ! $list =& $dom->document->getElementsByTagName("hello"); You can get the root node with ! $root =& $dom->document->getDocumentElement(); ! 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. ! For more informations about the DOM interfaces see: ! http://www.w3.org/DOM/ ! Last but not least, you can save the DOM tree: ! $dom->saveFile("new.xml"); --- 38,81 ---- returns an ExceptionCode. ! 5. Using phpXMLDOM ! ! To read an XML file, create a DOMParser object: ! $parser = new DOMParser(); ! You can parse an XML file and create the DOM tree with ! $document =& $parser->parseFile("sample.xml"); ! or an XML string with ! $document =& $parser->parse("<hello>1</hello>"); ! Both functions have an optional second parameter. You can set it ! "true" if you want to parse the DTD of your XML. ! If the document was succesfully parsed, $document contains the ! implementation of the DOM interface Document. You can get the root node with ! $root =& $document->getDocumentElement(); ! 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. ! For more informations about the DOM interfaces see ! http://www.w3.org/DOM/ or the phpXMLDOM API documentation in the ! directory "doc/". ! ! 6. Homepage, Bugs, Feature Requests ! ! phpXMLDOM is hostet at Sourceforge: http://sf.net/projects/phpxd ! ! For bugs or feature requests, please use ! the Tracker for Bugs at ! http://sourceforge.net/tracker/?group_id=29609&atid=396748&func=browse ! ! or the Tracker for Feature Requests at ! http://sourceforge.net/tracker/?atid=396751&group_id=29609&func=browse ! or send me an email: ! th...@do... |