XML data load...

How can I load this XML to a grid :

<?xml version="1.0" encoding="utf-8"?>
<Message Numerator="1" Subscriber_no="" Section="LoadMessageAttachments" File="11111569952.pdf" Status="The system cannot find the file specified.&#xD;&#xA;" />

<Message Numerator="1" Subscriber_no="" Section="LoadMessageAttachments" File="11111569952.pdf" Status="The system cannot find the file specified.&#xD;&#xA;" />

July 24,
Transform it into an element-based one.
Raciel R.L.
February 14,
AW can handle both element-based and attribute-based data - you just have to use correct XPath.

        <company ticker="MSFT" name="Microsoft Corporation">
        <company ticker="ORCL" name="Oracle Corporation">
        <company ticker="SAP" name="SAP">

In the example above ticker and name are located in attributes while the rest of the data is inside elements. In this case you can use @ticker and @name as XPath for the first two fields and mktcap, sales, employees for others.

//	set columns XPath
    table.setColumns(["@ticker", "@name", "mktcap", "sales", "employees"]);
Alex (ActiveWidgets)
February 14,
Can AW handle persisted xml from ADO Recordset? If the number and nature of attributes were variable, how to load into AW? I did transform my xml into an element-based one.. It would be perfect to load this kind of xml files with a variable count of attributes..

<xml xmlns:s="uuid:BDC6E3F0-6DA3-11d1-A2A3-00AA00C14882" xmlns:dt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882" xmlns:rs="urn:schemas-microsoft-com:rowset" xmlns:z="#RowsetSchema">
<s:Schema id="RowsetSchema">
<s:ElementType name="row" content="eltOnly" rs:CommandTimeout="480">
<s:AttributeType name="PrimeiroNome" rs:number="1">
<s:datatype dt:type="string" rs:dbtype="str" dt:maxLength="50" rs:maybenull="false"/>
<s:AttributeType name="Sobrenome" rs:number="2">
<s:datatype dt:type="string" rs:dbtype="str" dt:maxLength="50" rs:maybenull="false"/>
<s:AttributeType name="email" rs:number="3">
<s:datatype dt:type="string" rs:dbtype="str" dt:maxLength="50" rs:maybenull="false"/>
<s:AttributeType name="TelefoneResidencial" rs:number="4">
<s:datatype dt:type="string" rs:dbtype="str" dt:maxLength="40" rs:maybenull="false"/>
<s:AttributeType name="Sexo" rs:number="5">
<s:datatype dt:type="string" rs:dbtype="str" dt:maxLength="1" rs:fixedlength="true" rs:maybenull="false"/>
<s:extends type="rs:rowbase"/>
<z:row PrimeiroNome="ROSE" Sobrenome="BEDA" email=" " TelefoneResidencial="+551150633318" Sexo="F"/>
<z:row PrimeiroNome="ROSA AM SANTA" Sobrenome="ADDLA" email="FEX@BOL.COM.BR" TelefoneResidencial="+551932945444" Sexo="F"/>
<z:row PrimeiroNome="ADA BIANCHI" Sobrenome="PIDINI" email="BNI@IG.COM.BR" TelefoneResidencial="+551236429660" Sexo="F"/>
<z:row PrimeiroNome="BRANCALY" Sobrenome="MACHAT" email=" " TelefoneResidencial="+551150612317" Sexo="F"/>
Raciel R.L.
February 14,
Actually, I tried with a constant file and it didn´t work. I´m using AW 1.0.2. Here is the code piece...

// create ActiveWidgets data model - XML-based table
var table = new Active.XML.Table;

/*table.setText = function(value, i, j){
var node = this.getNode(i, j);
node.text = value; } */

// define column labels
var columns = [<%=commaSeparatedColumns%>];


// provide data URL

// start asyncronous data retrieval

// create ActiveWidgets Grid javascript object
var obj = new Active.Controls.Grid;

// replace the built-in row model with the new one (defined in the patch)
obj.setModel("row", new Active.Rows.Page);

obj.setProperty("row/count", <%=intRecordCount%>);
obj.setProperty("column/count", <%=Ubound(objCols)+1%>);

// provide column labels
obj.setColumnProperty("texts", columns);

// provide external model as a grid data source

// set page size
obj.setProperty("row/pageSize", 50);

// write grid html to the page

document.getElementById("gridDIV").innerHTML = obj;
Raciel R.L.
February 14,
With this file format you have to specify namespaces and also the row XPath -

//	define namespaces
    table.setNamespace("rs", "urn:schemas-microsoft-com:rowset");
    table.setNamespace("z", "#RowsetSchema");

    //	set rows XPath

    //	set column XPath
    table.setColumns(["@PrimeiroNome", "@Sobrenome", "@email", "@TelefoneResidencial", "@Sexo"]);
Alex (ActiveWidgets)
February 14,
It JUST WORKS! Great job.. now I´ve one less layer... (XML transformation). Alex, I´ve posted a thread recently.. could you check this out please?


It´s VERY important for me.. (I´m currently handling a LARGE amount of records.. I choose XML cause client-server quering, ADO recordsets..etc.. results in a LONG time responses).
Raciel R.L.
February 14,

This topic is archived.

See also:

Back to support forum