PhpExt : Data [ class tree ] [ index ] [ all elements ]

Class: PhpExt_Data_XmlReader

Source Location: /PhpExt/Data/XmlReader.php

Class PhpExt_Data_XmlReader

Class Overview

Data reader class to create an Array of Ext.data.Record objects from an XML document based on mappings in a provided Ext.data.Record constructor.

Note that in order for the browser to parse a returned XML document, the Content-Type header in the HTTP response must be set to "text/xml".

Example code:

  1.  $myReader new PhpExt_Data_XmlReader()
  2.  $myReader->setTotalRecords("results"// The element which contains the total dataset size (optional)
  3.  $myReader->setRecord("row");          // The repeated element which contains row information
  4.  $myReader->setId("id");                // The element within the row that provides an ID for the record (optional)
  5.  $myReader->addField(new PhpExt_Data_FieldConfigObject("name","name"))// "mapping" property not needed if it's the same as "name"
  6.  $myReader->addField(new PhpExt_Data_FieldConfigObject("occupation"));  // This field will use "occupation" as the mapping.

This would consume an XML file like this:

  1.  <?xml ?>
  2.  <dataset>
  3.  <results>2</results>
  4.   <row>
  5.     <id>1</id>
  6.     <name>Bill</name>
  7.     <occupation>Gardener</occupation>
  8.   </row>
  9.   <row>
  10.     <id>2</id>
  11.     <name>Ben</name>
  12.     <occupation>Horticulturalist</occupation>
  13.   </row>
  14.  </dataset>

Located in /PhpExt/Data/XmlReader.php [line 55]

PhpExt_Object
   |
   --PhpExt_Data_DataReader
      |
      --PhpExt_Data_XmlReader

Methods

[ Top ]
Method Summary
PhpExt_Data_XmlReader   __construct()  
string   getId()   The DomQuery path relative from the record element to the element that contains a record identifier value.
string   getRecord()   The DomQuery path to the repeated element which contains record information.
string   getSuccess()   The DomQuery path to the success attribute used by forms.
string   getTotalRecords()   The DomQuery path from which to retrieve the total number of records in the dataset. This is only needed if the whole dataset is not passed in one go, but is being paged from the remote server.
PhpExt_Data_XmlReader   setId()   The DomQuery path relative from the record element to the element that contains a record identifier value.
PhpExt_Data_XmlReader   setRecord()   The DomQuery path to the repeated element which contains record information.
PhpExt_Data_XmlReader   setSuccess()   The DomQuery path to the success attribute used by forms.
PhpExt_Data_XmlReader   setTotalRecords()   The DomQuery path from which to retrieve the total number of records in the dataset. This is only needed if the whole dataset is not passed in one go, but is being paged from the remote server.

[ Top ]
Methods
Constructor __construct  [line 130]

  PhpExt_Data_XmlReader __construct( )


API Tags:
Access:  public


Redefinition of:
PhpExt_Data_DataReader::__construct()

Redefined in descendants as:

[ Top ]
getId  [line 71]

  string getId( )

The DomQuery path relative from the record element to the element that contains a record identifier value.


API Tags:
Access:  public


[ Top ]
getRecord  [line 89]

  string getRecord( )

The DomQuery path to the repeated element which contains record information.


API Tags:
Access:  public


[ Top ]
getSuccess  [line 107]

  string getSuccess( )

The DomQuery path to the success attribute used by forms.


API Tags:
Access:  public


[ Top ]
getTotalRecords  [line 125]

  string getTotalRecords( )

The DomQuery path from which to retrieve the total number of records in the dataset. This is only needed if the whole dataset is not passed in one go, but is being paged from the remote server.


API Tags:
Access:  public


[ Top ]
setId  [line 63]

  PhpExt_Data_XmlReader setId( string $value  )

The DomQuery path relative from the record element to the element that contains a record identifier value.

Parameters:
string   $value: 

API Tags:
Access:  public


[ Top ]
setRecord  [line 81]

  PhpExt_Data_XmlReader setRecord( string $value  )

The DomQuery path to the repeated element which contains record information.

Parameters:
string   $value: 

API Tags:
Access:  public


[ Top ]
setSuccess  [line 99]

  PhpExt_Data_XmlReader setSuccess( string $value  )

The DomQuery path to the success attribute used by forms.

Parameters:
string   $value: 

API Tags:
Access:  public


[ Top ]
setTotalRecords  [line 117]

  PhpExt_Data_XmlReader setTotalRecords( string $value  )

The DomQuery path from which to retrieve the total number of records in the dataset. This is only needed if the whole dataset is not passed in one go, but is being paged from the remote server.

Parameters:
string   $value: 

API Tags:
Access:  public


[ Top ]

Documentation generated on Fri, 08 Aug 2008 16:02:44 -0500 by phpDocumentor 1.4.0