Show TOC

Instantiating an XML ModelLocate this document in the navigation structure

The XML model allows to bind controls to XML data. It is a client-side model intended for small datasets, which are completely available on the client. The XML model does not contain mechanisms for server-based paging or loading of deltas. It supports two-way binding.


  1. Instantiate the model:
    var oModel = new sap.ui.model.xml.XMLModel();
  2. The XML model also has a setData method. As XML documents cannot be embedded inline in JavaScript, the XMLModel uses an XML document reference as a parameter.
  3. To create inline XML data or to get XML data as a string, the XML model provides a setXML method. This method takes XML in text format and uses the browser's XML parser to create a document.
    oModel.setXML("<?xml version=\"1.0\"?><some><xml>data</xml></some>");
  4. Usually, you load your data from the server using an HTTP-based service, so the loadData method provides an easy way to load XML data from the given URL:

Next Steps

For a complete listing of the available methods and parameters, see the API Reference.