The following table summarises the differences between the StreamedSource, StAX and SAX interfaces. Note that some of the available features are documented as optional and may not be supported by all implementations of StAX and SAX.
| Feature | StreamedSource | StAX | SAX |
|---|---|---|---|
| Parse XML | ● | ● | ● |
| Parse entities without DTD | ● | ||
| Automatically validate XML | ● | ● | |
| Parse HTML | ● | ||
| Tolerant of syntax or nesting errors | ● | ||
| Provide begin and end character positions of each event1 | ● | ○ | |
| Provide source text of each event | ● | ||
| Handle {@linkplain TagType#isServerTag() server tag} events | ● | ||
| Handle {@linkplain StartTagType#XML_DECLARATION XML declaration} event | ● | ||
| Handle {@linkplain StartTagType#COMMENT comment} events | ● | ● | ● |
| Handle {@linkplain StartTagType#CDATA_SECTION CDATA section} events | ● | ● | ● |
| Handle {@linkplain StartTagType#DOCTYPE_DECLARATION document type declaration} event | ● | ● | ● |
| Handle {@linkplain CharacterReference character reference} events | ● | ||
| Allow chunking of plain text | ● | ● | ● |
| Allow chunking of comment text | |||
| Allow chunking of CDATA section text | ● | ||
| Allow specification of maximum buffer size | ● |
Note that the {@link OutputDocument} class can not be used to create a modified version of a streamed source document.Instead, the output document must be constructed manually from the segments provided by the {@link #iterator() iterator}.
StreamedSource objects are not thread safe.
| |
| |
| |