During the SAX parse of your XML document, several XML events will be passed to your XML-SAX handling procedure. To identify the events within your procedure, use the special names starting with *XML, for example *XML_START_ELEMENT.
For most events, the handling procedure will be passed a value associated with the event. For example, for the *XML_START_ELEMENT event, the value is the name of the XML element.
| Event | Value |
|---|---|
| 1. Events discovered before the first XML element | |
| *XML_START_DOCUMENT | Indicates that parsing has begun |
| *XML_VERSION_INFO | The "version" value from the XML declaration |
| *XML_ENCODING_DECL | The "encoding" value from the XML declaration |
| *XML_STANDALONE_DECL | The "standalone" value from the XML declaration |
| *XML_DOCTYPE_DECL | The value of the Document Type Declaration |
| 2. Events related to XML elements | |
| *XML_START_ELEMENT | The name of the XML element that is starting |
| *XML_CHARS | The value of the XML element |
| *XML_PREDEF_REF | The value of a predefined reference |
| *XML_UCS2_REF | The value of a UCS-2 reference |
| *XML_UNKNOWN_REF | The name of an unknown entity reference |
| *XML_END_ELEMENT | The name of the XML element that is ending |
| 3. Events related to XML attributes | |
| *XML_ATTR_NAME | The name of the attribute |
| *XML_ATTR_CHARS | The value of the attribute |
| *XML_ATTR_PREDEF_REF | The value of a predefined reference |
| *XML_ATTR_UCS2_REF | The value of a UCS-2 reference |
| *XML_UNKNOWN_ATTR_REF | The name of an unknown entity reference |
| *XML_END_ATTR | Indicates the end of the attribute |
| 4. Events related to XML processing instructions | |
| *XML_PI_TARGET | The name of the target |
| *XML_PI_DATA | The value of the data |
| 5. Events related to XML CDATA sections | |
| *XML_START_CDATA | The beginning of the CDATA section |
| *XML_CHARS | The value of the CDATA section |
| *XML_END_CDATA | The end of the CDATA section |
| 6. Other events | |
| *XML_COMMENT | The value of the XML comment |
| *XML_EXCEPTION | Indicates that the parser discovered an error |
| *XML_END_DOCUMENT | Indicates that parsing has ended |
This sample XML document is referred to in the descriptions of the XML events.
<?xml version="1.0" encoding="ibm-1140" standalone="yes" ?>
<!DOCTYPE page [
<!ENTITY abc "ABC Inc">
]>
<!-- This document is just an example -->
<sandwich>
<bread type="baker’s best" supplier="&abc;" />
<?spread please use real mayonnaise ?>
<spices attr="+">Salt & pepper</spices>
<filling>Cheese, lettuce,
tomato, = &xyz;
</filling>
<![CDATA[We should add a <relish> element in future!]]>
</sandwich>junkNote: This is the only event where the XML text includes the delimiters.
The value of the string parameter is the entire DOCTYPE value, including the opening and closing character sequences.
'<!DOCTYPE page [LF <!ENTITY abc "ABC Inc">LF]>'(LF represents the LINE FEED character.)
* x'15'=newline x'05'=tab x'0D'=carriage-return
* x'25'=linefeed x'40'=blank
D whitespaceChr C x'15050D2540'
/free
temp = %trim(value : whitespaceChr);| & | & |
| ' | ' |
| > | < |
| < | > |
| " | " |
| & | & |
| ' | ' |
| > | < |
| < | > |
| " | " |
Note: This parameter is a UCS-2 character (type C) even if the parsing is being done in single-byte character.
'<![CDATA['