Packageindex Classtrees Modulegroups Elementlist Report XML Files

File: /usr/local/apache_8080/htdocs/devel/Intra/class/phpdom/domxml_document.php
Document Object Model for PHP - phpDOM

Document

Node
   |
  +-- Document

The Document-Class

 

private class Document extends Node

The Document-Class
This is the base class for all dom documents (XML, XHTML, WML ...)

AuthorsDietmar Glachs <dietmar.glachs@salzburgresearch.at>
Versiondevel.0.4
Copyright2000 Salzburg Research Gesellschaft m.b.H.

 
Direct known subclasses: HTMLDocument

Methods inherited from Node

Node, Tag, appendChild, cloneNode, removeChild, getOwnerDocument, getFirstChild, getNextChild, getLastChild, getNodeById, hasChildNodes, hasMoreElements, getParentNode, getParent, getChildNodes, setNodeValue, getNodeValue, getAttributes, getNodeName, getNodeType, addElement, _internal_toString, _internal_cloneNode, _internal_selfCheck, _internal_getNodeById

Public Method Summary

object Element

getRoot()

getRoot returns the document root element
object Element

setRoot(object Element &$root)

setRoot same as setDocumentElement()
object NodeList

getElementsByTagName(string $NameToSearch)

getElementsByTagName returns a NodeList of all the elements with a given tag name

Private Method Summary

object DomDocument

create(string $root)

create() creates an empty Document
object DomDocument

createFromFile(string $url)

createFromFile creates a Document by reading an existing file
object DomDocument

createFromString(string $xmldocument)

createFromString creates a Document given in the string
object Element

setDocumentElement(object Element &$Element)

setDocumentElement sets the document root
object Element

getDocumentElement()

getDocumentElement provides direct access to the root element of the document
object XPath

getXPathContext()

getXPathContext creates an instance of an XPath object linked to the current document.
void

getDocType()

getDocType
object Node

getElementById(string $IdToSearch)

getElementById
string

toString()

toString returns the entire document as stringWarning: documentation is missing.
void

printDocument()

printDocument sends the entire document to the browser

Fields inherited from Node

$nodeName, $nodevalue, $attribute, $node

Private Field Summary

string

$doctype

Stores the type of the document! Currently not used!
object DomDocument

$document

Stores the link to the document document itself
object Element

$documentElement

Stores the root of the document

Public Method Details

getRoot

public object Element getRoot( )

  getRoot returns the document root element
returns the document root. An object of type Element will be returned.

Returns object Element

Deprecated Use getDocumentElement() instead
See Also getDocumentElement()

setRoot

public object Element setRoot( object Element &$root )

  setRoot same as setDocumentElement()
returns the document root. An object of type Element will be returned.

Parameter
object Element &$root
The new root element of the document!
Returns object Element

Deprecated Use setDocumentElement() instead
See Also setDocumentElement()

getElementsByTagName

public object NodeList getElementsByTagName( string $NameToSearch )

  getElementsByTagName returns a NodeList of all the elements with a given tag name
Returns a NodeList of all the Elements with a giventag name in the order in which they would be encountered in a preorder traversalof the Document tree.

Parameter
string $NameToSearch
The Name of the elements to collect and return.
Returns object NodeList


Private Method Details

create

private object DomDocument create( string $root )

  create() creates an empty Document
This function creates an empty Document! This function mustbe redefined by inheriting classes to provide an appropriate skeletonfor the deriving classes.

Parameter
string $root
The name of the root element!
Returns object DomDocument


createFromFile

private object DomDocument createFromFile( string $url )

  createFromFile creates a Document by reading an existing file
The function creates the Document by reading the File from the specified url. If thedocument is not valid, the function returns false.

Parameter
string $url
Returns object DomDocument


createFromString

private object DomDocument createFromString( string $xmldocument )

  createFromString creates a Document given in the string
The function creates the Document using the given string. If thedocument is not valid, the function returns false.

Parameter
string $xmldocument
Returns object DomDocument


setDocumentElement

private object Element setDocumentElement( object Element &$Element )

  setDocumentElement sets the document root
The root element of the document will be set. If aSet the document root. If the root has existing child nodes they will be destroyed!

Parameter
object Element &$Element
The new document root element
Returns object Element


getDocumentElement

private object Element getDocumentElement( )

  getDocumentElement provides direct access to the root element of the document
returns the document root. An object of type Element will be returned.

Returns object Element $root

Magic This i
See Also getRoot()

getXPathContext

private object XPath getXPathContext( )

  getXPathContext creates an instance of an XPath object linked to the current document.
returns an XPath object for searching the document with xpath-expressions.Usage:$xpo = $doc->getXPathContext( );$nlist = $xpo->eval( "//child::text()" );This example will retrieve all text nodes!

Returns object XPath

A new instance of the XPath object


getDocType

private void getDocType( )

  getDocType
currently does nothing

Returns void


getElementById

private object Node getElementById( string $IdToSearch )

  getElementById
parses the document for a node with the given "id" attribute!

Parameter
string $IdToSearch
Returns object Node


toString

private string toString( )

  toString returns the entire document as string
returns the document as string

Warning: documentation is missing.

Returns string $doc


printDocument

private void printDocument( )

  printDocument sends the entire document to the browser

Returns void


Private Field Details

$doctype

private string $doctype

>>""<<

Stores the type of the document! Currently not used!


$document

private object DomDocument $document

>><<

Stores the link to the document document itself


$documentElement

private object Element $documentElement

>><<

Stores the root of the document



Packageindex Classtrees Modulegroups Elementlist Report XML Files
PHPDoc 1.0beta