The content of XML-EVENT
When
an event occurs during XML parsing, the XML parser writes the appropriate event
name shown below to the XML-EVENT special register. (The event is
passed to your processing procedure, and the text that corresponds to the event
is written to either the XML-TEXT or XML-NTEXT special
register.)
- ATTRIBUTE-CHARACTER
- Occurs in attribute values for the predefined entity references
'&', ''', '>', '<', and '"'. See
XML specification
for details about predefined entities.
- ATTRIBUTE-CHARACTERS
- Occurs for each fragment of an attribute value. XML text contains the
fragment. An attribute value normally consists only of a single string, even
if it is split across lines. The attribute value might consist of multiple
events, however.
- ATTRIBUTE-NAME
- Occurs for each attribute in an element start tag or empty element tag,
after a valid name is recognized. XML text contains the attribute name.
- ATTRIBUTE-NATIONAL-CHARACTER
- Occurs in attribute values for numeric character references (Unicode code
points or “scalar values”) of the form '&#dd..;' or
'&#hh..;', where d and h represent
decimal and hexadecimal digits, respectively. If the scalar value of the
national character is greater than 65,535 (NX'FFFF'), XML-NTEXT
contains two encoding units (a surrogate pair) and has a length of
4 bytes. This pair of encoding units represents a single character. Do not
create characters that are not valid by splitting this pair.
- COMMENT
- Occurs for any comments in the XML document. XML text contains the data
between the opening and closing comment delimiters, '<!--'
and '-->', respectively.
- CONTENT-CHARACTER
- Occurs in element content for the predefined entity references
'&', ''', '>', '<', and '"'. See
XML specification
for details about predefined entities.
- CONTENT-CHARACTERS
- This event represents the principal part of an XML document: the character
data between element start and end tags. XML text contains this data, which
usually consists only of a single string even if it is split across lines.
If the content of an element includes any references or other elements, the
complete content might consist of several events. The parser also uses the CONTENT-CHARACTERS
event to pass the text of CDATA sections to your program.
- CONTENT-NATIONAL-CHARACTER
- Occurs in element content for numeric character references (Unicode code
points or “scalar values”) of the form '&#dd..;' or
'&#hh..;', where d and h represent
decimal and hexadecimal digits, respectively. If the scalar value of the
national character is greater than 65,535 (NX'FFFF'), XML-NTEXT
contains two encoding units (a surrogate pair) and has a length of 4 bytes.
This pair of encoding units represents a single character. Do not create
characters that are not valid by splitting this pair.
- DOCUMENT-TYPE-DECLARATION
- Occurs when the parser finds a document type declaration. Document type
declarations begin with the character sequence '<!DOCTYPE' and end with a
right angle bracket ('>') character; some fairly complicated grammar
rules describe the content in between. See
XML specification for
details. For this event, XML text contains the entire
declaration, including the opening and closing character sequences. This is
the only event for which XML text includes the delimiters.
- ENCODING-DECLARATION
- Occurs within the XML declaration for the optional encoding declaration.
XML text contains the encoding value.
- END-OF-CDATA-SECTION
- Occurs when the parser recognizes the end of a CDATA section.
- END-OF-DOCUMENT
- Occurs when document parsing has completed.
- END-OF-ELEMENT
- Occurs once for each element end tag or empty element tag when the parser
recognizes the closing angle bracket of the tag. XML text contains the
element name.
- EXCEPTION
- Occurs when an error in processing the XML document is detected. For
encoding conflict exceptions, which are signaled before parsing begins, XML-TEXT
(for XML documents in an alphanumeric data item) or XML-NTEXT (for
XML documents in a national data item) either is zero length or contains
only the encoding declaration value from the document.
- PROCESSING-INSTRUCTION-DATA
- Occurs for the data that follows the PI target, up to but not including
the PI closing character sequence, '?>'. XML text contains
the PI data, which includes trailing, but not leading, white-space
characters.
- PROCESSING-INSTRUCTION-TARGET
- Occurs when the parser recognizes the name that follows the opening
character sequence, '<?', of a processing instruction (PI).
PIs allow XML documents to contain special instructions for applications.
- STANDALONE-DECLARATION
- Occurs within the XML declaration for the optional standalone
declaration. XML text contains the standalone value.
- START-OF-CDATA-SECTION
- Occurs at the start of a CDATA section. CDATA sections begin with the
string '<![CDATA[' and end with the string ']]>'. Such sections are
used to “escape” blocks of text that contain characters that would
otherwise be recognized as XML markup. XML text always contains the opening
character sequence '<![CDATA['. The parser passes the content of a CDATA
section between these delimiters as a single CONTENT-CHARACTERS
event.
- START-OF-DOCUMENT
- Occurs once, at the beginning of the parsing of the document. XML text is
the entire document, including any line-control characters such as LF (Line
Feed) or NL (New Line).
- START-OF-ELEMENT
- Occurs once for each element start tag or empty element tag. XML text is
set to the element name.
- UNKNOWN-REFERENCE-IN-ATTRIBUTE
- Occurs within attribute values for entity references other than the five
predefined entity references, as shown for ATTRIBUTE-CHARACTER
above.
- UNKNOWN-REFERENCE-IN-CONTENT
- Occurs within element content for entity references other than the
predefined entity references, as shown for CONTENT-CHARACTER above.
- VERSION-INFORMATION
- Occurs within the optional XML declaration for the version information.
XML text contains the version value. An XML declaration is XML text
that specifies the version of XML that is used and the encoding of the
document.
Example: processing XML events
related concepts
The content of XML-TEXT and XML-NTEXT
related tasks
Parsing XML documents
Writing procedures to process XML
related references
XML-EVENT
(COBOL for Windows Language Reference)
4.6 Predefined entities (XML specification)
|