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

Class: XML_sql2xml_ext

Source Location: /XML_sql2xml-0.3/sql2xml_ext.php

Class Overview

XML_sql2xml
   |
   --XML_sql2xml_ext

This class shows with an example, how the base sql2xml-class could be extended.


Author(s):

Version:

  • $Id: sql2xml_ext.php,v 1.34 2001/08/29 20:11:44 chregu Exp $

Methods


Inherited Variables

Inherited Methods

Class: XML_sql2xml

XML_sql2xml::XML_sql2xml()
Constructor The Constructor can take a Pear::DB "data source name" (eg.
XML_sql2xml::add()
General method for adding new resultsets to the xml-object
XML_sql2xml::addArray()
Adds an aditional resultset generated from an Array to $this->xmldoc TODO: more explanation, how arrays are transferred
XML_sql2xml::addResult()
Adds an additional pear::db_result resultset to $this->xmldoc
XML_sql2xml::addSql()
Adds an aditional resultset generated from an sql-statement to $this->xmldoc
XML_sql2xml::addXmlFile()
Adds the content of a xml-file to $this->xmldoc, on the same level as a normal resultset (mostly just below <root>)
XML_sql2xml::addXmlString()
Adds the content of a xml-string to $this->xmldoc, on the same level as a normal resultset (mostly just below <root>)
XML_sql2xml::getXML()
Returns an xml-string with a xml-representation of the resultsets.
XML_sql2xml::getXMLObject()
Returns an xml DomDocument Object with a xml-representation of the resultsets.
XML_sql2xml::getXpathChildValues()
get the values as an array from the childtags from the first match of the xpath expression
XML_sql2xml::getXpathValue()
returns the content of the first match of the xpath expression
XML_sql2xml::setEncoding()
sets the encoding for the db2xml transformation
XML_sql2xml::setOptions()
This method sets the options for the class One can only set variables, which are defined at the top of of this class.
XML_sql2xml::SetParentTables()

Class Details

[line 51]
This class shows with an example, how the base sql2xml-class could be extended.

Usage example

include_once("XML/sql2xml_ext.php"); $options= array( user_options => array (xml_seperator =>"_", element_id => "id"), ); $sql2xml = new xml_sql2xml_ext("mysql://root@localhost/xmltest"); $sql2xml->SetOptions($options); $xmlstring = $sql2xml->getxml("select * from bands"); more examples and outputs on http://php.chregu.tv/sql2xml/ for the time being

  • Version: $Id: sql2xml_ext.php,v 1.8 2001/12/11 19:45:56 sebastian Exp $
  • Version: $Id: sql2xml_ext.php,v 1.34 2001/08/29 20:11:44 chregu Exp $
  • Author: Christian Stocker <mailto:chregu@nomad.ch>


[ Top ]


Method Detail

XML_sql2xml_ext (Constructor)   [line 72]

XML_sql2xml_ext XML_sql2xml_ext( [string $dsn = Null], [string $root = "root"])

Constructor The Constructor can take a Pear::DB "data source name" (eg.

"mysql://user:passwd@localhost/dbname") and will then connect to the DB, or a PEAR::DB object link, if you already connected the db before. a pear::db-resultset or as an array. providing sql-strings will not work. the $root param is used, if you want to provide another name for your root-tag than "root". if you give an empty string (""), there will be no root element created here, but only when you add a resultset/array/sql-string. And the first tag of this result is used as the root tag.


Parameters:

string   $dsn     with PEAR::DB "data source name" or object DB object
string   $root     of the name of the xml-doc root element.

[ Top ]

addTableinfo   [line 209]

void addTableinfo( mixed $key, mixed $value, mixed &$tableInfo)


[ Top ]

insertNewElement   [line 167]

void insertNewElement( mixed $parent, mixed $res, mixed $key, mixed &$tableInfo, mixed &$subrow)


[ Top ]

insertNewResult   [line 149]

void insertNewResult( mixed &$tableInfo)


[ Top ]

insertNewRow   [line 97]

void insertNewRow( mixed $parent_row, mixed $res, mixed $key, mixed &$tableInfo)


[ Top ]

SetAttribute   [line 221]

void SetAttribute( mixed $node, mixed $name, mixed $value)


[ Top ]

SetResultRootTag   [line 232]

void SetResultRootTag( mixed $resultroot)


[ Top ]


Documentation generated on Sun, 16 May 2004 05:05:20 -0400 by phpDocumentor 1.2.3. PEAR Logo Copyright © PHP Group 2004.