Skip to main content

How to preserve case of data names for XML tags in XML GENERATE (Net Express)

  • February 15, 2013
  • 0 replies
  • 0 views

Problem:

By default the XML GENERATE statement converts data names to upper case to generate XML tags.

The following:

01 myXML pic x(1000).

01 myItem1.

     05 myItem2 pic x(10) value "my value".

...

Xml generate myXML from myItem1

would generate

"<MYITEM1><MYITEM2>my value</MYITEM2></MYITEM2>"

in myXML

Resolution:

To preserve the case of data names when XML tags are generated with XML GENERATE it is necessary to use the PRESERVECASE compiler directive, i.e.

      $SET PRESERVECASE

This directive is not documented in Server Express 5.0 but should be documented in Server Express 5.1.

After setting PRESERVECASE, the contents of myXML in the example above would be:

"<myItem1><myItem2>my value</myItem1></myItem2>

Old KB# 1395