NORMXML

Use this function to remove XML formatting from an input XML fragment. The function accepts text items only.

Syntax:
NORMXML (single-text-expression)
Meaning:
NORMXML (XML fragment)
Returns:
A single text item

This function removes any XML whitespaces from between a (parent) start tag and the start tag of the first child element; and from between the end tag of the child element and the (parent) end tag. XML whitespace pertains to carriage returns, line feeds, tabs, and spaces.

For example, all carriage returns, line feeds, tabs, and spaces in between parent tags <A> and </A> are removed, excluding any that are inside of child element tags <a> and </a>.

In the following example, there is a carriage return after <A>, </a>, and </b>. There are also three spaces before <a> and three spaces before <b>.

<A>
   <a>This is sample text</a>
   <b>More   sample text</b>
</A>
The NORMXML function removes the three carriage returns and the six spaces. As a result, there is one line instead of four lines:
<A><a>This is sample text</a><b>More   sample text</b></A>

Limitation

When a type has mixed content, the function removes any XML whitespaces from the character data sections. Here is the previous example, but with mixed content added:
<A>My first example
   <a>This is sample text</a>
   <b>More   sample text</b>
</A>
This is the result of using the NORMXML function:
<A>Myfirstexample<a>This is sample text</a><b>More   sample text</b></A>
The XML whitespaces in My first example are removed because they are not enclosed within child element tags.

Using SIZE with NORMXML

The NORMXML function converts the input data to Unicode, and then removes the XML formatting from the input XML fragment. The conversion to Unicode is transparent because the normal processing automatically converts the data from Unicode to the character set that was assigned to the output object.

If the SIZE function is used with the NORMXML function to determine the size of the specified object after NORMXML removes the XML formatting from the input XML fragment, the SIZE operation calculates the size of the data as it exists at that time, in the Unicode character set. The returned size does not match the size that would have been calculated if the data remained in its original character set, unless the original character set was Unicode.

Using CSIZE with NORMXML

If the CSIZE function is used with the NORMXML function, the CSIZE operation returns the size in characters, regardless of the character set.