IRISLIB database
ImportHandler Class Reference

SAX Content handler for ObjectScript XML Implementation. More...

Inheritance diagram for ImportHandler:
Collaboration diagram for ImportHandler:

Public Member Functions

 AddIDs ()
 SAX Content handler for ObjectScript XML Implementation. More...
 
_.Library.String CopyDocument ()
 Make a copy of the document to another node in the same global. More...
 
_.Library.String GetNextId (_.Library.String id)
 Gets the next id for this document based on the id table and returns in id argument. More...
 
- Public Member Functions inherited from ContentHandler
_.Library.Status LocatePosition (_.Library.Integer Line, _.Library.Integer Offset)
 Locate the current position within the parsed document. More...
 
_.Library.Integer Mask ()
 Calculate MASK for call to xerces parser. More...
 
_.Library.Status OnPostParse ()
 Callback after XML parse complete.
 
_.Library.Status PopHandler ()
 Return to the previous handler.
 
_.Library.Status PushHandler (_.XML.SAX.ContentHandler Handler)
 Push a new handler on the stack. More...
 
 characters (_.Library.String chars, _.Library.Integer length)
 Receive notification of character data inside an element. More...
 
 comment (_.Library.String chars, _.Library.Integer length)
 Receive notification of comments. More...
 
 endCDATA ()
 Receive notification of the end of a CDATA section. More...
 
 endDTD ()
 Receive notification of the end of the DTD declarations. More...
 
 endDocument ()
 Receive notification of the end of the document. More...
 
 endElement (_.Library.String uri, _.Library.String localname, _.Library.String qname)
 Receive notification of the end of an element. More...
 
 endEntity (_.Library.String name)
 Receive notification of the end of an entity. More...
 
 endPrefixMapping (_.Library.String prefix)
 Receive notification of the end of an namespace prefix mapping. More...
 
 error (_.Library.String error)
 Receive notification of a recoverable parser error. More...
 
 fatalError (_.Library.String fatalerror)
 Report a fatal XML parsing error. More...
 
 ignorableWhitespace (_.Library.String chars, _.Library.Integer length)
 Receive notification of ignorable whitespace in element content. More...
 
 processingInstruction (_.Library.String target, _.Library.String data)
 Receive notification of a processing instruction in element content. More...
 
 skippedEntity (_.Library.String name)
 Receive notification of a skipped entity. More...
 
 startCDATA ()
 Receive notification of the start of a CDATA section. More...
 
 startDTD (_.Library.String name, _.Library.String publicId, _.Library.String systemId)
 Receive notification of the start of the DTD declarations. More...
 
 startDocument ()
 Receive notification of the beginning of the document. More...
 
 startElement (_.Library.String uri, _.Library.String localname, _.Library.String qname, _.Library.List attrs)
 Receive notification of the start of an element. More...
 
 startEntity (_.Library.String name)
 Receive notification of the start of an entity. More...
 
 startPrefixMapping (_.Library.String prefix, _.Library.String uri)
 Receive notification of the start of an namespace prefix mapping. More...
 
 warning (_.Library.String warning)
 Receive notification of a parser warning. More...
 
- Public Member Functions inherited from RegisteredObject
_.Library.Status OnAddToSaveSet (_.Library.Integer depth, _.Library.Integer insert, _.Library.Integer callcount)
 This callback method is invoked when the current object is added to the SaveSet,. More...
 
_.Library.Status OnClose ()
 This callback method is invoked by the <METHOD>Close</METHOD> method to. More...
 
_.Library.Status OnConstructClone (_.Library.RegisteredObject object, _.Library.Boolean deep, _.Library.String cloned)
 This callback method is invoked by the <METHOD>ConstructClone</METHOD> method to. More...
 
_.Library.Status OnNew ()
 This callback method is invoked by the <METHOD>New</METHOD> method to. More...
 
_.Library.Status OnValidateObject ()
 This callback method is invoked by the <METHOD>ValidateObject</METHOD> method to. More...
 

Static Public Member Functions

_.Library.String GetAttribute (_.Library.String tree, attribute)
 Serialize the value ofthe specified attribute as text string. More...
 
 KillDocument (documentId)
 Kill the document specified by the documentId argument.
 
_.Library.Boolean SerializeAttribute (_.Library.String tree, attribute, _.Library.Boolean outputStream, data, _.Library.Boolean lineMode)
 Serialize the value of the specified attribute as text. More...
 
_.Library.Boolean SerializeBase64Attribute (_.Library.Integer tree, attribute, _.Library.Boolean outputStream, data, _.Library.Boolean hex, _.Library.String baseChildlist)
 Serialize the base64 encoded text children of this node as text. More...
 
_.Library.Boolean SerializeBase64Node (_.Library.Integer tree, _.Library.Integer node, _.Library.Boolean outputStream, data, _.Library.Boolean hex, _.Library.String baseChildlist)
 Serialize the base64 encoded text children of this node as text. More...
 
_.Library.Boolean SerializeNode (_.Library.String tree, _.Library.String node, _.Library.Boolean outputStream, _.Library.Integer mixed, data, _.Library.Boolean includeTop, _.Library.Boolean lineMode, _.Library.String baseChildlist)
 Serialize the children of this node as text. More...
 

Additional Inherited Members

- Static Public Attributes inherited from RegisteredObject
 CAPTION = None
 Optional name used by the Form Wizard for a class when generating forms. More...
 
 JAVATYPE = None
 The Java type to be used when exported.
 
 PROPERTYVALIDATION = None
 This parameter controls the default validation behavior for the object. More...
 

Detailed Description

SAX Content handler for ObjectScript XML Implementation.



This class and the data structure defined here is used internally by InterSystems IRIS. You should not make direct use of this class or data structure within your applications. The global data structure may be accessed using the macros in xmlDOM.inc or by using the XML.Node class. There is no guarantee made about either the behavior or future operation of this class.

This content handler stores the XML document as nodes of a tree. The <property>GlobalName</property> property determines where these nodes are stored. The default for the <property>GlobalName</property> property is ^||xmlTemp. The <property>Tree</property> property determines the specific node used to store the nodes of the tree.

The structure of the tree is as follows:

The tree is stored ..GlobalName@(..Tree) which is stored in ..DocumentId. ..GlobalName@(..Tree) - number of nodes. @iDocumentId@(node) describes the node given by the integer node number.

    Each XML DOM node will be described by a 4 character entry node descriptor.
    Since any node will be the child of an element node, the node descriptor entries will be
    stored in the childlist of its parent which is in the element descriptor node or one of its extension nodes.  
    The attribute nodes will be first in the element descriptor node in the order that they are 
    presented by Xerces.  Element and character node entries follow in the XML document order.
    Each element descriptor is limited to the maximum length ObjectScript string.  
    Thus provision is made for extension child lists.
    The list of element and character nodes is terminated by a next descriptor node which is
    a reference to the next extension or 0 for the last.
    Each element descriptor node and element descriptor extension node is structured as follows:
@iDocumentId@(node) is 28 character base followed by the list of node descriptors. @iDocumentId@(node) = CLparent_CLoffset_name_(prefix|flags)_elementOffset_URI_line_column_ChildList CLparent($zlchar) is the node number of the parent's child list which contains this node's descriptor. CLoffset($zlchar) is the 1-based offset in characters in CLparent node of this node's descriptor. name ($zlchar) - index of element name in the name dictionary. prefix($zlchar\16) - index of the prefix part of the QName (including ':') in the name dictionary or 0 if no prefix If the qname and the unqualified name are the same, then the prefix is not present. flags($zlchar#16) right-most bit (1) if xsi:nil or xsi:null specified as true or 1 second bit (2) is skip flag elementOffset($zwchar) is the offset of the first child element in the child list. This value is 29+(numAttrs*16) for the first child list and 29 for all subsequent child lists. URI($zwchar) is index of the URI for this element or not stored. line($zlchar) part of the location for element node. column($zlchar) part of the location for element node. ChildList is list of attribute, element and character entries. A document node is introduced which represents the document and has as its child the root element of the document. Node 0 is the document node and node 1 is the child list for the document node. @iDocumentId@(0) = documentBase_documentChildlist @iDocumentId@(1) = rootElementDescriptor documentBase: $zlchar(0,0,0,0,0)_$zwchar(29,0)_$zlchar(0,0) documentChildList: $zlchar(16) i.e 1 shifted left 4 rootElementDescriptor: $zlchar(0,0,0)_name_prefix_elementOffset_URI_line_column name, URI, prefix, elementOffset, line, column refer to the root element. See below for definition of element descriptor. There are 4 types of node descriptors: attribute, element, character and next. The attribute node descriptor (length 16): name_prefix_URI_valueURI_value name($zlchar) is the attribute name prefix($zlchar) - index of the prefix (including ':') in the name dictionary or 0 if no prefix URI($zwchar) - index of the namespace URI for this attriibute or 0 if no namespace. valueURI($zwchar) - index of the namespace URI corresponding to the prefix when the attribute value is of the form "prefix:value". value($zlchar) - index of the value of the attribute in the name dictionary The element node descriptor: elementDescriptor|type elementDescriptor($zlchar\16) is the node number of the elementDescriptor for this element. type($zlchar#16) of the node: 0 for element The character node descriptor: valueindex|type valueindex($zlchar\16) - data dictionary index of character value of the node. type($zlchar#16) of the node: 1 for character data or 2 for character data that is only whitespace. The next node descriptor: next|type next($zlchar\16) - index of next element descriptor extension. type($zlchar#16) of the node: 3 for next element descriptor. Errors and warnings are returned as follows. The SAX parser also returns immediately following a fatal error with an error status: @iDocumentId@(type)=count where type is "fatalerror", "error" or "warning". @iDocumentId@(type,index)=message Elements with "id" attributes are indexed as follows: @iDocumentId@("i",id)=CLparent_","_CLoffset id is the value of "id" atribute CLparent is the node number of the parent's child list which contains this node's descriptor. CLoffset is the 1-based offset in characters in CLsub node of this node's descriptor. The name dictionary is used to store prefixes, attribute values and node values as well as names. The name dictionary used in this XML document is maintained as: @iDocumentId@("d")=the number of names, values, or prefixes including ':' used by this XML document. @iDocumentId@("d",index)=name If the value is > than the max node length, then extensions are stored as followed numbered from 1: @iDocumentId@("d",index,subnodeIndex)=<extension of value> Reverse "D" name to index is only used for COS code added names. Not for names added by Xerces parser. @iDocumentId@("D",name)=index where name is a name or prefix and index is the integer index used for this name. The list of namespaces used in this XML document is maintained as: @iDocumentId@("n")=the number of namespaces used by this XML document. @iDocumentId@("n",index)=namespace @iDocumentId@("N",namespace)=index where namespace is the the uri for a namespace and index is the integer index used for this namespace in the "u" and "v" nodes above. @iDocumentId@("N","http://www.w3.org/2001/XMLSchema-instance")=1 and @iDocumentId@("n",1)="http://www.w3.org/2001/XMLSchema-instance" are always true to allow easy lookup of the schema instance namespace: "http://www.w3.org/2001/XMLSchema-instance" The version of the internal content handler is given by a single integer in @iDocumentId@("v")=version integer -- currently 4

Member Function Documentation

◆ AddIDs()

AddIDs ( )

SAX Content handler for ObjectScript XML Implementation.



This class and the data structure defined here is used internally by InterSystems IRIS. You should not make direct use of this class or data structure within your applications. The global data structure may be accessed using the macros in xmlDOM.inc or by using the XML.Node class. There is no guarantee made about either the behavior or future operation of this class.

This content handler stores the XML document as nodes of a tree. The <property>GlobalName</property> property determines where these nodes are stored. The default for the <property>GlobalName</property> property is ^||xmlTemp. The <property>Tree</property> property determines the specific node used to store the nodes of the tree.

The structure of the tree is as follows:

The tree is stored ..GlobalName@(..Tree) which is stored in ..DocumentId. ..GlobalName@(..Tree) - number of nodes. @iDocumentId@(node) describes the node given by the integer node number.

    Each XML DOM node will be described by a 4 character entry node descriptor.
    Since any node will be the child of an element node, the node descriptor entries will be
    stored in the childlist of its parent which is in the element descriptor node or one of its extension nodes.  
    The attribute nodes will be first in the element descriptor node in the order that they are 
    presented by Xerces.  Element and character node entries follow in the XML document order.
    Each element descriptor is limited to the maximum length ObjectScript string.  
    Thus provision is made for extension child lists.
    The list of element and character nodes is terminated by a next descriptor node which is
    a reference to the next extension or 0 for the last.
    Each element descriptor node and element descriptor extension node is structured as follows:
@iDocumentId@(node) is 28 character base followed by the list of node descriptors. @iDocumentId@(node) = CLparent_CLoffset_name_(prefix|flags)_elementOffset_URI_line_column_ChildList CLparent($zlchar) is the node number of the parent's child list which contains this node's descriptor. CLoffset($zlchar) is the 1-based offset in characters in CLparent node of this node's descriptor. name ($zlchar) - index of element name in the name dictionary. prefix($zlchar\16) - index of the prefix part of the QName (including ':') in the name dictionary or 0 if no prefix If the qname and the unqualified name are the same, then the prefix is not present. flags($zlchar#16) right-most bit (1) if xsi:nil or xsi:null specified as true or 1 second bit (2) is skip flag elementOffset($zwchar) is the offset of the first child element in the child list. This value is 29+(numAttrs*16) for the first child list and 29 for all subsequent child lists. URI($zwchar) is index of the URI for this element or not stored. line($zlchar) part of the location for element node. column($zlchar) part of the location for element node. ChildList is list of attribute, element and character entries. A document node is introduced which represents the document and has as its child the root element of the document. Node 0 is the document node and node 1 is the child list for the document node. @iDocumentId@(0) = documentBase_documentChildlist @iDocumentId@(1) = rootElementDescriptor documentBase: $zlchar(0,0,0,0,0)_$zwchar(29,0)_$zlchar(0,0) documentChildList: $zlchar(16) i.e 1 shifted left 4 rootElementDescriptor: $zlchar(0,0,0)_name_prefix_elementOffset_URI_line_column name, URI, prefix, elementOffset, line, column refer to the root element. See below for definition of element descriptor. There are 4 types of node descriptors: attribute, element, character and next. The attribute node descriptor (length 16): name_prefix_URI_valueURI_value name($zlchar) is the attribute name prefix($zlchar) - index of the prefix (including ':') in the name dictionary or 0 if no prefix URI($zwchar) - index of the namespace URI for this attriibute or 0 if no namespace. valueURI($zwchar) - index of the namespace URI corresponding to the prefix when the attribute value is of the form "prefix:value". value($zlchar) - index of the value of the attribute in the name dictionary The element node descriptor: elementDescriptor|type elementDescriptor($zlchar\16) is the node number of the elementDescriptor for this element. type($zlchar#16) of the node: 0 for element The character node descriptor: valueindex|type valueindex($zlchar\16) - data dictionary index of character value of the node. type($zlchar#16) of the node: 1 for character data or 2 for character data that is only whitespace. The next node descriptor: next|type next($zlchar\16) - index of next element descriptor extension. type($zlchar#16) of the node: 3 for next element descriptor. Errors and warnings are returned as follows. The SAX parser also returns immediately following a fatal error with an error status: @iDocumentId@(type)=count where type is "fatalerror", "error" or "warning". @iDocumentId@(type,index)=message Elements with "id" attributes are indexed as follows: @iDocumentId@("i",id)=CLparent_","_CLoffset id is the value of "id" atribute CLparent is the node number of the parent's child list which contains this node's descriptor. CLoffset is the 1-based offset in characters in CLsub node of this node's descriptor. The name dictionary is used to store prefixes, attribute values and node values as well as names. The name dictionary used in this XML document is maintained as: @iDocumentId@("d")=the number of names, values, or prefixes including ':' used by this XML document. @iDocumentId@("d",index)=name If the value is > than the max node length, then extensions are stored as followed numbered from 1: @iDocumentId@("d",index,subnodeIndex)=<extension of value> Reverse "D" name to index is only used for COS code added names. Not for names added by Xerces parser. @iDocumentId@("D",name)=index where name is a name or prefix and index is the integer index used for this name. The list of namespaces used in this XML document is maintained as: @iDocumentId@("n")=the number of namespaces used by this XML document. @iDocumentId@("n",index)=namespace @iDocumentId@("N",namespace)=index where namespace is the the uri for a namespace and index is the integer index used for this namespace in the "u" and "v" nodes above. @iDocumentId@("N","http://www.w3.org/2001/XMLSchema-instance")=1 and @iDocumentId@("n",1)="http://www.w3.org/2001/XMLSchema-instance" are always true to allow easy lookup of the schema instance namespace: "http://www.w3.org/2001/XMLSchema-instance" The version of the internal content handler is given by a single integer in @iDocumentId@("v")=version integer -- currently 4

Adds the elements with ID attribute to the id table.

◆ CopyDocument()

_.Library.String CopyDocument ( )

Make a copy of the document to another node in the same global.

Return the document id of the copy.

◆ GetAttribute()

_.Library.String GetAttribute ( _.Library.String  tree,
  attribute 
)
static

Serialize the value ofthe specified attribute as text string.

Note that the attribute value may be of any length.
tree is the id of the ML document tree.
attribute is the internal form of the attribute specifier as returned by $$$xmliGetAttributeByName or $$$xmlaForEachAttribute.

◆ GetNextId()

Gets the next id for this document based on the id table and returns in id argument.

The nodeid for the rewturned id is the return value.

◆ SerializeAttribute()

_.Library.Boolean SerializeAttribute ( _.Library.String  tree,
  attribute,
_.Library.Boolean  outputStream,
  data,
_.Library.Boolean  lineMode 
)
static

Serialize the value of the specified attribute as text.

Note that the attribute value may be of any length.
tree is the id of the ML document tree.
attribute is the internal form of the attribute specifier as returned by $$$xmliGetAttributeByName or $$$xmlaForEachAttribute.
outputStream is true if the serialized output is to be sent to to the existing stream data.
outputStream is false if the serialized output is to be be appended to the string data. data is created if it is not already defined.
lineMode is true if the stream output should be written in line oriented mode, else the stream output will be written as a continuous block.

◆ SerializeBase64Attribute()

_.Library.Boolean SerializeBase64Attribute ( _.Library.Integer  tree,
  attribute,
_.Library.Boolean  outputStream,
  data,
_.Library.Boolean  hex,
_.Library.String  baseChildlist 
)
static

Serialize the base64 encoded text children of this node as text.


tree is the id of the ML document tree.
attribute is the internal form of the attribute specifier as returned by $$$xmliGetAttributeByName or $$$xmlaForEachAttribute.
outputStream is true if the serialized output is to be sent to to the existing stream data.
outputStream is false if the serialized output is to be be appended to the string data. data is created if it is not already defined.

◆ SerializeBase64Node()

_.Library.Boolean SerializeBase64Node ( _.Library.Integer  tree,
_.Library.Integer  node,
_.Library.Boolean  outputStream,
  data,
_.Library.Boolean  hex,
_.Library.String  baseChildlist 
)
static

Serialize the base64 encoded text children of this node as text.


tree is the id of the ML document tree.
node is the id of the node to be serialized.
outputStream is true if the serialized output is to be sent to to the existing stream data.
outputStream is false if the serialized output is to be be appended to the string data. data is created if it is not already defined.

◆ SerializeNode()

_.Library.Boolean SerializeNode ( _.Library.String  tree,
_.Library.String  node,
_.Library.Boolean  outputStream,
_.Library.Integer  mixed,
  data,
_.Library.Boolean  includeTop,
_.Library.Boolean  lineMode,
_.Library.String  baseChildlist 
)
static

Serialize the children of this node as text.


tree is the id of the ML document tree.
node is the id of the node to be serialized.
outputStream is true if the serialized output is to be sent to to the existing stream data.
outputStream is false if the serialized output is to be be appended to the string data. data is created if it is not already defined.
mixed is true if child elements should be serialized, else an error is returned if child elements are found.
mixed=1 uses XML translate table. mixed=2 uses HTML translate table.
includeTop is true if the containing element should be included in the returned output.
lineMode is true if the stream output should be written in line oriented mode, else the stream output will be written as a continuous block.