PDA

View Full Version : XML-Datagrid with unclassified XML-Data



tk-germany
2 Mar 2010, 4:49 AM
Hi together,

I got a XML-Stream with not uniquely defined datafields:


<LoadInformation>
<StatusColor>
<Green dColor="green">Fertig</Green>
<Red dColor="red">Fehler</Red>
<Red dColor="red">Unbekannt</Red>
<Yellow dColor="yellow">Bearbeitung</Yellow>
<Yellow dColor="yellow">Warte</Yellow>
<Blue dColor="blue">Wait_OK</Blue>
<Blue dColor="blue">Wait_append</Blue>
</StatusColor>
</LoadInformation>


How can I convert that into a useable Store, to be then able to color a line "green" if the text is for example "Fertig"?

I know that the inputstream is not that well formed, but I can't touch or manipulate it, that's why I have to get along with it.

Thanks and regards,
TK

tk-germany
2 Mar 2010, 7:14 AM
okay, resolved it with an xpath-converter and created a valid json-store, but even, how could this be done, directly in extjs?

Animal
2 Mar 2010, 7:25 AM
You will need to use an XmlReader.

So, you might have



LoadInformation = Ext.data.Record.create([
{ name: "green", mapping: "Green" },
{ name: 'red1', mapping: 'Red:nth-child(2)' },
{ name: 'red2', mapping: 'Red:nth-child(3)' },
...
]);