AnewtXMLDomDocument Class Reference

Document DOM node. More...

List of all members.

Public Member Functions

Constructor method
 __construct ()
 Create a new DOM document instance.
Property methods
These methods can used to get or set several properties of the document.

 get_document_type ()
 Get the document type.
 set_document_type ($doctype)
 Set the document type.
 get_content_type ()
 Get the content type.
 set_content_type ($content_type)
 Set the content type.
 get_encoding ()
 Get the document encoding.
 set_encoding ($encoding)
 Set the document encoding.
 get_standalone ()
 Get whether this document is standalone.
 set_standalone ($standalone)
 Set whether this document is standalone.
Node methods
These methods can be used to add new nodes to this document, or to create new nodes for this document. Note that you can also construct AnewtXMLDomNode subclasses directly.

 append_child ($root_element)
 Append a child element to this document.
create_element ($tagname, $attributes=null)
 Create a new element for this document.
create_text_node ($data)
 Create a text node for the given data.
create_raw_node ($data)
 Create a raw text node for the given data.
create_comment ($data)
 Create a comment node for the given data.
create_document_fragment ()
 Create a document fragment node.
Rendering methods
 render ()
 Render this document to a string.
 flush ()
 Flush output to the browser.
 flush_to_file ($filename)
 Flush output to a file.

Public Attributes

 $node_type = ANEWT_XML_DOM_DOCUMENT_NODE
 The node type.
 $node_name = '#document'
 The name of this node, depending on its type.
 $document_element = null
 Reference to the document element.

Protected Attributes

 $render_xml_declaration = null
 Whether to render the XML declaration.

Private Member Functions

 xml_declaration ()
 Return the XML declaration for this document.

Private Attributes

 $_xml_encoding = 'UTF-8'
 The character encoding for this document.
 $_xml_standalone = null
 Whether this document is specified to be standalone.
 $_xml_version = '1.0'
 The XML version for this document.
 $_content_type = 'text/xml'
 The content type for this document.
 $_doctype = null
 The document type declaration.
 $__object_id_counter = 0
 Object id counter.


Detailed Description

Document DOM node.

The Document interface represents the entire HTML or XML document. Conceptually, it is the root of the document tree, and provides the primary access to the document's data.

See also:
http://www.w3.org/TR/DOM-Level-3-Core/core.html#i-Document

Definition at line 400 of file dom.lib.php.


Member Function Documentation

AnewtXMLDomDocument::get_document_type (  ) 

Get the document type.

Returns:
The document type as string, or null if none is set.
See also:
set_document_type

Definition at line 488 of file dom.lib.php.

AnewtXMLDomDocument::set_document_type ( doctype  ) 

Set the document type.

Parameters:
$doctype The document type as string, or null to unset.
See also:
get_document_type

Definition at line 501 of file dom.lib.php.

AnewtXMLDomDocument::get_content_type (  ) 

Get the content type.

The default value is UTF-8.

Returns:
The content type as string.
See also:
set_content_type

Definition at line 515 of file dom.lib.php.

AnewtXMLDomDocument::set_content_type ( content_type  ) 

Set the content type.

Parameters:
$content_type The content type as string.
See also:
get_content_type

Definition at line 528 of file dom.lib.php.

AnewtXMLDomDocument::get_encoding (  ) 

Get the document encoding.

Returns:
Encoding as string, or null if none is set.
See also:
set_encoding

Definition at line 542 of file dom.lib.php.

AnewtXMLDomDocument::set_encoding ( encoding  ) 

Set the document encoding.

Parameters:
$encoding The encoding as string, or null to unset.
See also:
get_encoding

Definition at line 555 of file dom.lib.php.

AnewtXMLDomDocument::get_standalone (  ) 

Get whether this document is standalone.

This is a boolean value defaulting to null, which means no standalone attribute is added to the XML prolog.

Returns:
Boolean or null if not set.
See also:
set_standalone

Definition at line 571 of file dom.lib.php.

AnewtXMLDomDocument::set_standalone ( standalone  ) 

Set whether this document is standalone.

Parameters:
$standalone Boolean or null to unset.
See also:
get_standalone

Definition at line 584 of file dom.lib.php.

AnewtXMLDomDocument::append_child ( root_element  ) 

Append a child element to this document.

Documents can have only one child node (the document's root node), so this method can be called only once.

This method verrides the AnewtXMLDomNode::append_child() method to make sure there is only one top level element.

Parameters:
$root_element The root element to add.

Reimplemented from AnewtXMLDomNode.

Definition at line 610 of file dom.lib.php.

& AnewtXMLDomDocument::create_element ( tagname,
attributes = null 
)

Create a new element for this document.

You should add the returned instance to the document yourself.

Parameters:
$tagname The tag name for this element
$attributes Associative array with initial attribute values for this element (optional). This parameter is for convenience only; you can always set attributes later.
Returns:
New AnewtXMLDomElement instance.

Definition at line 638 of file dom.lib.php.

& AnewtXMLDomDocument::create_text_node ( data  ) 

Create a text node for the given data.

You should add the returned instance to the document yourself.

Parameters:
$data The textual data for this node.
Returns:
New AnewtXMLDomText instance.

Definition at line 657 of file dom.lib.php.

& AnewtXMLDomDocument::create_raw_node ( data  ) 

Create a raw text node for the given data.

This is useful to add XML snippets generated by other means to a DOM tree.

You should add the returned instance to the document yourself.

Parameters:
$data The textual data for this node.
Returns:
New AnewtXMLDomRaw instance.

Definition at line 679 of file dom.lib.php.

& AnewtXMLDomDocument::create_comment ( data  ) 

Create a comment node for the given data.

You should add the returned instance to the document yourself.

Parameters:
$data The comment text.
Returns:
New AnewtXMLDomComment instance.

Definition at line 698 of file dom.lib.php.

& AnewtXMLDomDocument::create_document_fragment (  ) 

Create a document fragment node.

You should add the returned instance to the document yourself.

Returns:
New AnewtXMLDomDocumentFragment instance.

Definition at line 714 of file dom.lib.php.

AnewtXMLDomDocument::render (  ) 

Render this document to a string.

Returns:
Rendered string with XML data.

Definition at line 734 of file dom.lib.php.

AnewtXMLDomDocument::flush (  ) 

Flush output to the browser.

This serializes the document into a string and sends it to the browser with the specified content type.

See also:
flush_to_file

Definition at line 770 of file dom.lib.php.

AnewtXMLDomDocument::flush_to_file ( filename  ) 

Flush output to a file.

This method renders the document and outputs it to the specified file.

Parameters:
$filename The filename to write the output to.
See also:
flush

Definition at line 791 of file dom.lib.php.

AnewtXMLDomDocument::xml_declaration (  )  [private]

Return the XML declaration for this document.

Returns:
XML declaration string.

Definition at line 810 of file dom.lib.php.


Member Data Documentation

AnewtXMLDomDocument::$node_type = ANEWT_XML_DOM_DOCUMENT_NODE

The node type.

See also:
http://www.w3.org/TR/DOM-Level-3-Core/core.html#ID-1060184317

Reimplemented from AnewtXMLDomNode.

Definition at line 402 of file dom.lib.php.

AnewtXMLDomDocument::$node_name = '#document'

The name of this node, depending on its type.

See also:
http://www.w3.org/TR/DOM-Level-3-Core/core.html#ID-F68D095

Reimplemented from AnewtXMLDomNode.

Definition at line 403 of file dom.lib.php.

AnewtXMLDomDocument::$_xml_encoding = 'UTF-8' [private]

The character encoding for this document.

See also:
get_encoding

set_encoding

Definition at line 411 of file dom.lib.php.

AnewtXMLDomDocument::$_xml_standalone = null [private]

Whether this document is specified to be standalone.

See also:
get_standalone

set_standalone

Definition at line 419 of file dom.lib.php.

AnewtXMLDomDocument::$_xml_version = '1.0' [private]

The XML version for this document.

This is always the literal value 1.0.

Definition at line 425 of file dom.lib.php.

AnewtXMLDomDocument::$_content_type = 'text/xml' [private]

The content type for this document.

Defaults to text/xml.

See also:
get_content_type

set_content_type

Definition at line 438 of file dom.lib.php.

AnewtXMLDomDocument::$_doctype = null [private]

The document type declaration.

Null by default.

Definition at line 444 of file dom.lib.php.

AnewtXMLDomDocument::$__object_id_counter = 0 [private]

Object id counter.

Only for internal use.

Definition at line 449 of file dom.lib.php.

AnewtXMLDomDocument::$render_xml_declaration = null [protected]

Whether to render the XML declaration.

This is detected automatically by default.

Definition at line 456 of file dom.lib.php.


The documentation for this class was generated from the following file:

Generated on Sun Aug 2 22:54:38 2009 for Anewt by  doxygen 1.5.9