Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.gwtext.client.data
Class XmlReader

    java.lang.Object
      com.gwtext.client.core.JsObject
          com.gwtext.client.data.Reader
              com.gwtext.client.data.XmlReader

    public class XmlReader

extends Reader

Data reader class to create an Array of`Record` objects from an XML document based on mappings.

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 :

     RecordDef recordDef = new RecordDef(new FieldDef[] {
             new StringFieldDef("name", "name"), // "mapping" property not needed if it's the same as "name"
             new StringFieldDef("occupation")  // This field will use "occupation" as the mapping.
     });
     XmlReaderConfig config = new XmlReaderConfig();
     config.setRecord("row");
     config.setId("id");
     config.setTotalRecords("results");

     XmlReader reader = new XmlReader(config, recordDef);

This would consume XML like:

     <?xml?>
     <dataset>
      <results>2

Field Summary

Fields inherited from class com.gwtext.client.data.Reader
`configJS, recordDef`

Fields inherited from class com.gwtext.client.core.JsObject
`jsObj`

Constructor Summary
`XmlReader(java.lang.String record, RecordDef recordDef)` Construct a new XmlReader.

Method Summary
`protected com.google.gwt.core.client.JavaScriptObject` | `create(com.google.gwt.core.client.JavaScriptObject config, com.google.gwt.core.client.JavaScriptObject recordDef)`
`void` | `setId(java.lang.String id)` The `DomQuery` path relative from the record element to the element that contains a record identifier value..
`void` | `setRecord(java.lang.String record)` The `DomQuery` path to the repeated element which contains record information.
`void` | `setSuccess(java.lang.String success)` The `DomQuery` path to the success attribute used by forms.
`void` | `setTotalRecords(java.lang.String totalRecords)` The `DomQuery` path from which to retrieve the total number of records in the dataset.

Methods inherited from class com.gwtext.client.data.Reader
`getJsObj, getRecordDef, setRecordDef`

Methods inherited from class com.gwtext.client.core.JsObject
`getProperties, isCreated, setJsObj`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### XmlReader

    public XmlReader(java.lang.String record,
                     RecordDef recordDef)

  Construct a new XmlReader.

  Parameters:
    `record` - the name of the record tag in the XML data
    `recordDef` - the record def

Method Detail

### create

    protected com.google.gwt.core.client.JavaScriptObject create(com.google.gwt.core.client.JavaScriptObject config,
                                                                 com.google.gwt.core.client.JavaScriptObject recordDef)

  Overrides:
    `create` in class `Reader`

### setId

    public void setId(java.lang.String id)

  The `DomQuery` path relative from the record element to the element that contains a record identifier value.. The simples case is the tag name in the XML that maps to the Record ID

  Parameters:
    `id` - the ID

### setRecord

    public void setRecord(java.lang.String record)

  The `DomQuery` path to the repeated element which contains record information. The simples case is the tag name in the XML that maps to the root tag of what corresponnds to a "record".

  Parameters:
    `record` - the record mapping

### setSuccess

    public void setSuccess(java.lang.String success)

  The `DomQuery` path to the success attribute used by forms.

  Parameters:
    `success` - the success `DomQuery` path.

### setTotalRecords

    public void setTotalRecords(java.lang.String totalRecords)

  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:
    `totalRecords` - the totalRecords DomQuery path

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD