IRISLIB database
InspectSAXTree Class Reference

Support Utility to review contents of SAXTree independently from XML Writer functionality. More...

Static Public Member Functions

 DumpBinaryTree (xmlGbl, docId, _.Stream.Object outstream)
 Optional binary tree walking. More...
 
 OutputTree (xmlGbl, docSequence, nodeId, _.Library.CharacterStream outstream, dumpBinary)
 xmlGbl = SAX variable passed by reference More...
 
_.Library.Status ParseFile (_.Library.String inputFilePath, _.Library.String outputFilePath, dumpBinary)
 For a given filepath. More...
 
_.Library.Status ParseStream (xmlstream, _.Library.String outputFilePath, _.Library.Boolean dumpBinary)
 For a given stream containing XML. More...
 
_.Library.Status ParseString (_.Library.String xmlString, _.Library.String outputFilePath, _.Library.Boolean dumpBinary)
 For a given string containing XML. More...
 
_.Library.Status ParseXData (xdataclass, xdataname, _.Library.String outputFilePath, _.Library.Boolean dumpBinary)
 For a given Class XData Block. More...
 

Static Public Attributes

 lblAttribute = None
 Display name used to indicate an attribute type.
 
 lblElement = None
 Display name used to indicate an element type.
 
 lblRAWNode = None
 Display name used to indicate a raw node type.
 
 lblTextNode = None
 Display name used to indicate a text node type.
 
 lblWhiteSpaceNode = None
 Display name used to indicate a whitespace node type.
 

Detailed Description

Support Utility to review contents of SAXTree independently from XML Writer functionality.


Provides convenience methods ParseFile, ParseString, ParseStream and ParseXData for common support situations. Alternatively the method "OutputTree" can be called directly for additional scenarios.

Member Function Documentation

◆ DumpBinaryTree()

DumpBinaryTree (   xmlGbl,
  docId,
_.Stream.Object  outstream 
)
static

Optional binary tree walking.

Normal operation would be to invoke OutputTree method instead. Parameters:

  • xmlGbl - Required. Pass local global by reference, being used to hold a SAX tree. eg: .SAX
  • docId - Required. The SAX global (or alternative global) first key is an incrementing sequence for each XML document deserialized into XML Nodes.
    ie: for SAX(docId) would pass first key docId
  • outstream - Optional. If not supplied when the tool is run it will output to default device, for example the window of an interactive terminal session. Alternatively an open file stream can be passed in and output will be written to the file.

◆ OutputTree()

OutputTree (   xmlGbl,
  docSequence,
  nodeId,
_.Library.CharacterStream  outstream,
  dumpBinary 
)
static

xmlGbl = SAX variable passed by reference

Support user entry point Parameters:

  • xmlGbl - Optional. The name of the local global being used to hold a SAX tree.
    If not supplied this will default to SAX global
  • docSequence - Optional. The SAX global (or alternative global) first key is an incrementing sequence for each XML document deserialized into XML Nodes. ie: SAX(docSequence)
    If not supplied the highest document id incremented is assumed to be the current one of interest.
  • nodeId - Optional. The starting point in the SAX Tree to start analysis from. Typically would want to walk the whole document tree from 0.
  • outstream - Optional. If not supplied when the tool is run it will output to default device, for example the window of an interactive terminal session. Alternatively an open file stream can be passed in and output will be written to the file.
  • dumpBinary - Optional. Some additional presentation of binary SAX tree portion that may be of value.

Example to output to terminal session (or other default device):

do ##class(Util.SAXDebugWriter).OutputTree()

Example to output to a file:

Set stream=##class(FileBinaryStream).New() set stream.Filename="c:\tmp\SAXDebug"_msgId_"LoadedSimple.txt" do ##class(Util.SAXDebugWriter).OutputTree(,simpleDocId,,.stream) do stream.Save() do stream.Close()

◆ ParseFile()

_.Library.Status ParseFile ( _.Library.String  inputFilePath,
_.Library.String  outputFilePath,
  dumpBinary 
)
static

For a given filepath.

Read in file as XML and output the corresponding SAX Tree structure Parameters:

  • inputFilePath - Required. The name of a local file containing XML.
  • outputFilePath - Optional. The name of a local file containing XML.
  • dumpBinary - Optional. To include additional and alternative view of content.

Example to explore an XML file and print output to default device

set tSC=##class(XML.Utils.InspectSAXTree).ParseFile(inputFilePath) do $SYSTEM.Status.DisplayError(tSC)

Example to explore an XML file and print output report to file.

set tSC=##class(XML.Utils.InspectSAXTree).ParseFile(inputFilePath,outputFilePath) do $SYSTEM.Status.DisplayError(tSC)

◆ ParseStream()

_.Library.Status ParseStream (   xmlstream,
_.Library.String  outputFilePath,
_.Library.Boolean  dumpBinary 
)
static

For a given stream containing XML.

Read in XML and output the corresponding SAX Tree structure Parameters:

  • xmlstream - Required. Stream containing well formed XML data.
  • outputFilePath - Optional. The name of a local file containing XML.
  • dumpBinary - Optional. To include additional and alternative view of content.

Example to explore a stream of XML content and print output to default device

set tSC=##class(XML.Utils.InspectSAXTree).ParseStream(myxmlstream) do $SYSTEM.Status.DisplayError(tSC)

Example to explore an XData block and print output report to file.

set tSC=##class(XML.Utils.InspectSAXTree).ParseStream(myxmlstream,outputFilePath) do $SYSTEM.Status.DisplayError(tSC)

◆ ParseString()

_.Library.Status ParseString ( _.Library.String  xmlString,
_.Library.String  outputFilePath,
_.Library.Boolean  dumpBinary 
)
static

For a given string containing XML.

Read in XML and output the corresponding SAX Tree structure Parameters:

  • xmlString - Required. String containing well formed XML data.
  • outputFilePath - Optional. The name of a local file containing XML.
  • dumpBinary - Optional. To include additional and alternative view of content.

Example to explore a string of XML content and print output to default device

set myxmlstring="<root><test>some data</test></root" set tSC=##class(XML.Utils.InspectSAXTree).ParseString(myxmlstring) do $SYSTEM.Status.DisplayError(tSC)

Example to explore a string of XML content and print output report to file.

set tSC=##class(XML.Utils.InspectSAXTree).ParseStream(myxmlstream,outputFilePath) do $SYSTEM.Status.DisplayError(tSC)

◆ ParseXData()

_.Library.Status ParseXData (   xdataclass,
  xdataname,
_.Library.String  outputFilePath,
_.Library.Boolean  dumpBinary 
)
static

For a given Class XData Block.

Read in XData content as XML and output the corresponding SAX Tree structure Parameters:

  • xdataclass - Required. Compiled classname with XData to review.
  • xdataname - Required. The name of XData block to review.
  • outputFilePath - Optional. The name of a local file containing XML.
  • dumpBinary - Optional. To include additional and alternative view of content.

Example to explore an XData block and print output to default device

set tSC=##class(XML.Utils.InspectSAXTree).ParseXData(myclassname,xdataname) do $SYSTEM.Status.DisplayError(tSC)

Example to explore an XData block and print output report to file.

set tSC=##class(XML.Utils.InspectSAXTree).ParseXData(myclassname,xdataname,outputFilePath) do $SYSTEM.Status.DisplayError(tSC)