IPM
XMLCommentHandler Class Reference

Use: Extracts XML comments from a document and allows them to be added back in later, assuming that the XPath paths to their previous locations are still valid. More...

Inheritance diagram for XMLCommentHandler:
Inheritance graph

Public Member Functions

_.Library.String GetPosition ()
 Returns current position in the XML document, as an XPath expression with information on the next non-comment node.
 
 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...
 
 endElement (_.Library.String uri, _.Library.String localname, _.Library.String qname)
 Receive notification of the end of an element. 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...
 

Private Attributes

 __Content
 ..Content = <number of comment/whitespace items extracted from document> More...
 
 __ContentMap
 ..ContentMap(i) = <XPath expression for location of ..Content(i)> More...
 
 __LastNodeType
 Last node type (document, element, comment) More...
 
 __Path
 ..Path = <depth of current path in document> More...
 
 __PathCounts
 If no attributes are available to identify an element, then occurrences of element paths are counted and used instead (stored here) More...
 
 __ReplacePaths
 In case a duplicate path is found later in processing, this is used to track what the replacement should be. More...
 
 __UnmappedContent
 Content (comments/whitespace) that have been found but not yet mapped to their appropriate position in the document. More...
 

Detailed Description

Use: Extracts XML comments from a document and allows them to be added back in later, assuming that the XPath paths to their previous locations are still valid.

Member Function Documentation

◆ characters()

characters ( _.Library.String  chars,
_.Library.Integer  length 
)

Receive notification of character data inside an element.

<p>
By default, do nothing.  Application writers may override this
method to take specific actions for each chunk of character data
(such as adding the data to a node or buffer, or printing it to
a file).
</P>
<p>
<ul>
<li>chars: The characters.</li>
<li>length: The number of characters to use from the character
array.</li>
</ul>

◆ comment()

comment ( _.Library.String  chars,
_.Library.Integer  length 
)

Receive notification of comments.

<p>The Parser will call this method to report each occurence of
a comment in the XML document.</p>

<p>The application must not attempt to read from the array
outside of the specified range.</p>
<ul>
<li>chars: The characters from the XML document.</li>
<li>length: The number of characters to read from the array.</li>
</ul>
<p>
Exceptions thrown: SAXException - Any SAX exception, possibly
wrapping another exception.</p>

◆ endElement()

endElement ( _.Library.String  uri,
_.Library.String  localname,
_.Library.String  qname 
)

Receive notification of the end of an element.

<p>
By default, do nothing.  Application writers may override this
method in a subclass to take specific actions at the end of
each element (such as finalising a tree node or writing
output to a file).
</p>

<p>
<ul>
<li>uri: The URI of the associated namespace for this element</li>
<li>localname: The local part of the element name</li>
<li>qname: The QName of this element</li>
</ul>
</p>

◆ startDocument()

startDocument ( )

Receive notification of the beginning of the document.

<p>
By default, do nothing.  Application writers may override this
method in a subclass to take specific actions at the beginning
of a document (such as allocating the root node of a tree or 
creating an output file)
<p>

◆ startElement()

startElement ( _.Library.String  uri,
_.Library.String  localname,
_.Library.String  qname,
_.Library.List  attrs 
)

Receive notification of the start of an element.

<p>
By default, do nothing.  Application writers may override this
method in a subclass to take specific actions at the start of
each element (such as allocating a new tree node or writin
output to a file).
</p>
<p>
<ul>
<li>uri: The URI of the associated namespace for this element</li>
<li>localname: the local part of the element name</li>
<li>qname: the QName of this element</li>
<li>attrs: a list in $List format consisting of a repeating group of attributes.</li>
</ul>
<p>
The format of the repeating group is as follows:
<ul>
<li>+0 - uri: The URI of the associated namespace for this attribute</li>
<li>+1 - localname: The local part of the name of this attribute</li>
<li>+2 - qname: The QName of this attribute</li>
<li>+3 - type: The type of this attribute ("CDATA", NMTOKEN", "ENTITY", etc.)</li>
<li>+4 - value: The value of this attribute</li>
</ul>
</p>

Member Data Documentation

◆ __Content

__Content
private

..Content = <number of comment/whitespace items extracted from document>

..Content(i) = $lb((comment|characters),<text>)  

◆ __ContentMap

__ContentMap
private

..ContentMap(i) = <XPath expression for location of ..Content(i)>

 

◆ __LastNodeType

__LastNodeType
private

Last node type (document, element, comment)

 

◆ __Path

__Path
private

..Path = <depth of current path in document>

..Path(i) = $ListBuild(<containing element descriptor>,<previous element descriptor>,<previous padding characters>)  

◆ __PathCounts

__PathCounts
private

If no attributes are available to identify an element, then occurrences of element paths are counted and used instead (stored here)

..PathCount($zcrc(<path>,7)) = <count>  

◆ __ReplacePaths

__ReplacePaths
private

In case a duplicate path is found later in processing, this is used to track what the replacement should be.

..ReplacePaths($zcrc(<original path>,7)) = <path to really use>  

◆ __UnmappedContent

__UnmappedContent
private

Content (comments/whitespace) that have been found but not yet mapped to their appropriate position in the document.