PDA

View Full Version : XML Store via ajax-proxy pre-selecting



Malte123
1 Dec 2013, 7:09 PM
Hi all :-)
this is my first post - I've done a half a year successful with extjs but now I need help:

I want to pre select a part of an XML like this:



<?xml version="1.0" encoding="UTF-8"?>
<game version="0.8">
<team name="green">
<figure><name id="donaldDuck">Donald Duck</name><set>Disney</set></figure>
<figure><name id="mickeyMouse">Mickey Mouse</name><set>Disney</set></figure>
</team>
<team name="red">
<figure><name id="tick">Tick</name><set>children</set></figure>
<figure><name id="trick">Trick</name><set>children</set></figure>
</team>
</game>


If I want to load name="green" and name="red" into different Stores - how can I do this?

I tried a lot - and I am confused a little bit:
(here I use a Model with its own Ajax-Proxy-Reader)



reader: {
type: 'xml',
// record: 'team/@name=[red]',
record: '> *',
// root: 'figure',
// root: 'game',
root: 'team',
// root: 'team/@name=[red]
idProperty: 'team/@name/figure/name/@id'
}


Can someone tell me the right way to filter this while loading into store - I do not want to filter the stores because than I have a lot of Stores with same content (here we have only small sample data)

I only need <figure> and deeper - but I have to manage only <team name="red" OR "green"> is in the store later - WITHOUT store.filter()

If there is no solution please give me a successful way to look for like converting xml to json and than manage this with a json ??! Or something successful tested :-)

mitchellsimoens
3 Dec 2013, 1:30 PM
All you should have to do is have different root properties using the attribute selector also.

Malte123
3 Dec 2013, 3:52 PM
root: 'team/@name=[red]'


should work ?
(maybe I did a different mistake - please correct me if this is a wrong way to use syntax for selectors in targeting name="red")

thanks for the response - I did it now manualy by using native JS with XPath..
It would be nice to know how to do this.
I didn't find a red path to work with xml - maybe someone with a lot experience can write a doc - in professional work it is needed to work with xml for customers. (I know JSON is to golden way)
If there were an XML-FAQ it would help a lot not to get confused and make mistakes like me maybe.

Malte123
7 Dec 2013, 3:22 PM
reader: {
type: 'xml'
,root: 'team[@name=red]' // correct way to select
,record: 'figure'
,idProperty: 'name/@id'
}
thanks to mitchellsimoens for unconfusing me ;-)