Docs For Class XMLDocumentClass

## Class XMLDocumentClass

Description

This class lets you build a complete xml document and render it.

It automatically creates the root xml tag that will contain all of the content. The name of the tag is the first parameter to the constructor. You can add/change the attributes to the root tag via the set_root_attributes() or the set_root_attribute() methods.

- author: Walter A. Boring IV <waboring@newsblob.com>

Located in /widgets/xml/XMLDocumentClass.inc (line 29)

    Container
       |
       --XMLDocumentClass

Direct descendents

Class | Description
--- | ---
SVGDocumentClass | This class lets you build a complete SVG document.
WMLDocumentClass | This class lets you build a complete WML document and render it

Variable Summary
mixed $dtd
mixed $root_name
mixed $_doctype_links
string $_doctype_source
mixed $_http_content_type
XMLTagClass $_root_tag
boolean $_show_char_encoding
mixed $_show_http_header
mixed $_xml_obj
object $_xml_stylesheet_container
Method Summary
XMLDocumentClass XMLDocumentClass (string $root_name, [string $dtd = NULL], [array $root_attributes = array()])
void add (mixed $content)
void add_reference (mixed &$content)
void add_xml_stylesheet_link (string $href)
void dump_http_header ()
string get_doctype_source ()
string get_encoding ()
string get_http_content_type ()
array get_root_attributes ()
string get_root_name ()
void push (mixed $content)
void push_reference (mixed &$content)
string render (int $indent_level, int 1)
void reset_content (mixed $content)
void set_doctype_link (mixed $link)
void set_doctype_source (string $source)
void set_encoding (string $charset)
void set_http_content_type ([string $type = "application/xml"])
void set_root_attribute (string $name, string $value)
void set_root_attributes (array $attributes)
void set_root_name (mixed $root_name, string $doc_name)
void show_character_encoding ([boolean $flag = TRUE])
void show_http_header ([boolean $flag = TRUE])
void _build_doctype ()
void _build_root_tag ()
void _build_xml_stylesheet_container ()
XMLtag _create_xml_obj ()
string _render_header ()
Variables
mixed $dtd = NULL (line 69)

Holds the url of dtd

mixed $root_name = NULL (line 76)

Holds the name of the root xml

element as well as the DOCTYPE document_element attribute

mixed $_doctype_links = array() (line 105)

This contains the doctype links

attributes. There can be a maximum of 2 according to the XML spec

string $_doctype_source = "SYSTEM" (line 98)

the DOCTYPE source attribute

mixed $_http_content_type = "application/xml" (line 111)

The http content-type

XMLTagClass $_root_tag = NULL (line 83)

The root xml tag for all data

- var: object

boolean $_show_char_encoding = TRUE (line 64)

this is a hack to show the character encoding or not.

DEFAULT: on

mixed $_show_http_header = FALSE (line 55)

This flag tells if we should output the header content type.

this is usefull for folks using this class for output not destined for a browser.

mixed $_xml_obj = NULL (line 37)

holds the xml tag object that

all content will be wrapped in

object $_xml_stylesheet_container = NULL (line 119)

The container for all the xml-stylesheet tags

Methods
Constructor XMLDocumentClass (line 130)

The constructor

XMLDocumentClass XMLDocumentClass (string $root_name, [string $dtd = NULL], [array $root_attributes = array()])

- string $root_name: - the root xml tag's name
- string $dtd: - the link path to the DTD (if any)
- array $root_attributes: - the root tag's attributes

add (line 210)

we override this class to make sure we push all content inside the local _xml_obj tag

push content onto content stack adds content to tag as a FIFO. You can have n number of parameters. each one will get added in succession to the content.

- access: public

void add (mixed $content)

- mixed $content: - either string, or tag object.

Redefinition of:

Container::add()
  add content onto content stack

add_reference (line 252)

we override this class to make sure we push all content inside the local _xml_obj tag

push content onto content stack adds content to tag as a FIFO You can only add 1 element at a time, and it will be added as a reference. So you can't do push_reference("something");, since "something" is a static.

- access: public

void add_reference (mixed &$content)

- mixed $content: - either string, or tag object. the tag object gets stored as a reference to the original, so you can push it, then modify it later.

Redefinition of:

Container::add_reference()
  Add content onto content stack so you can change the item later.

add_xml_stylesheet_link (line 282)

This function is used to add a new xml-stylesheet tag to the top portion of the document.

This will automatically get added after the xml tag and before the <!DOCTYPE > tag

void add_xml_stylesheet_link (string $href)

- string $href: - the href for the stylesheet link

dump_http_header (line 460)

This function is used to output the http header for this document.

It makes a call to php's Header() to set the Content-type

void dump_http_header ()
get_doctype_source (line 496)

This function returns the current DOCTYPE tag's source attribute

string get_doctype_source ()
get_encoding (line 346)

This function gets the current encoding type

- return: - the current encoding type for the xml

string get_encoding ()
get_http_content_type (line 449)

This function returns the current value of the http header content type

string get_http_content_type ()
get_root_attributes (line 396)

This function is used to get the root xml tag's attributes

array get_root_attributes ()
get_root_name (line 366)

This function gets the document name

- return: - the current document name for the xml

string get_root_name ()
push (line 229)

Same as add().

NOTE: only exists for 1.1.x compatibility

- access: public
- deprecated:

void push (mixed $content)

- mixed $content: - either string, or tag object.

Redefinition of:

Container::push()
  Same as add().

push_reference (line 268)

Same as add_reference NOTE : only exists for compatibility with 1.1.x

- access: public

void push_reference (mixed &$content)

- mixed &$content: - a reference to some variable.

Redefinition of:

Container::push_reference()
  Same as add_reference NOTE : only exists for compatibility with 1.1.x

render (line 185)

function that will render the XML Document.

- return: the raw html output.

string render (int $indent_level, int 1)

- int 1: - the output debug flag to maintain compatibility w/ the API.
- int $indent_level: - the indentation level for the container.

Redefinition of:

Container::render()
  This function is compatible with the rest of the phpHtmllib API spec.

reset_content (line 304)

we override this class to make sure we push all content inside the local _xml_obj tag

destroy existing content and start with new content.

- access: public

void reset_content (mixed $content)

- mixed $content: can be tag object, or raw (string).

Redefinition of:

Container::reset_content()
  destroy existing content and start with new content.

set_doctype_link (line 405)

This method is used to set the link attributes

for the DOCTYPE tag

void set_doctype_link (mixed $link)
set_doctype_source (line 477)

this function is used to change the DOCTYPE tag's source attribute. By default it is set to SYSTEM.

(ie <!DOCTYPE html SYSTEM > ) ^^^^^^

NOTE: only 2 valid values 'SYSTEM', 'PUBLIC'

void set_doctype_source (string $source)

- string $source: - the new source attribute

set_encoding (line 336)

set the character set

void set_encoding (string $charset)

- string $charset: - the charset for the meta tag

set_http_content_type (line 439)

This function is used to set the http header content-type for output to browsers

void set_http_content_type ([string $type = "application/xml"])

- string $type

set_root_attribute (line 386)

This sets 1 root tag attribute value pair

void set_root_attribute (string $name, string $value)

- string $name: - the attribute name
- string $value: - the attribute value

set_root_attributes (line 376)

This function is used to set the root xml tag's attributes

void set_root_attributes (array $attributes)

- array $attributes

set_root_name (line 356)

Set the document name and the root tag's name.

void set_root_name (mixed $root_name, string $doc_name)

- string $doc_name

show_character_encoding (line 418)

method to update the flag that lets us know to show/render the character encoding string in the xml tag or not

void show_character_encoding ([boolean $flag = TRUE])

- boolean $flag

show_http_header (line 429)

this function is used to set the flag that tells this class to automatically output the content type in the http header

void show_http_header ([boolean $flag = TRUE])

- boolean $flag

_build_doctype (line 505)

This method builds the DOCTYPE tag for the document

void _build_doctype ()
_build_root_tag (line 327)

This function builds the root xml

tag that will contain all of the Document's xml tags

void _build_root_tag ()
_build_xml_stylesheet_container (line 290)

This function builds the _xml_stylesheet_container

void _build_xml_stylesheet_container ()
_create_xml_obj (line 317)

This function builds the local

xml container object that holds all xml tags that are pushed into this class

- return: object

XMLtag _create_xml_obj ()
_render_header (line 148)

function that will render the XML Document header portion upto the root tag.

- return: the raw html output.

string _render_header ()

#### Inherited Methods

Inherited From Container

> Container::Container()
> Container::add()
> Container::add_reference()
> Container::count_content()
> Container::get_element()
> Container::get_indent_flag()
> Container::push()
> Container::push_reference()
> Container::render()
> Container::reset_content()
> Container::set_collapse()
> Container::set_indent_flag()

Documentation generated on Thu, 1 Sep 2005 17:06:40 -0700 by phpDocumentor 1.3.0RC3