Wait! Looks like we don't have enough information to add this to bug database. Please follow this template bug format.
  1. #1
    Sencha User Kikketer's Avatar
    Join Date
    Apr 2012
    Location
    Wausau, WI
    Posts
    135
    Vote Rating
    7
    Kikketer is on a distinguished road

      0  

    Default Associations using XML reader, nodeType === 1 issue

    Associations using XML reader, nodeType === 1 issue


    Server response:
    Code:
    <cl>
        <m-number>AB22017442599</m-number>
        <m-name>Abbie Birthday</m-name>
        <m-office>
            <m-number>1234</m-number>
            <m-employee>
                <m-employee-first-name>John</m-employee-first-name>
                <m-employee-last-name>Aldens</m-employee-last-name>
                <m-extent-telephone-number>52234</m-extent-telephone-number>
                <m-email-address-name>John.Aldens@example.com</m-email-address-name>
            </m-employee>
        </m-office>
    </cl>
    I'm attempting to separate the CL object from the Employee object, and use the associations config.
    Here's the associations portion of the CL object:
    Code:
        associations: [
          {
            type: 'hasOne',
            model: 'MyProject.model.ContactModel',
            autoLoad: true,
            associatedName: 'contact',
            associationKey: 'm-office m-employee',
            reader: {
              type: "xml",
              rootProperty: null,
              record: "m-employee"
            }
          }
        ],
    Now in the Reader.js file, we are calling "read". In that function we do the following:
    Code:
            if (response) {
                data = this.getResponseData(response);
            }
    At this point the response object is actually an array containing just the XML element "<m-employee>" and all the children nodes of that element.

    The trouble starts in the "getResponseData" for the XML reader:
    Code:
        getResponseData: function(response) {
            // Check to see if the response is already an xml node.
            if (response.nodeType === 1 || response.nodeType === 9) {
                return response;
            }
    response at this time is an array! So this if statement is always skipped and I'm presented with the following error:
    Code:
    [WARN][Ext.data.reader.Reader#read] XML data not found in the response
    Sencha Touch 2.3.1

  2. #2
    Sencha - Support Team
    Join Date
    Oct 2011
    Posts
    3,936
    Vote Rating
    130
    fmoseley is a name known to all fmoseley is a name known to all fmoseley is a name known to all fmoseley is a name known to all fmoseley is a name known to all fmoseley is a name known to all

      0  

    Default


    Thank you for the report. Please put together a fiddle reproducing this behavior.
    Get more personalized support via a support subscription.

    Want to learn Sencha Touch 2? Check out
    Sencha training
    Sencha Touch in Action

    Need more help with your app? Hire Sencha Services services@sencha.com

    When posting code, please use BBCode's CODE tags.

    Need to include a test case use:
    The official Sencha Fiddle

  3. #3
    Sencha User Kikketer's Avatar
    Join Date
    Apr 2012
    Location
    Wausau, WI
    Posts
    135
    Vote Rating
    7
    Kikketer is on a distinguished road

      0  

    Default


    I tried my best with the fancy fiddle:
    https://fiddle.sencha.com/#fiddle/2l3

    I was unable to get the /data3.xml file to load via the proxy, so I was not able to see it populate. I tried "data3.xml" and "/data3.xml"... Seems without the slash it literally did nothing, and with the slash it returned a 404.

    The names are slightly different than what I originally posted, but the layout remains.

Thread Participants: 1