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

Class: XML_sql2xml_ext

Source Location: /XML_sql2xml-0.3.4/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.11 2008/03/24 15:51:51 dufuz 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::prepareArray()
Makes sure the given array has no integer indices
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 39]
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

  • Author: Christian Stocker <chregu@nomad.ch>
  • Version: $Id: sql2xml_ext.php,v 1.11 2008/03/24 15:51:51 dufuz Exp $


[ Top ]


Method Detail

XML_sql2xml_ext (Constructor)   [line 60]

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 180]

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


Parameters:

   $key   — 
   $value   — 
   &$tableInfo   — 

[ Top ]

insertNewElement   [line 148]

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


Parameters:

   $parent   — 
   $res   — 
   $key   — 
   &$tableInfo   — 
   &$subrow   — 

[ Top ]

insertNewResult   [line 128]

void insertNewResult( &$tableInfo)


Parameters:

   &$tableInfo   — 

[ Top ]

insertNewRow   [line 84]

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


Parameters:

   $parent_row   — 
   $res   — 
   $key   — 
   &$tableInfo   — 

[ Top ]

SetAttribute   [line 192]

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


Parameters:

   $node   — 
   $name   — 
   $value   — 

[ Top ]

SetResultRootTag   [line 201]

void SetResultRootTag( $resultroot)


Parameters:

   $resultroot   — 

[ Top ]


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