PHP Classes
elePHPant
Icontem

dom xml class: An implementation of the DOM XML standard

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Info   View files View files (8)   DownloadInstall with Composer Download .zip   Reputation   Support forum   Blog    
Last Updated Ratings Unique User Downloads Download Rankings  
2003-10-25 (11 years ago) RSS 2.0 feedStarStarStarStar 64%Total: 4,645 All time: 555 This week: 1,049Down
Version License Categories  
phpdomxml 1.0GNU Lesser Genera...XML
Description Author  

phpdomxml is an implementation for XML's Document Object Model in PHP. The XML DOM is a programming interface for XML documents. It defines the way an XML document can be accessed and manipulated.
Somehow PHP is missing a simple DOM for XML and I liked the way Actionscript (and Javascript) uses the DOM to address information in an XML document. So I made this class to fix this aparent shortcoming in PHP.

Picture of Bas van Gaalen
Name: Bas van Gaalen <contact>
Classes: 1 package by
Country: The Netherlands The Netherlands
Age: 43
All time rank: 59018 in The Netherlands The Netherlands
Week rank: 1600 Down45 in The Netherlands The Netherlands Down

Details provided by the author  
phpdomxml-0.8.5 - an XML Document Object Model implementation for PHP 4.10+.
(c) copyright 2002-2003, Bas van Gaalen. All rights reserved.

This library may be distributed under the terms of the LICENSE, which is
included in this package.

phpdomxml does not rely on any external libraries like libxml. It does
however require the expat<tm> extension for PHP.

The methods and properties follow the design as layed out by the World Wide
Web Consorticum and as was implemented in ECMAScript or compatible languages
like Javascript and Actionscript. XML class does not support validating by
DTD through the document type definition. The document type is recorded when
reading an XML document, but not used.

This class is in beta-phase because it's not 100% w3c-compatible. Although
it is a work in progress, this class is production stable for most common
XML needs. I seriously doubt it will ever be 100% w3c standards compliant,
since I see no way of implementing some of the dualities as documented in
their standards. But I don't claim to be an expert, so if you find a way to
provide more standards compliant functionality, then feel free to do so.
But please, send a copy of the new source code to me.

Please send comments, questions or suggestions to bas-at-webtweakers-dot-com.

-----------------------------------------------------------------------------

IMPORTANT NOTE:

Please note that the behavior of createElement has changed. Version 0.8 had a
bug where the createElement would automatically attach the created element as
firstChild node - overwriting a possible node already there. Obviously this
behavior is not compliant with the specifications and thus now corrected.

The correct behavior for createElement is to create the requested element and
return it to the caller. It then can be appended, inserted or replaplaced into
another node. Be ware that this change has an impact on scripts already build
with this class! The correct behavior of createElement is demonstrated in the
example files - as in numerous online documentations.

-----------------------------------------------------------------------------

DOCUMENTATION NOTE:

I am not quite fond of writing lengthy documentation, as probably most
developers: it distracts from the work that needs to be done. ;-) But in this
case I am in a luxery position: there are numerous documentations and examples
on the internet available on how to implement DOM-compliant code. A nice and
simple one can be found here: http://www.w3schools.com/dom/dom_node.asp
I will add my own documentation later on.

-----------------------------------------------------------------------------

LIST OF IMPLEMENTED OBJECTS, METHODS AND PROPERTIES:

Objects:
	XML
	XMLNode
	XMLText

Methods:
	sendAndLoad
	send
	load
	parseXML
	toString
	hasChildNodes
	createTextNode
	createElement
	appendChild

Properties:
	attributes
	childNodes
	firstChild
	lastChild
	previousSibling
	nextSibling
	nodeName
	parentNode
	nodeType
	status
	error
	version
	encoding
	contentType
	docTypeDecl
	xmlDecl

-----------------------------------------------------------------------------

LIST OF METHODS THAT STILL NEED TO BE IMPLEMENTED:

Methods:
	insertBefore
	removeChild
	replaceChild
	more...

-----------------------------------------------------------------------------

FILES IN THIS PACKAGE:

CHANGES
	Changes, updates and fixes from first release till current release.

LICENSE
	A short license in BSD style.

README
	This file.

functest.php
	A functionality test case as well as an example script for most - all -
	functions of the XML class.

lib.xml.inc.php
	The DOM XML Class/library itself.

server.php
	A simple server script, used in the examples.

test4.xml
test5.xml
	Two simple XML files, used in the examples.

-----------------------------------------------------------------------------


  Files folder image Files  
File Role Description
Accessible without login Plain text file CHANGES Doc. Changes
Accessible without login Plain text file functest.php Test Full functionality test and example scripts
Plain text file lib.xml.inc.php Class Main class script
Accessible without login Plain text file LICENSE Lic. License
Accessible without login Plain text file README Doc. Important information
Accessible without login Plain text file server.php Aux. Server simulation - used in functest.php
Accessible without login Plain text file test4.xml Data Test XML file - used in functest.php
Accessible without login Plain text file test5.xml Data Test XML file - used in functest.php

 Version Control Unique User Downloads Download Rankings  
 0%Total:4,645All time:555
 This week:0This week:1,049Down
 User Ratings  
 
 All time
Utility:84%StarStarStarStarStar
Consistency:77%StarStarStarStar
Documentation:60%StarStarStarStar
Examples:-
Tests:82%StarStarStarStarStar
Videos:-
Overall:64%StarStarStarStar
Rank:611