1. #1
    Ext User
    Join Date
    Oct 2010
    Posts
    3
    Vote Rating
    0
    blahzay is on a distinguished road

      0  

    Default Help with XmlStore and XML collections

    Help with XmlStore and XML collections


    Hi all. I have an XmlStore defined as follows:

    var store = new Ext.data.XmlStore({
    url : "/remote_data/categories/all.xml",
    fields : [{name : "child"}],
    record : "element",
    autoLoad : true,
    listeners : {
    load : function(obj, records){
    Ext.each(records, function(record){
    console.log(record);
    });
    }
    }
    });


    How can I get the XmlStore to properly parse an xml document structured as follows:

    <root>
    <element>
    <child>Child1</child>
    <child><Child2</child>
    <child>Child3</child>
    </element>
    <element>
    <child>Child1</child>
    <child><Child2</child>
    </element>
    </root>


    Currently only the first child is being loaded into the XmlStore object.

  2. #2
    Ext JS Premium Member
    Join Date
    May 2010
    Posts
    15
    Vote Rating
    0
    tfcoding is on a distinguished road

      0  

    Default


    i guess your element has to much "child"s

  3. #3
    Ext User
    Join Date
    Oct 2010
    Posts
    3
    Vote Rating
    0
    blahzay is on a distinguished road

      0  

    Default


    Quote Originally Posted by tfcoding View Post
    i guess your element has to much "child"s

    Thanks that was both hilarious and extremely helpful. Could a grown up or at least someone with something substantive to contribute please chime in.

  4. #4
    Sencha - Community Support Team Condor's Avatar
    Join Date
    Mar 2007
    Location
    The Netherlands
    Posts
    24,251
    Vote Rating
    73
    Condor is a splendid one to behold Condor is a splendid one to behold Condor is a splendid one to behold Condor is a splendid one to behold Condor is a splendid one to behold Condor is a splendid one to behold Condor is a splendid one to behold Condor is a splendid one to behold

      0  

    Default


    You can't. Your XML is invalid.

    It needs to be:
    Code:
    <child>&lt;Child2</child>
    or
    Code:
    <child><[!CDATA[<Child2]]></child>

  5. #5
    Ext User
    Join Date
    Oct 2010
    Posts
    3
    Vote Rating
    0
    blahzay is on a distinguished road

      0  

    Default


    Quote Originally Posted by Condor View Post
    You can't. Your XML is invalid.

    It needs to be:
    Code:
    <child>&lt;Child2</child>
    or
    Code:
    <child><[!CDATA[<Child2]]></child>

    This was just a contrived example that I typed up in the forum WYSIWYG and not my real XML. The larger question isn't about why this particular XML isn't being parsed but rather how to deal with lists using EXTJS. From what I can gather EXT expects XML to match a certain format but I can't find any documentation on what that format is. I also gather that any XML outside if said expected format should be handled by extending the Ext XML parser. Is this correct?

  6. #6
    Sencha - Community Support Team Condor's Avatar
    Join Date
    Mar 2007
    Location
    The Netherlands
    Posts
    24,251
    Vote Rating
    73
    Condor is a splendid one to behold Condor is a splendid one to behold Condor is a splendid one to behold Condor is a splendid one to behold Condor is a splendid one to behold Condor is a splendid one to behold Condor is a splendid one to behold Condor is a splendid one to behold

      0  

    Default


    That depends on what you want as a result from the reader. If you only want a list of all children in all elements then you should have specified record:'child'.

    If you want to read elements, but the 'child' fields should contain the list of children, then use an extra XmlReader in the 'child' field convert function to read the children.

Similar Threads

  1. XmlStore headers and xml data
    By michal.warecki in forum Ext 3.x: Help & Discussion
    Replies: 0
    Last Post: 6 Jun 2010, 8:04 AM
  2. XmlStore: Get special field of xml
    By defcon1 in forum Ext 3.x: Help & Discussion
    Replies: 4
    Last Post: 26 Apr 2010, 1:19 AM
  3. [Ext-3.2.0] Error loading/parsing XML with XmlStore/DataView
    By defcon1 in forum Ext 3.x: Help & Discussion
    Replies: 4
    Last Post: 20 Apr 2010, 1:26 AM
  4. XmlWriter + XMLStore: How to get the generated XML as String?
    By maho2nd in forum Ext 3.x: Help & Discussion
    Replies: 0
    Last Post: 30 Nov 2009, 7:52 AM
  5. Nested View Objects/Nested Xml collections
    By dwebsubmit in forum Ext 1.x: Help & Discussion
    Replies: 10
    Last Post: 11 Oct 2007, 2:30 PM

Thread Participants: 2

film izle

hd film izle

film sitesi

takipci kazanma sitesi

takipci kazanma sitesi

güzel olan herşey

takipci alma sitesi

komik eğlenceli videolar