3.0.0

XML Namespace question ...

I have an XML structure:

<ns0:LoadInfo>
   <ns0:ClearedMW>
      <ns0: Cleared Hour="1" Value = "123" />
      <ns0: Cleared Hour="2" Value = "234" />
   </ns0:ClearedMW>
   <ns0:MTLF>
     <ns0:Forecast HourEnding="1" LoadForecast="56038" />
     <ns0:Forecast HourEnding="2" LoadForecast="56038" />
   </ns0:MTLF>
</ns0:LoadInfo>


I've been trying a ton of combinations to display a 4 column grid (Hour, Value, HourEnding, and LoadForcast). But I can't seem to get it (below is just an example when I was just trying to get the Hour and Value):

table.setRows("//LoadInfo/*");
table.setColumns(["Hour", "Value"]);

Any help? Sorry, I'm just not grasping the namespace stuff.
Carl
November 18,
You have to set the namespace URI with setNamespace() call, and you have to use @ prefix if your are extracting attribute values (not elements).

var table = new AW.XML.Table;
table.setURL("...");
table.setNamespace("ns0", "http://...");
table.setRows("//ns0:Cleared");
table.setColumns(["@Hour", "@Value"]);
table.request();
Alex (ActiveWidgets)
November 20,

This topic is archived.

See also:


Back to support forum

Search

Version 2

Looking for AW 2.6 ?
The old site is here.