3.2.0

XML XPath ... need help.

I'm trying to process an XML file from another company and place the data inside of AW. I'm just trying to extract the "name" and the "LMP"
It would be great to also assign the "HourAndMin" to a variable that I could push into a DIV tag on the page, but I'd settle for getting the little information that I really need.

The XML looks like this:
<?xml version="1.0" ?> 
<LMPData RefId="0_17-OCT-2006_15_40" xmlns="http://markets.domain.org/tibco/xml" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <FiveMinLMP HourAndMin="15:40">
    <PricingNode name="AE" LMP="1.5" MCC="0" MLC="-1.18" /> 
    <PricingNode name="AA" LMP="1.73" MCC="0" MLC="-0.95" /> 
    <PricingNode name="AB" LMP="1.64" MCC="0" MLC="-1.04" /> 
    <PricingNode name="AT" LMP="1.64" MCC="0" MLC="-1.04" /> 
  </FiveMinLMP>
</LMPData>


I currently have this as code, and I've been trying variations, but I can't seem to get it to push the required information to AW.

var table = new AW.XML.Table;
  table.setURL("miso.xml");
  table.setColumns(["@name", "@LMP"]);
  table.setRows("//LMPData/FiveMinLMP/*");
  table.request();
    
// Set grid/cell/row aspects
var obj = new AW.UI.Grid; 
  var columns = ["Bus Descriptor", "LMP Value"]; 
  obj.setHeaderText(columns);
  obj.setSize(510, 200);
  obj.setColumnCount(2);
  obj.setCellFormat([str, num1]);
  obj.setCellModel(table);
  obj.setSelectorVisible(false);
  obj.setSelectorText(function(i){return this.getRowPosition(i)});
  obj.setSelectorWidth(0);
  obj.setSelectionMode("single-row"); 
document.write(obj);
Carl
October 17,
With this data file you have to use XML namespace in your XPath -

var table = new AW.XML.Table;
table.setURL("...");
table.setNamespace("tibco", "http://markets.midwestiso.org/tibco/xml");
table.setRows("//tibco:PricingNode");
table.setColumns(["@name", "@LMP", "@MCC", "@MLC"]);
table.request();

var obj = new AW.UI.Grid;
obj.setHeaderText(["Name", "LMP", "MMC", "MLC"]);
obj.setColumnCount(4);
obj.setCellModel(table);
document.write(obj);
Alex (ActiveWidgets)
October 18,

This topic is archived.

See also:


Back to support forum