76ca635d61eb3f9fb7c9d788a44fa8b1690aa138Dav Glass * Extends DataSource with schema-parsing on XML data.
76ca635d61eb3f9fb7c9d788a44fa8b1690aa138Dav Glass * @module datasource
76ca635d61eb3f9fb7c9d788a44fa8b1690aa138Dav Glass * @submodule datasource-xmlschema
76ca635d61eb3f9fb7c9d788a44fa8b1690aa138Dav Glass * Adds schema-parsing to the DataSource Utility.
76ca635d61eb3f9fb7c9d788a44fa8b1690aa138Dav Glass * @class DataSourceXMLSchema
76ca635d61eb3f9fb7c9d788a44fa8b1690aa138Dav Glass * @extends Plugin.Base
76ca635d61eb3f9fb7c9d788a44fa8b1690aa138Dav Glassvar DataSourceXMLSchema = function() {
76ca635d61eb3f9fb7c9d788a44fa8b1690aa138Dav Glass DataSourceXMLSchema.superclass.constructor.apply(this, arguments);
76ca635d61eb3f9fb7c9d788a44fa8b1690aa138Dav Glass * The namespace for the plugin. This will be the property on the host which
76ca635d61eb3f9fb7c9d788a44fa8b1690aa138Dav Glass * references the plugin instance.
76ca635d61eb3f9fb7c9d788a44fa8b1690aa138Dav Glass * @property NS
76ca635d61eb3f9fb7c9d788a44fa8b1690aa138Dav Glass * @type String
76ca635d61eb3f9fb7c9d788a44fa8b1690aa138Dav Glass * @value "schema"
76ca635d61eb3f9fb7c9d788a44fa8b1690aa138Dav Glass * Class name.
76ca635d61eb3f9fb7c9d788a44fa8b1690aa138Dav Glass * @property NAME
76ca635d61eb3f9fb7c9d788a44fa8b1690aa138Dav Glass * @type String
76ca635d61eb3f9fb7c9d788a44fa8b1690aa138Dav Glass * @value "dataSourceXMLSchema"
76ca635d61eb3f9fb7c9d788a44fa8b1690aa138Dav Glass /////////////////////////////////////////////////////////////////////////////
76ca635d61eb3f9fb7c9d788a44fa8b1690aa138Dav Glass // DataSourceXMLSchema Attributes
76ca635d61eb3f9fb7c9d788a44fa8b1690aa138Dav Glass /////////////////////////////////////////////////////////////////////////////
76ca635d61eb3f9fb7c9d788a44fa8b1690aa138Dav Glass * Internal init() handler.
76ca635d61eb3f9fb7c9d788a44fa8b1690aa138Dav Glass * @method initializer
76ca635d61eb3f9fb7c9d788a44fa8b1690aa138Dav Glass * @param config {Object} Config object.
76ca635d61eb3f9fb7c9d788a44fa8b1690aa138Dav Glass this.doBefore("_defDataFn", this._beforeDefDataFn);
76ca635d61eb3f9fb7c9d788a44fa8b1690aa138Dav Glass * Parses raw data into a normalized response.
76ca635d61eb3f9fb7c9d788a44fa8b1690aa138Dav Glass * @method _beforeDefDataFn
76ca635d61eb3f9fb7c9d788a44fa8b1690aa138Dav Glass * @param tId {Number} Unique transaction ID.
76ca635d61eb3f9fb7c9d788a44fa8b1690aa138Dav Glass * @param request {Object} The request.
76ca635d61eb3f9fb7c9d788a44fa8b1690aa138Dav Glass * @param callback {Object} The callback object with the following properties:
76ca635d61eb3f9fb7c9d788a44fa8b1690aa138Dav Glass * <dt>success (Function)</dt> <dd>Success handler.</dd>
76ca635d61eb3f9fb7c9d788a44fa8b1690aa138Dav Glass * <dt>failure (Function)</dt> <dd>Failure handler.</dd>
76ca635d61eb3f9fb7c9d788a44fa8b1690aa138Dav Glass * @param data {Object} Raw data.
76ca635d61eb3f9fb7c9d788a44fa8b1690aa138Dav Glass * @protected
2fe13ddab136a6eb6239d89e5e064e09d9e1bb92Luke Smith // TODO: Do I need to sniff for DS.IO + responseXML.nodeType 9?
48313fd5f233955e6706c401e9a1e1e283495bd1Luke Smith payload.response = Y.DataSchema.XML.apply.call(this, schema, data) || {
76ca635d61eb3f9fb7c9d788a44fa8b1690aa138Dav Glass return new Y.Do.Halt("DataSourceXMLSchema plugin halted _defDataFn");
76ca635d61eb3f9fb7c9d788a44fa8b1690aa138Dav GlassY.namespace('Plugin').DataSourceXMLSchema = DataSourceXMLSchema;
76ca635d61eb3f9fb7c9d788a44fa8b1690aa138Dav Glass}, '@VERSION@' ,{requires:['datasource-local', 'plugin', 'dataschema-xml']});