## Class TXmlDocument

Description

TXmlDocument class.

TXmlDocument represents a DOM representation of an XML file. Besides all properties and methods inherited from TXmlElement, you can load an XML file or string by loadFromFile or loadFromString. You can also get the version and encoding of the XML document by the Version and Encoding properties.

- since: 3.0
- version: $Revision: $ $Date: $
- author: Qiang Xue <qiang.xue@gmail.com>

Located in /Xml/TXmlDocument.php (line 237)

    TComponent
       |
       --TXmlElement
          |
          --TXmlDocument

Method Summary
TXmlDocument __construct ([string $version = '1.0'], [string $encoding = ''])
string getEncoding ()
string getVersion ()
boolean loadFromFile (string $file)
boolean loadFromString (string $string)
void saveToFile (string $file)
string saveToString ()
void setEncoding (string $encoding)
void setVersion (string $version)
Methods
Constructor __construct (line 253)

Constructor.

- access: public

TXmlDocument __construct ([string $version = '1.0'], [string $encoding = ''])

- string $version: version of this XML document
- string $encoding: encoding of this XML document

Redefinition of:

TXmlElement::__construct()
  Constructor.

getEncoding (line 279)

- return: encoding of this XML document
- access: public

string getEncoding ()
getVersion (line 263)

- return: version of this XML document
- access: public

string getVersion ()
loadFromFile (line 298)

Loads and parses an XML document.

- return: whether the XML file is parsed successfully
- access: public
- throws: TIOException if the file fails to be opened.

boolean loadFromFile (string $file)

- string $file: the XML file path

loadFromString (line 312)

Loads and parses an XML string.

The version and encoding will be determined based on the parsing result.

- return: whether the XML string is parsed successfully
- access: public

boolean loadFromString (string $string)

- string $string: the XML string

saveToFile (line 345)

Saves this XML document as an XML file.

- access: public
- throws: TIOException if the file cannot be written

void saveToFile (string $file)

- string $file: the name of the file to be stored with XML output

saveToString (line 360)

Saves this XML document as an XML string

- return: the XML string of this XML document
- access: public

string saveToString ()
setEncoding (line 287)

- access: public

void setEncoding (string $encoding)

- string $encoding: encoding of this XML document

setVersion (line 271)

- access: public

void setVersion (string $version)

- string $version: version of this XML document

#### Inherited Methods

Inherited From TXmlElement

> TXmlElement::__construct()
> TXmlElement::getAttribute()
> TXmlElement::getAttributes()
> TXmlElement::getElementByTagName()
> TXmlElement::getElements()
> TXmlElement::getElementsByTagName()
> TXmlElement::getHasAttribute()
> TXmlElement::getHasElement()
> TXmlElement::getParent()
> TXmlElement::getTagName()
> TXmlElement::getValue()
> TXmlElement::setAttribute()
> TXmlElement::setParent()
> TXmlElement::setTagName()
> TXmlElement::setValue()
> TXmlElement::toString()

Inherited From TComponent

> TComponent::attachEventHandler()
> TComponent::canGetProperty()
> TComponent::canSetProperty()
> TComponent::detachEventHandler()
> TComponent::evaluateExpression()
> TComponent::evaluateStatements()
> TComponent::getEventHandlers()
> TComponent::getSubProperty()
> TComponent::hasEvent()
> TComponent::hasEventHandler()
> TComponent::hasProperty()
> TComponent::raiseEvent()
> TComponent::setSubProperty()
> TComponent::__get()
> TComponent::__set()

Documentation generated on Sun, 04 Jun 2006 19:00:48 -0400 by phpDocumentor 1.3.0RC4