-
Notifications
You must be signed in to change notification settings - Fork 5
SAXEvent
do- edited this page Nov 21, 2021
·
21 revisions
Instances of this class represent SAX (or StAX) style events.
They encapsulate distinct chunks of source XML text, normally given away by XMLLexer.
const e = new SAXEvent (chunk)
if (e.type === SAXEvent.TYPES.START_ELEMENT && e.isSelfEnclosing)
console.log (e.attributes)| Name, Parameters | Return Value | Description |
|---|---|---|
| get type | SAXEvent.TYPES.* | Lazy getter for the event type |
| get attributes | Map | Lazy getter for the Map of attributes |
| isSelfEnclosing () | Boolean |
true iif the penultimate character is /
|
This list is loosely based on JSR-000173.
| Event Name | Public Variable Name | Description |
|---|---|---|
| StartDocument | SAXEvent.TYPES.START_DOCUMENT |
<?xml ...?>, case insensitive: MAY NOT OCCUR AT ALL (if there is no prolog in the document) |
| ProcessingInstruction | SAXEvent.TYPES.PROCESSING_INSTRUCTION | any other <?...?>
|
| Comment | SAXEvent.TYPES.COMMENT | <!-- ... --> |
| DTD | SAXEvent.TYPES.DTD | <!DOCTYPE ...> |
| StartElement | SAXEvent.TYPES.START_ELEMENT | <not-a-slash ...> |
| Characters | SAXEvent.TYPES.CHARACTERS |
<![CDATA[...]]> contents or text without pointy braces |
| EndElement | SAXEvent.TYPES.END_ELEMENT |
</...>, also emitted after StartElement for a self enclosing tag |
| EndDocument | SAXEvent.TYPES.END_DOCUMENT | Never occurs as SAXEvent.type; is included here to complete the SAXEventEmitter functionality |