XML-TEXT and XML-NTEXT

For most XML events, the parser sets XML-TEXT or XML-NTEXT to an associated document fragment.

Typically, the parser sets XML-TEXT if the XML document is in an alphanumeric data item. The parser sets XML-NTEXT if:

  • The XML document is in a national data item.
  • The XMLPARSE(XMLSS) option is in effect and the RETURNING NATIONAL phrase is specified in the XML PARSE statement.
  • The ATTRIBUTE-NATIONAL-CHARACTER or CONTENT-NATIONAL-CHARACTER event occurs.

The special registers XML-TEXT and XML-NTEXT are mutually exclusive. When the parser sets XML-TEXT, XML-NTEXT is empty with length zero. When the parser sets XML-NTEXT, XML-TEXT is empty with length zero.

To determine the number of character encoding units in XML-NTEXT, use the LENGTH intrinsic function; for example FUNCTION LENGTH(XML-NTEXT). To determine the number of bytes in XML-NTEXT, use special register LENGTH OF XML-NTEXT. The number of character encoding units differs from the number of bytes.

To determine the number of bytes in XML-TEXT, use either special register LENGTH OF XML-TEXT or the LENGTH intrinsic function; each returns the number of bytes.

The XML-TEXT and XML-NTEXT special registers are undefined outside the processing procedure.

Related concepts    
XML events  
XML-CODE  

Related tasks    
Writing procedures to process XML  

Related references  
XMLPARSE (compiler option)
  
XML-TEXT (Enterprise COBOL for z/OS® Language Reference)
XML-NTEXT (Enterprise COBOL for z/OS Language Reference)