:: Forum >>

XPATH XML

I have such XML:
<DATA>
<RealTime Src="REUTERS" Item="MSFT">
<Field Id="1" Name="ASK" Val="44.5" />
<Field Id="2" Name="BID" Val="45" />
<Field Id="3" Name="LAST" Val="45" />

I fetch the data this way:
var grid_model=new AW.XML.Table;
grid_model.setURL("http://localhost/grids/f.xml");
grid_model.setColumns(["@Src","@Item","RealTime//Field[@Name]"]);
grid_model.setRows('//DATA/*');
grid_model.request();

Unfortunalety the grid only displays the Src and Item and not all the other fields. Any idea why ?
Thanks
Julien
Tuesday, November 29, 2005
I guess in this case XPath should be like this:

grid_model.setColumns(["@Src", "@Item", "Field[@Name='ASK']/@Val", "Field[@Name='BID']/@Val", "Field[@Name='LAST']/@Val"]);
Alex (ActiveWidgets)
Tuesday, November 29, 2005
So it means that i can't loop all the Field nodes (i have many of them)
I have to manually name them...

Julien
Tuesday, November 29, 2005
There is no public method which sets one XPath for all cells, but there is internal variable which you can try (on your own risk :-)

grid_model._valuePath = "Field[@Name]/@Val";

or even

grid_model._valuePath = "@Src|@Item|Field[@Name]/@Val";

Alex (ActiveWidgets)
Tuesday, November 29, 2005
oops, you don't need [@Name] filter in this case, so it should be:

grid_model._valuePath = "Field/@Val";

or

grid_model._valuePath = "@Src|@Item|Field/@Val";

Alex (ActiveWidgets)
Tuesday, November 29, 2005

This topic is archived.


Back to support forum

Forum search