1
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 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();

control = new sap.ui.commons.Link({
  press: function() {
    control = new sap.ui.commons.Link({
      press: function() {
        control = new sap.ui.commons.Link({
          press: function() {
            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 绑定到我的结构。

4

0 回答 0