XML:
setXml : function(){
oXMLModel = new sap.ui.model.xml.XMLModel();
var sXML ="<res><SolutionsResponse><SolList><Solution><SupportedMobileDetails><SupportedMobileDetail><SupportedMobileDevice>Smartphone</SupportedMobileDevice><SupportedMobileOS>Blackberry</SupportedMobileOS><Version>6</Version><StatusDescription>Productive</StatusDescription><SupportedMobileURL>https://hxi-cust802.dev.sapbydesign.com/sap/cpa/ui/esdownloads/0194814131_0/Smartphone_Blackberry_2.0/SalesService.zip</SupportedMobileURL><SupportedMobileDeviceCode>2</SupportedMobileDeviceCode><SupportedMobileOSCode>4</SupportedMobileOSCode></SupportedMobileDetail></SupportedMobileDetails></Solution><Solution><SupportedMobileDetails><SupportedMobileDetail><SupportedMobileDevice>Tablet</SupportedMobileDevice><SupportedMobileOS>ios</SupportedMobileOS><Version>6</Version><StatusDescription>New</StatusDescription><SupportedMobileURL>https://hxi-cust802.dev.sapbydesign.com/sap/cpa/ui/esdownloads/0194814131_0/Smartphone_Blackberry_2.0/SalesService.zip</SupportedMobileURL><SupportedMobileDeviceCode>2</SupportedMobileDeviceCode><SupportedMobileOSCode>4</SupportedMobileOSCode></SupportedMobileDetail></SupportedMobileDetails></Solution><Solution><SupportedMobileDetails><SupportedMobileDetail><SupportedMobileDevice>Tablet</SupportedMobileDevice><SupportedMobileOS>ios</SupportedMobileOS><Version>6</Version><StatusDescription>New</StatusDescription><SupportedMobileURL>https://hxi-cust802.dev.sapbydesign.com/sap/cpa/ui/esdownloads/0194814131_0/Smartphone_Blackberry_2.0/SalesService.zip</SupportedMobileURL><SupportedMobileDeviceCode>2</SupportedMobileDeviceCode><SupportedMobileOSCode>4</SupportedMobileOSCode></SupportedMobileDetail><SupportedMobileDetail><SupportedMobileDevice>SmartPhone</SupportedMobileDevice><SupportedMobileOS>ios</SupportedMobileOS><Version>6</Version><StatusDescription>New</StatusDescription><SupportedMobileURL>https://hxi-cust802.dev.sapbydesign.com/sap/cpa/ui/esdownloads/0194814131_0/Smartphone_Blackberry_2.0/SalesService.zip</SupportedMobileURL><SupportedMobileDeviceCode>2</SupportedMobileDeviceCode><SupportedMobileOSCode>4</SupportedMobileOSCode></SupportedMobileDetail></SupportedMobileDetails></Solution></SolList></SolutionsResponse></res>";
this.oModel = sap.ui.getCore().getModel(
this.oController.sModelId);
this.oModel.setXML(sXML);
sap.ui.getCore().byId('rr1').setModel(this.oModel);
},
var oSixthCell = new sap.ui.commons.layout.MatrixLayoutCell();
var omainLayout = new sap.ui.commons.layout.HorizontalLayout('main');
//var sXMLUtilCounLang = new sap.cp.core.util.XMLUtil(sXML);
var oRowRepeater = new sap.ui.commons.RowRepeater("rr1");
var matrixRow, matrixCell, control;
var oRowTemplate = new sap.ui.commons.layout.MatrixLayout("template");
matrixRow = new sap.ui.commons.layout.MatrixLayoutRow();
// Device Links
control = new sap.ui.commons.Link({
press:function(){
// Os Links
control = new sap.ui.commons.Link({
press:function(){
// Version Links
control = new sap.ui.commons.Link({
press:function(){
// Type Links
control = new sap.ui.commons.Link();
control.bindProperty("text","type");
matrixCell = new sap.ui.commons.layout.MatrixLayoutCell();
matrixCell.addContent(control);
matrixRow.addCell(matrixCell);
}
});
control.bindProperty("text","version");
matrixCell = new sap.ui.commons.layout.MatrixLayoutCell();
matrixCell.addContent(control);
matrixRow.addCell(matrixCell);
}
});
control.bindProperty("text","os");
matrixCell = new sap.ui.commons.layout.MatrixLayoutCell();
matrixCell.addContent(control);
matrixRow.addCell(matrixCell);
}
});
control.bindProperty("text","/SupportedMobileDetail/SupportedMobileDevice");
matrixCell = new sap.ui.commons.layout.MatrixLayoutCell();
matrixCell.addContent(control);
matrixRow.addCell(matrixCell);
this.setXml();
var sXMl = this.oModel.getXML();
var sXMLOS = new sap.cp.core.util.XMLUtil(sXMl);
oVarXmlModelOS= new sap.ui.model.xml.XMLModel();
oVarXmlModelOS.setSizeLimit(5000);
oVarXmlModelOS.setXML(jQuery.sap.serializeXML(sXMLOS.Find('Solution')[0]));
omainLayout.setModel(oVarXmlModelOS);
oRowRepeater.bindRows("/", oRowTemplate);
omainLayout.addContent(oRowRepeater);
oSixthCell.addContent(omainLayout);
oDownloadTrialLayout.createRow(oSixthCell);
我正在创建一个带有要绑定的xml数据的sapui5应用程序。我需要一些帮助来将xml绑定到我的结构。
我是sapui5的新手,我正在创建一个示例应用程序,我需要相同的帮助才能将确切的数据绑定到确切的字段
任何人都可以帮助我。