Class clXml

Description

XML generation make easy.

For explanation and infos, please see /libs/xml/extended_infos.txt This is a typical usage of this class:

    $objXml->setRendering('html');
    $objXml->setXsl('org.quixml.index');
    $objXml->start();
       $objXml->general();
       $objXml->open('DATAS');
          $objXml->att('demo','true');
          $objXml->data('feeling','Happy');
       $objXml->close();
    $objXml->close();

Located in /xml/clXml.php (line 25)

XMLWriter
   |
   --clXml
Method Summary
clXml __construct ([string $xsl = null], [boolean $short = false])
void att (string $name, string $val)
boolean|string checkXsl ([string $path = NULL], [boolean $retBool = true])
void close ()
void data (string $tag, string $val)
void end ()
void general ()
string getRendering ()
void open (string $tag)
void out ([boolean $echo = true])
null|string output ([boolean $echo = true])
void setRendering (string $val)
void setXsl (string $xsl)
void start ()
Methods
Constructor __construct (line 83)

Constructor.

Calls the xmlWriter constructor and start a new document.

  • todo: Being able to generate an XML fragment, rather than a full document.
  • access: public
clXml __construct ([string $xsl = null], [boolean $short = false])
  • string $xsl: The xsl stylesheet to use, if any.
  • boolean $short: If true, indicate that you want to output an XML fragment, and don't creaet the DTD again !!! To be implemented !!!
att (line 214)

Add an attribute to a node. Can only work on "opened" nodes.

Once a node is closed (with a data), an attribute cannot be added anymore

  • todo: The ability to add an attribute to a <data> node would be nice
  • access: public
void att (string $name, string $val)
  • string $name: The name of the attribute
  • string $val: The value of the attribute
checkXsl (line 371)

Check if a specified XSL sheet exists

  • access: protected
boolean|string checkXsl ([string $path = NULL], [boolean $retBool = true])
  • string $path
  • boolean $retBool: If true, return TRUE or FALSE for the existing stylesheet If false, return the filesystem path to the stylesheet
close (line 202)

Close a previously opened element.

  • access: public
void close ()
data (line 185)

Add a node

  • todo: Being able to add an attribute to a node would be nice
  • access: public
void data (string $tag, string $val)
  • string $tag: The name of the node
  • string $val: The value of the node
detectRenderingSets (line 255)

Detect the availables rendering sets in XSL_ROOT and populate $this->aryRenderingSets[]

To be registered as a valid rendering set, the set must comply with every conditions below: * That the directory is not a "go up" or "this directory" reference
* That the directory is readable
* That an "open.xsl" or "open" file exists
* That the "open[.xsl]" file is readable
* That an "close.xsl" or "close" file exists
* That the "close[.xsl]" file is readable

  • access: protected
void detectRenderingSets ()
end (line 174)

Close the document generation.

No more datas should be added after that

  • access: public
void end ()
general (line 108)

Add a general element to the tree.

This is used to include generic informations that you almost always want to include on every pages. By default, include the site title, the current language selected and the ISO code of the country that are stored in the session. Adapt accordingly to your needs.

  • access: public
void general ()
getRendering (line 305)

Get the current rendering option

  • return: The value of the current rendering set
  • access: public
string getRendering ()
open (line 194)

create a parent open element

  • access: public
void open (string $tag)
  • string $tag: The node name
out (line 223)

Close the XML generation and output the document.

  • access: public
void out ([boolean $echo = true])
  • boolean $echo: If true, echo the xml, otherwise return it back
output (line 315)

Either echo or return the xml document

  • return: If $mode is true, echo the output directly and return null. If $mode is false, return the datas.
  • access: public
null|string output ([boolean $echo = true])
  • boolean $echo: If true, echo the xml, otherwise return it back
setRendering (line 234)

Choose the rendering set. This method should NOT be called before detectRenderingSets().

If the specified rendering set is not detected or incomplete, the class falls back to the "html" set.

  • access: public
void setRendering (string $val)
  • string $val: The desired rendering type. If not defined, the fall back to html
setXsl (line 156)

Attach a xsl stylesheet to the xml. If the style sheet file is not found, add a comment saying so

  • access: public
void setXsl (string $xsl)
  • string $xsl: The file name/path to look at the base XSL stylesheet
start (line 146)

Start the generation of the XML document

  • access: public
void start ()

Inherited Methods

Inherited From XMLWriter (Internal Class)

endAttribute ( )
endCdata ( )
endComment ( )
endDocument ( )
endDtd ( )
endDtdAttlist ( )
endDtdElement ( )
endDtdEntity ( )
endElement ( )
endPi ( )
flush ( )
fullEndElement ( )
openMemory ( )
openUri ( )
outputMemory ( )
setIndent ( )
setIndentString ( )
startAttribute ( )
startAttributeNs ( )
startCdata ( )
startComment ( )
startDocument ( )
startDtd ( )
startDtdAttlist ( )
startDtdElement ( )
startDtdEntity ( )
startElement ( )
startElementNs ( )
startPi ( )
text ( )
writeAttribute ( )
writeAttributeNs ( )
writeCdata ( )
writeComment ( )
writeDtd ( )
writeDtdAttlist ( )
writeDtdElement ( )
writeDtdEntity ( )
writeElement ( )
writeElementNs ( )
writePi ( )
writeRaw ( )

Documentation generated on Sun, 20 Jan 2008 00:13:31 +0100 by phpDocumentor 1.4.0