XML_FastCreate
[ class tree: XML_FastCreate ] [ index: XML_FastCreate ] [ all elements ]

Class: XML_FastCreate

Source Location: /XML_FastCreate-1.0.4/XML/FastCreate.php

Class Overview

PEAR
   |
   --XML_FastCreate_Overload
      |
      --XML_FastCreate

Master class to used the XML_FastCreate application.


Author(s):

Version:

  • CVS: $Id$

Copyright:

  • 1997-2005 The PHP Group

Methods


Child classes:

XML_FastCreate_XML_Tree
XML_Tree driver for the XML_FastCreate object.
XML_FastCreate_Text
Text driver for the XML_FastCreate object.

Inherited Variables

Inherited Methods


Class Details

[line 209]
Master class to used the XML_FastCreate application.

The end-developper need to call the factory() method to make an instance : $x =& XML_FastCreate::factory('Text'); Simple example to make a valid XHTML page :

  1.  <?php
  2.   require_once 'XML/FastCreate.php';
  3.   $x =XML_FastCreate::factory('Text');
  4.   $x->html(
  5.      $x->head(
  6.           $x->title("A simple XHTML page")
  7.      ),
  8.      $x->body(
  9.          $x->div(
  10.              $x->h1('Example'),
  11.              $x->br(),
  12.              $x->a(array('href' => 'http://pear.php.net')'PEAR WebSite')
  13.          )
  14.      )
  15.   );
  16.   // Write output
  17.   $x->toXML();
  18.  ?>
KNOWN BUGS :
    • Some DTD couln't correctly interpreted (like XHTML 1.1)
    • You can use an external program like XMLLINT for check validation
    PHP versions 4 and 5

    LICENSE: This source file is subject to version 3.0 of the PHP license that is available through the world-wide-web at the following URI: http://www.php.net/license/3_0.txt. If you did not receive a copy of the PHP License and are unable to obtain it through the web, please send a note to license@php.net so we can mail you a copy immediately.



    [ Top ]


    Method Detail

    cdata   [line 658]

    mixed cdata( mixed $content)

    Make a CDATA section <![CDATA[ (...) ]]>
    • Return: See the driver specifications
    • Access: public

    Overridden in child classes as:

    XML_FastCreate_XML_Tree::cdata()
    (Make a CDATA section <![CDATA[ (...) ]]>)
    XML_FastCreate_Text::cdata()
    Make a CDATA section <![CDATA[ (...) ]]>

    Parameters:

    mixed   $content   —  Content of the section

    [ Top ]

    comment   [line 644]

    mixed comment( mixed $content)

    Make an XML comment
    • Return: See the driver specifications
    • Access: public

    Overridden in child classes as:

    XML_FastCreate_XML_Tree::comment()
    (Make an XML comment)
    XML_FastCreate_Text::comment()
    Make an XML comment

    Parameters:

    mixed   $content   —  Content to comment

    [ Top ]

    exportXML   [line 698]

    string exportXML( mixed $xml)

    Export driver data to XML text
    • Return: The XML text
    • Access: public

    Overridden in child classes as:

    XML_FastCreate_XML_Tree::exportXML()
    Export driver data to XML text
    XML_FastCreate_Text::exportXML()
    Export driver data to XML text

    Parameters:

    mixed   $xml   —  The XML data driver

    [ Top ]

    factory   [line 355]

    object An &factory( string $driver, [array $options = array()])

    Factory : Make an instance of XML_FastCreate object
    • Return: XML_FastCreate_<driver> instance
    • Access: public

    Parameters:

    string   $driver   —  Driver to use ("Text", "XML_Tree"..)
    array   $options   — 

    Hashtable of options :

    'dtd' : Set the DTD file to check validity [required the XML_DTD package]

    'indent' : Enable / disable output indentation

    'version' : Set the XML version (default = '1.0')

    'encoding' : Set the encoding charset (default = 'UTF-8')

    'standalone' : Set the standalone attribute (default = 'no')

    'doctype' : DocType string, set manually or use : XML_FASTCREATE_DOCTYPE_XHTML_1_1 XML_FASTCREATE_DOCTYPE_XHTML_1_0_STRICT XML_FASTCREATE_DOCTYPE_XHTML_1_0_FRAMESET XML_FASTCREATE_DOCTYPE_XHTML_1_0_TRANSITIONAL XML_FASTCREATE_DOCTYPE_HTML_4_01_STRICT XML_FASTCREATE_DOCTYPE_HTML_4_01_FRAMESET XML_FASTCREATE_DOCTYPE_HTML_4_01_TRANSITIONAL

    'quote' : Auto quote attributes & contents (default = true)

    'translate' : Hashtable of tags to translate to anothers : 'translate' => array( 'title' => array('<h1 class="title"><span>', '</span></h1>'), 'date' => array('<span class="date">', '</span>'), )

    'exec' : Use an external tool to valid the document

    'file' : Write the validation output to a file

    'expand' : Return single tag with the syntax : <tag></tag> rather <tag /> (default = false) ( set to true if you write HTML )

    'apos' : Quote apostrophe to &apos; (default = true) <! WARNING !> For valid XML, you must let this option to true. If you write XHTML, Microsoft Internet Explorer won't recognize this entitie, so you need to turn this option to false.

    'singleAttribute' : Accept single attributes (default = false) ex: $x->input(array('type'=>'checkbox', checked=>true)) => <input type="checkbox" checked /> <! WARNING !> This syntax is not valid XML. For valid XML, don't use this option, use this : ex: $x->input(array('type'=>'checkbox', checked=>'checked')) => <input type="checkbox" checked=>"checked" />


    [ Top ]

    getXML   [line 670]

    string getXML( )

    Return the current XML text
    • Return: The current XML text
    • Access: public

    Overridden in child classes as:

    XML_FastCreate_XML_Tree::getXML()
    Return the current XML text
    XML_FastCreate_Text::getXML()
    Return the current XML text

    [ Top ]

    importXML   [line 684]

    mixed importXML( mixed $xml)

    Import XML text to driver data
    • Return: See the driver specifications
    • Access: public

    Overridden in child classes as:

    XML_FastCreate_XML_Tree::importXML()
    Import XML text to driver data
    XML_FastCreate_Text::importXML()
    Import XML text to driver data

    Parameters:

    mixed   $xml   —  The XML text

    [ Top ]

    indentXML   [line 526]

    string indentXML( string $xml)

    Indent an XML text
    • Return: The XML text indented

    Parameters:

    string   $xml   —  XML text to indent

    [ Top ]

    isValid   [line 480]

    boolean isValid( &$xml, string $xml)

    Check if the XML respect the DTD.

    Require the XML_DTD package

    • Return: Return true if valid
    • Access: public

    Parameters:

    string   $xml   —  The XML text to check
       &$xml   — 

    [ Top ]

    makeXML   [line 596]

    mixed makeXML( string $tag, [array $attribs = array()], [array $contents = array()])

    Make an XML Tag
    • Return: See the driver specifications
    • Access: public

    Overridden in child classes as:

    XML_FastCreate_XML_Tree::makeXML()
    Make an XML Tag
    XML_FastCreate_Text::makeXML()
    Make an XML Tag

    Parameters:

    string   $tag   —  Name of the tag
    array   $attribs   —  List of attributes
    array   $contents   —  List of contents (strings or sub tags)

    [ Top ]

    noquote   [line 630]

    string noquote( string $content)

    Don't quote this content.

    To use only if the 'quoteContents' is true

    • Return: The content not quoted
    • Access: public

    Overridden in child classes as:

    XML_FastCreate_XML_Tree::noquote()
    (Don't quote this content.)
    XML_FastCreate_Text::noquote()
    Don't quote this content.

    Parameters:

    string   $content   —  Content to escape quoting

    [ Top ]

    quote   [line 614]

    string quote( string $content)

    Encode a string to be include in XML tags.

    To use only if the 'quoteContents' is false Convert : & < > " ' To : &amp; &lt; &gt; &quot; &apos;

    • Return: The quoted content
    • Access: public

    Overridden in child classes as:

    XML_FastCreate_XML_Tree::quote()
    Encode a string to be include in XML tags.
    XML_FastCreate_Text::quote()
    Encode a string to be include in XML tags.

    Parameters:

    string   $content   —  Content to be quoted

    [ Top ]

    toXML   [line 438]

    mixed toXML( )

    Print the current XML to standard output
    • Return: Return true or a PEAR Error object
    • Access: public

    [ Top ]

    xml   [line 548]

    mixed xml( string $tag, array $args, array $contents)

    Make an XML tag.

    Accept all forms of parameters.

    • Return: See the driver specification
    • Access: public

    Parameters:

    string   $tag   —  Name of the tag
    array   $args   —  Optional list for attributes
    array   $contents   —  Optional list of contents (strings or sub tags)

    [ Top ]


    Documentation generated on Mon, 11 Mar 2019 15:46:40 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.