Displaying Janus SOAP XML document objects

From m204wiki
Jump to navigation Jump to search

XML document objects can be used in SOUL applications. Ordinarily, to inspect the contents of an XmlDoc or XmlNode object, it must be serialized by one of the XML serializing methods like Serial, Xml, or Print. In either the Janus Debugger or the TN3270 Debugger, if you are debugging a request in which a line like the following is executed:


Requesting the value of %x merely reports whether the object has content:


If the program in the preceding example contained a subsequent assignment statement to a string variable like the following, you could display the XmlDoc content by watching for or requesting the value of %longstring:

%longstring = %x:serial(,'EBCDIC') 

When no such serializing statement is present, the Serialize feature lets you implicitly call the Janus SOAP XML Serial method to view the contents of an XmlDoc or XmlNode object.

You can invoke the feature multiple ways for XmlDoc variable %doc:

  • Display the expanded value of %doc:serial in a Value window.
    • Enter %doc:serial in the Entity name input box below the main window.
    • Click the Value button.  
    • Add %doc to the Watch Window (by right clicking the Source Code line containing %doc and selecting the Add Watch option, or by entering %doc in the text box above the Watch Window and clicking the Add Watch button).
    • right click %doc in the Watch Window and select the Serialize option.
  • Display the value of %doc:serial in the Watch Window:
    • Enter %doc:serial in the Entity name input box.
    • Click the Watch button.  

For the example code above, if you specify %x:serial in the Entity name input box and click the Value button (at any point after the execution of the %x:loadxml statement cited at the beginning of this section), the following Value window displays:


The Serialize feature formats the return value of the Serial call as if you specified the following form of the method (which calls for a single string with EBCDIC characters, carriage return/line feed character sequences, and 3 space indentation of nested elements):

Serial(, 'EBCDIC CRLF Indent 3')

The Serial method defaults are UTF-8 instead of EBCDIC, and no added line end or indentation characters. So for user convenience, the Debugger is internally providing its own Serial method defaults (which you can adjust, as described in the "Serial method formatting defaults" subsection).

Debugger Serial method compared to source code Serial methods

The Debugger's internal Serial method handling is independent of Serial method calls actually specified in the source code you are debugging. For example, in the following excerpt, the User Language object pointed to by %d (of type document) contains a variable member named x  that is an XmlDoc:

class document                        public             variable x is object XmlDoc                           constructor new                    subroutine addStooge(%iFirst is longstring, -                              %iLast is longstring)         end public   ... %d is object document      %d = new                   %l is longstring   %d:addstooge('Moe", 'Howard')  ... %l = %d:x:serial  ...

If you are watching %l, which is not an object variable, you find that its value is shown as a Unicode binary string when the %l = %d:x:serial statement is executed:


However, you can use the Debugger's Serial method feature and request a detailed view of the XmlDoc object variable x:

  1. Specify %d:x:serial in the Entity name input box below the main window.
  2. Click the Value button.
You see the serialized form of the XmlDoc in the Value window:


Serial method formatting defaults

The preceding Value window display also shows again the effect of the implicit Debugger Serial parameters CRLF and Indent 3. These formatting defaults (for XmlDoc and XmlNode objects) are specified in the Debugger Client configuration file (debuggerConfig.xml):

<serialParms>CRLF INDENT 3</serialParms>

You can change this formatting, for example, to increase the indentation:

<serialParms>CRLF INDENT 10</serialParms>

To suppress this feature (never have the Debugger add parameters to serial), specify no value:


See Also:

Watching object variables