[Phpxd-commits] CVS: phpXD/include/dom DOMImplementation.php,1.1,1.2
Status: Beta
Brought to you by:
growbal
|
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 ----
|