Skip to Content
May 31, 2013 at 08:11 PM

Table shows only one entry from bound XML model whereas more entries are present in XML model


Hello Experts,

I am trying to bind the rows of a UI5 with a XML model. The problem is, even though I have two entries in the XML data, the table only shows the first entry.

Code for Table:

var  oTable = new sap.ui.table.Table("myTab",{               columns : [               {label: "Category", template: "d:CategoryName"},              {label: "Name", template: "d:ProductName" },              {label: "Sales", template: "d:ProductSales"}              ]          });

Code for DataBinding:

var oModel = new sap.ui.model.xml.XMLModel();var xmldata  = '<?xml version="1.0" encoding="utf-8" standalone="yes"?>'+            '<feed xml:base="" xmlns:d="" xmlns:m="" xmlns="">'+              '<entry>'+              '<content type="application/xml">'+              '<m:properties>'+        '<d:CategoryName>Beverages</d:CategoryName>'+        '<d:ProductName>Chang</d:ProductName>'+        '<d:ProductSales m:type="Edm.Decimal">7038.5500</d:ProductSales>'+        '</m:properties>'+              '</content>'+            '</entry>'+            '<entry>'+              '<content type="application/xml">'+              '<m:properties>'+        '<d:CategoryName>Beverages1</d:CategoryName>'+        '<d:ProductName>Chang1</d:ProductName>'+        '<d:ProductSales m:type="Edm.Decimal">8198.5500</d:ProductSales>'+        '</m:properties>'+              '</content>'+            '</entry>'+            '</feed>' ;         oModel.setXML(xmldata);            oTable = sap.ui.getCore().byId("myTab");         oTable.setModel(oModel );            oTable.bindRows("/entry/content/m:properties");

What could be the reason of error?