PDA

View Full Version : graphML as dataProvider in Data Grid


dave84
03-27-2008, 08:47 PM
Hello!

I'm currently trying to take information from a database, format it into graphML, and then display it in a Data Grid. Unfortunately, the data will not show -- I have tried dot operators, @, and anything else I can think of to insert into the dataField attribute. The only way ANYTHING will populate is if I insert 'node' into the dataField -- for example:

<mx:DataGridColumn dataField="node" headerText="Name"/>

The result set that I am returning from the .as file is as follows:
myResult2 = event.result as XMLList;

I have tried event.result.graph as well - I think this is the way to go.

Trace statements have verified that my graphML [in myResult2] is formatted correctly. Here is what it looks like:


<graphml>
<key id="name" for="node" attr.name="name" attr.type="string">
<default>unknown</default>
</key>
<key id="type" for="node" attr.name="type" attr.type="string">
<default>unknown</default>
</key>
<key id="routeprefix" for="node" attr.name="routeprefix" attr.type="string">
<default>unknown</default>
</key>
<key id="association" for="edge" attr.name="association" attr.type="string"/>
<graph id="A" edgedefault="undirected">
<node id="21043">
<data key="name">test</data>
<data key="type">AS</data>
<data key="routeprefix">217.20.50.0</data>
</node>
<node id="6697">
<data key="name"/>
<data key="type">AS</data>
<data key="routeprefix"/>
</node>
<node id="1239">
<data key="name"/>
<data key="type">AS</data>
<data key="routeprefix"/>
</node>
<edge source="6697" target="21043"/>
<edge source="21043" target="1239"/>
<node id="20965">
<data key="name"/>
<data key="type">AS</data>
<data key="routeprefix"/>
</node>
<node id="1930">
<data key="name"/>
<data key="type">AS</data>
<data key="routeprefix"/>
</node>
<edge source="20965" target="21043"/>
<edge source="21043" target="1930"/>
<node id="1239">
<data key="name"/>
<data key="type">AS</data>
<data key="routeprefix"/>
</node>
<node id="2497">
<data key="name"/>
<data key="type">AS</data>
<data key="routeprefix"/>
</node>
<edge source="1239" target="21043"/>
<edge source="21043" target="2497"/>
<node id="35422">
<data key="name"/>
<data key="type">AS</data>
<data key="routeprefix"/>
</node>
<node id="3216">
<data key="name"/>
<data key="type">AS</data>
<data key="routeprefix"/>
</node>
<edge source="35422" target="21043"/>
<edge source="21043" target="3216"/>
<node id="1239">
<data key="name"/>
<data key="type">AS</data>
<data key="routeprefix"/>
</node>
<node id="3257">
<data key="name"/>
<data key="type">AS</data>
<data key="routeprefix"/>
</node>
<edge source="1239" target="21043"/>
<edge source="21043" target="3257"/>
<node id="6320">
<data key="name"/>
<data key="type">AS</data>
<data key="routeprefix"/>
</node>
<node id="3333">
<data key="name"/>
<data key="type">AS</data>
<data key="routeprefix"/>
</node>
<edge source="6320" target="21043"/>
<edge source="21043" target="3333"/>
<node id="8342">
<data key="name"/>
<data key="type">AS</data>
<data key="routeprefix"/>
</node>
<node id="3356">
<data key="name"/>
<data key="type">AS</data>
<data key="routeprefix"/>
</node>
<edge source="8342" target="21043"/>
<edge source="21043" target="3356"/>
<node id="3216">
<data key="name"/>
<data key="type">AS</data>
<data key="routeprefix"/>
</node>
<node id="3549">
<data key="name"/>
<data key="type">AS</data>
<data key="routeprefix"/>
</node>
<edge source="3216" target="21043"/>
<edge source="21043" target="3549"/>
<node id="6854">
<data key="name"/>
<data key="type">AS</data>
<data key="routeprefix"/>
</node>
<node id="3741">
<data key="name"/>
<data key="type">AS</data>
<data key="routeprefix"/>
</node>
<edge source="6854" target="21043"/>
<edge source="21043" target="3741"/>
</graph>
</graphml>


Any thoughts as to how to make the data appear in the Data Grid? Is there something wrong with the way the graphML is formatted?

Thanks in advance!!!

allenrabinovich
03-27-2008, 09:43 PM
Specifically which data from this xml file do you want to display in the DataGrid? Name, type and routeprefix for all nodes? Or something else?

dave84
03-27-2008, 11:05 PM
Ideally, everything.

ID, name, route prefix, and each edge source and target.