Show TOC

XML Namespace SupportLocate this document in the navigation structure

The XML model supports documents using XML namespaces.

For this purpose, you must declare namespaces using the setNameSpace method. The namespace prefixes do not necessarily need to be the same as in the XML document, they only used in the binding paths which are used to address nodes in the document.

Assumed this sample XML document:

<data xmlns="http://tempuri.org/base" xmlns:ext="http://tempuri.org/ext">
     <ext:entry id="0" value="foo" />
     <ext:entry id="1" value="foo" />
</data>

The namespaces must be declared in the JavaScript like this, to be able to bind to them:

var oModel = new sap.ui.model.xml.XMLModel(oXMLDoc);
oModel.setNameSpace("http://tempuri.org/base");
oModel.setNameSpace("http://tempuri.org/ext", "e"); [...]
oTable.bindRows("/e:entry");