-
5 Oct 2010 1:45 PM #1
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.
-
5 Oct 2010 1:52 PM #2
i guess your element has to much "child"s
-
5 Oct 2010 3:38 PM #3
-
6 Oct 2010 1:18 AM #4Sencha - Community Support Team
- Join Date
- Mar 2007
- Location
- The Netherlands
- Posts
- 24,251
- Vote Rating
- 44
You can't. Your XML is invalid.
It needs to be:
orCode:<child><Child2</child>
Code:<child><[!CDATA[<Child2]]></child>
-
6 Oct 2010 5:57 AM #5
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 Oct 2010 6:28 AM #6Sencha - Community Support Team
- Join Date
- Mar 2007
- Location
- The Netherlands
- Posts
- 24,251
- Vote Rating
- 44
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
-
XmlStore headers and xml data
By michal.warecki in forum Ext 3.x: Help & DiscussionReplies: 0Last Post: 6 Jun 2010, 8:04 AM -
XmlStore: Get special field of xml
By defcon1 in forum Ext 3.x: Help & DiscussionReplies: 4Last Post: 26 Apr 2010, 1:19 AM -
[Ext-3.2.0] Error loading/parsing XML with XmlStore/DataView
By defcon1 in forum Ext 3.x: Help & DiscussionReplies: 4Last Post: 20 Apr 2010, 1:26 AM -
XmlWriter + XMLStore: How to get the generated XML as String?
By maho2nd in forum Ext 3.x: Help & DiscussionReplies: 0Last Post: 30 Nov 2009, 7:52 AM -
Nested View Objects/Nested Xml collections
By dwebsubmit in forum Ext 1.x: Help & DiscussionReplies: 10Last Post: 11 Oct 2007, 2:30 PM


Reply With Quote