TIP_XML

Introduction

The XML data engine

Source file
/Type/data_engine/xml.php
Extends
TIP_Data_Engine

Interface to an XML file. It uses the SimpleXML object to access the underlying XML file. The default options are arranged to parse standard atom 1 feeds, although the "fields_xpath" property should be anyway explicitely configured.

The "path" property of TIP_Data should specify a file path relative to the data root directory or an absolute URI beginning with "http://".

The XML data engine provides a basic SQL filtering, allowing the following query syntax:

 [WHERE field {=|<>|>|<} value] [LIMIT length[,offset]]

so the following tags are all valids:

 {forSelect(LIMIT 20,40)}...{}
 {forSelect(WHERE rating > 123}...{}
 {forSelect(WHERE id=abcde LIMIT 1)}...{}
 {forSelect(WHERE title <> 0)}...{}

while the ones are not valid (this can change in the future):

 {forSelect(ORDER BY id)}...{}
 {forSelect(WHERE title LIKE abc}...{}
 {forSelect(WHERE rating IS NULL)}...{}
 {forSelect(WHERE raters < > 4)}...{}

Properties

base_xpath : string

The base XPath to use while filtering rows (defaults '/feed')

access
protected

row_xpath : string

The row XPath, relative to the $base_xpath: it defaults to 'entry'

access
protected

fields_xpath : string

An associative array of 'fieldid' => 'XPath', relative to $row_path

access
protected

parent_field : string

The field id of the parent: leave it null for plain models

access
protected

Methods

checkOptions (&$options) : bool

Ensures the required 'fields_xpath' option is defined

&$options
array
Properties values
lines
96 - 104
static
yes
access
protected

__construct ($options)

Constructor

$options
array
Properties values
lines
121 - 124
access
protected

Initializes a TIP_XML instance.

$options inherits the TIP_Type properties, and add the following: * $options['base_xpath']: the base xpath, that is the container

of the rows (default is '/feed')

base_xpath (defaults is 'entry')

where at least one field must be defined

preparedName ($name, [$domain])

$name
$domain
[ = null ]
lines
129 - 132
access
public

preparedValue ($value)

$value
lines
134 - 137
access
public

query ()

lines
139 - 144
access
public

fillFields (&$data)

&$data
lines
146 - 185
access
public

select (&$data, $filter, $fields)

&$data
$filter
$fields
lines
187 - 229
access
public

insert (&$data, &$rows)

&$data
&$rows
lines
231 - 236
access
public

update (&$data, $filter, &$row)

&$data
$filter
&$row
lines
238 - 243
access
public

delete (&$data, $filter)

&$data
$filter
lines
245 - 250
access
public

dump ($root)

$root
lines
252 - 257
access
public

transaction ($action)

$action
lines
259 - 262
access
protected
TIP_XML was last modified by TiP on Mon 25 May 2009 06:22:25 PM CEST
Hosted by BerliOS Developer Logo