pp108 : setNamespaceWithPrefix()

setNamespaceWithPrefix()


Sets the namespace with prefix on the model. This method is used in runtime when the data with different namespaces is supplied from different documents to the single model.

Syntax

Script

modelID.setNamespaceWithPrefix(prefix, namespaceURI)

Parameters

Parameter

Description

prefix

Namespace prefix.

namespaceURI

Namespace URI to be set for the prefix.

Return Value


No value is returned.

Remarks


This method must be used before modelID.putData(<data>) if the namespaces of the <data> is different from the namespaces available on the model.

Sample Codes

<xml id="response">
    <data>
        <GetCategoriesObjectResponse
            xmlns="http://schemas.cordys.com/Northwind" xmlns:SOAP="http://schemas.xmlsoap.org/soap/envelope/">
            <tuple>
                <old>
                    <Categories>
                        <CategoryID>1</CategoryID>
                        <CategoryName>Beverages</CategoryName>
                        <Description>Soft drinks, coffees, teas, beers, and ales</Description>
                        <Picture/>
                    </Categories>
                </old>
            </tuple>
        </GetCategoriesObjectResponse>
    </data>
</xml>


This sample code demonstrates how the method can be used.

//The XMLDocument of the response xml should be passed as the parameter for the putData.
cateGoriesResponse = response.XMLDocument;

//set the namespace for the model "CategoriesModel"
CategoriesModel.setNamespaceWithPrefix("tns", "http://schemas.cordys.com/Northwind");
CategoriesModel.setNamespaceWithPrefix("xmlns", "http://schemas.cordys.com/Northwind");

//Now put the data on to the model
CategoriesModel.putData(cateGoriesResponse);

Applies to


Model

Related reference

Retrieving Data For Models
Model