Docs For Class XMLTagClass

## Class XMLTagClass

Description

This class is used for building and rendering an XML tag.

This class is the base class for the HTMLTagClass.

This is part of the phphtmllib libraries released under the LGPL license.

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

Located in /XMLTagClass.inc (line 35)

    Container
       |
       --XMLTagClass

Direct descendents

Class | Description
--- | ---
HTMLTagClass | Base class for all HTML Tag classes.
SVGTagClass | This overrides the WMLTagClass to define some methods that set some commonly used SVG tag attributes.
WMLTagClass | Base class for all WML Tag classes.
XMLtag | xml tag class

Method Summary
XMLTagClass XMLTagClass (string $name, [array $attributes = array()], mixed 2)
string get_tag ()
mixed. get_tag_attribute (string $attribute)
string get_tag_name ()
void render (int $indent_level)
none reset_attributes ([array $attributes = array()])
none set_cdata_flag (boolean $flag)
none set_collapse ([boolean $collapse = TRUE], [boolean $indent = TRUE])
none set_newline_after_closetag (boolean $flag)
none set_newline_after_opentag (boolean $flag)
none set_tag_attribute (string $name, [mixed $value = NULL])
none set_tag_attributes ([array $attributes = array()])
void set_tag_name (string $name)
void _set_flags ()
Methods
Constructor XMLTagClass (line 71)

The constructor

    function XMLTagClass($name, $attributes=array() ) {
            $this->set_tag_name( $name );
            $this->set_tag_attributes( $attributes );

            $num_args = func_num_args();
            for ($i=2;$i<$num_args;$i++) {
                $this->add(func_get_arg($i));
            }

            $this->_set_flags();
        }

- tutorial: example

XMLTagClass XMLTagClass (string $name, [array $attributes = array()], mixed 2)

- mixed 2: - n items of content to add
- string $name: - the tag name
- array $attributes: - the attributes array can be in name => value or just value

get_tag (line 160)

This returns the tag declared for this class.

This should be used in favor of accessing the $this->_tag directly.

    function get_tag() {
            //for compatibility only
            return $this->get_tag_name();
        }

- return: - the _tag var for this class.

string get_tag ()
get_tag_attribute (line 202)

This method allows you to get the value for a tag attribute.

- return: FALSE if there is no attribute set.

mixed. get_tag_attribute (string $attribute)

- string $attribute: the attribute you want to find

get_tag_name (line 147)

This method gets the name of the tag

    function get_tag_name() {
            return $this->_tag;
        }

- return: - the tag name

string get_tag_name ()
render (line 94)

This function is responsible for rendering the tag and its contents

    function render( $indent_level=0 ) {

            //try and guess the indentation flags
            //based on the data
            $this->_prepare_flags();

            //return $xml;
            return $this->_render_open_tag( $indent_level ) .
                   $this->_render_content( $indent_level ) .
                   $this->_render_close_tag( $indent_level );
        }

void render (int $indent_level)

- int $indent_level: - the current indentation level for the tag

Redefinition of:

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

Redefined in descendants as:

- HTMLTagClass::render() : Renders the tag, attributes, content and close tag.

reset_attributes (line 220)

clear all attributes and start with new attributes

    function reset_attributes( $attributes=array() ) {
            $this->_attributes = array();
            $this->set_tag_attributes( $attributes );
        }

none reset_attributes ([array $attributes = array()])

- array $attributes: Associative array of name="value" pairs of tag atributes. ie array("border"=>"0", "class"=>"hover");

set_cdata_flag (line 288)

This method turns on the automatic wrapping of the tag's content inside the CDATA wrapper for XML

    function set_cdata_flag($flag) {
            if ($flag) {
                $this->_flags |= _CDATACONTENTWRAP;
                $this->set_collapse(TRUE);
            } else{
                $this->_flags &= ~_CDATACONTENTWRAP;
            }
        }

none set_cdata_flag (boolean $flag)

- boolean $flag: TRUE or FALSE

set_collapse (line 307)

This function turns on the collapse flag

    function set_collapse($collapse=TRUE, $indent=TRUE) {
            if ($collapse) {
                $this->_flags |= _COLLAPSE;
            } else {
                $this->_flags &= ~_COLLAPSE;
            }

            $this->set_newline_after_opentag(FALSE);
            $this->set_indent_flag($indent);
            if ($indent) {
                $this->set_newline_after_closetag(TRUE);
            } else {
                $this->set_newline_after_closetag(FALSE);
            }
        }

none set_collapse ([boolean $collapse = TRUE], [boolean $indent = TRUE])

- boolean $collapse: - the collapse flag
- boolean $indent: - the indent flag DEFAULT: TRUE;

Redefinition of:

Container::set_collapse()
  This function turns on the collapse flag

set_newline_after_closetag (line 271)

set the newline_after_content flag

    function set_newline_after_closetag( $flag ) {
            if ($flag) {
                $this->_flags |= _NEWLINEAFTERCLOSETAG;
            } else{
                $this->_flags &= ~_NEWLINEAFTERCLOSETAG;
            }
        }

none set_newline_after_closetag (boolean $flag)

- boolean $flag: TRUE or FALSE

set_newline_after_opentag (line 255)

set the newline_after_opentag flag

    function set_newline_after_opentag( $flag ) {
            if ($flag) {
                $this->_flags |= _NEWLINEAFTEROPENTAG;
            } else{
                $this->_flags &= ~_NEWLINEAFTEROPENTAG;
            }
        }

none set_newline_after_opentag (boolean $flag)

- boolean $flag: TRUE or FALSE

set_tag_attribute (line 174)

add a single attribute (name="value")

    function set_tag_attribute( $name, $value=NULL ) {
            if (!$value) {
                $value = $name;
            }
            $this->_attributes[$name] = $value;
        }

none set_tag_attribute (string $name, [mixed $value = NULL])

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

Redefined in descendants as:

- INPUTtag::set_tag_attribute() : add a single attribute (name="value")

set_tag_attributes (line 191)

add multiple attributes (name="value")

    function set_tag_attributes( $attributes=array() ) {
            $this->_attributes = array_merge($this->_attributes, $attributes);
        }

none set_tag_attributes ([array $attributes = array()])

- array $attributes: Associative array of name="value" pairs of tag atributes. ie array("border"=>"0", "class"=>"hover");

Redefined in descendants as:

- INPUTtag::set_tag_attributes() : add multiple attributes (name="value")

set_tag_name (line 136)

This method sets the name of the tag

    function set_tag_name( $name ) {
            $this->_tag = $name;
        }

void set_tag_name (string $name)

- string $name: - the tag name

_set_flags (line 123)

This method is used to set the bitmask flags for this tag. It tells the class how to render the tag.

void _set_flags ()

Redefined in descendants as:

- Atag::_set_flags()
- APPLETtag::_set_flags()
- AREAtag::_set_flags()
- Btag::_set_flags()
- BASEtag::_set_flags()
- BRtag::_set_flags()
- CENTERtag::_set_flags()
- DOCTYPEtag::_set_flags()
- FONTtag::_set_flags()
- FRAMEtag::_set_flags()
- H1tag::_set_flags()
- H2tag::_set_flags()
- H3tag::_set_flags()
- H4tag::_set_flags()
- H5tag::_set_flags()
- H6tag::_set_flags()
- HRtag::_set_flags()
- IMGtag::_set_flags()
- INPUTtag::_set_flags()
- LINKtag::_set_flags()
- METAtag::_set_flags()
- NOBRtag::_set_flags()
- OPTIONtag::_set_flags()
- PREtag::_set_flags()
- Stag::_set_flags()
- TEXTAREAtag::_set_flags()
- DEFINITIONSRCsvgtag::_set_flags()
- ELLIPSEsvgtag::_set_flags()
- FONTFACEFORMATsvgtag::_set_flags()
- FONTFACENAMEsvgtag::_set_flags()
- HKERNsvgtag::_set_flags()
- SCRIPTsvgtag::_set_flags()
- STYLEsvgtag::_set_flags()
- VKERNsvgtag::_set_flags()
- ACCESStag::_set_flags()
- NOOPtag::_set_flags()
- TIMERtag::_set_flags()
- XMLtag::_set_flags()
- CDATAtag::_set_flags()

#### 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