Please enable JavaScript to view this site.

Altova MapForce 2020 Enterprise Edition

This class provides methods for manipulating XML elements from your schema. Methods of this class can be called on elements, not on the XML document itself. Note that, in order to call methods of this class, you don't need to instantiate the class directly. Any element created using the append() or appendWithPrefix() methods is of [ElementType] type.

 

Methods


Name

Description

ic_java_public_member

void declareNamespace(String prefix, String nsURI)

This method takes two arguments that are both of string type: the prefix and the namespace URI that you want to use. The prefix supplied as argument will be mapped to the namespace URI value supplied as argument. If the prefix supplied as argument is empty, the method creates or overrides the default namespace declaration in the element.

 

For example, let's assume that the XML document has an XML element called "purchase". If you call

 

purchase.declareNamespace("ord", "http://OrderTypes");

 

then the XML document becomes

 

<purchase xmlns:ord="http://OrderTypes" />

 

Another example, if you call:

 

purchase.declareNamespace("", "http://OrderTypes");

 

then the XML document becomes

 

<purchase xmlns="http://OrderTypes" />

 

Note:The declared namespace is used when appending subsequent child elements or attributes, according to the following rules:

 

1.If the child namespace is the default, then use empty prefix.

2.If the child namespace is equal to the parent one, then use the parent prefix.

3.Otherwise, search for nearest prefix from parent to top, using the lookup algorithm described in section "B.2: Namespace Prefix Lookup" at https://www.w3.org/TR/2002/WD-DOM-Level-3-Core-20021022/namespaces-algorithms.html.

4.If there is no prefix for element namespace found, then use empty prefix.

© 2020 Altova GmbH