Introduction

Introduction -- Passing the data to transform

Overview

There are three ways to pass the data for transforming to the object:

Direct query

This behavoir does connecting to the DBMS, quering and fetching he result automatically. XML_sql2xml requires an valid DSN as construtor parameter. The query has to be passed to the getXML() or add() method.

Take a look into the first part of the introduction for examples.

Passing an DB_Result object

PEAR::DB and PEAR::MDB return the result set of a query as DB_result object. You have to provide a DB_common instance to the construtor and the DB_result instance to getXML() or add().

The XML output in $xmlstring is equal to the example in "The typical using".

This way is the only one, if you want to benefit from all the features of the database APIs.

Passing an array

If you pass an nested array to getXML() or add(), it will be transformed into an XML document.

Passing more then one result set

You can call add() several result sets to XML document. Just call the method for every result set; if you have added all result sets, call getXml() without any arguments to get the XML document.

    Поддержать сайт на родительском проекте КГБ