XMLFilterImpl that does indentation to SAX events.
| Modifier and Type | Field and Description |
|---|---|
| private int | |
| private String | |
| private LexicalHandler | |
| private static final char[] | |
| private static final Object | |
| private static final Object | |
| private static final Object | |
| private Object | |
| private Stack |
| Access | Constructor and Description |
|---|---|
| public | |
| public | |
| public |
| Modifier and Type | Method and Description |
|---|---|
| public void | characters(char[]
The characters to write. ch, int The starting position in the array. start, int The number of characters to use. length)Overrides org. Implements org. Write a sequence of characters. |
| public void | comment(char[] ch, int start, int length)
Implements org. Report an XML comment anywhere in the document. |
| private void | |
| public void | |
| public void | |
| public void | endElement(String
The element's Namespace URI. uri, String The element's local name. localName, String The element's qualified (prefixed) name. qName)Overrides org. Implements org. Write an end tag. |
| public void | endEntity(String name)
Implements org. Report the end of an entity. |
| public int | Returns: The number of spaces in each indentation step, or 0 or less for no indentation.
Deprecated
Only return the length of the indent string.
Return the current indent step. |
| public LexicalHandler | |
| public void | setIndentStep(int
The new indent step (0 or less for no
indentation). indentStep)
Deprecated
Should use the version that takes string.
Set the current indent step. |
| public void | |
| public void | |
| public void | startCDATA()
Implements org. Report the start of a CDATA section. |
| public void | startDTD(String name, String publicId, String systemId)
Implements org. Report the start of DTD declarations, if any. |
| public void | startElement(String
The element's Namespace URI. uri, String The element's local name. localName, String The element's qualified (prefixed) name. qName, Attributes The element's attribute list. atts)Overrides org. Implements org. Write a start tag. |
| public void | startEntity(String name)
Implements org. Report the beginning of some internal and external XML entities. |
| private void |
| depth | back to summary |
|---|---|
| private int depth | |
| indentStep | back to summary |
|---|---|
| private String indentStep | |
| lexical | back to summary |
|---|---|
| private LexicalHandler lexical | |
| NEWLINE | back to summary |
|---|---|
| private static final char[] NEWLINE | |
| SEEN_DATA | back to summary |
|---|---|
| private static final Object SEEN_DATA | |
| SEEN_ELEMENT | back to summary |
|---|---|
| private static final Object SEEN_ELEMENT | |
| SEEN_NOTHING | back to summary |
|---|---|
| private static final Object SEEN_NOTHING | |
| state | back to summary |
|---|---|
| private Object state | |
| stateStack | back to summary |
|---|---|
| private Stack<Object> stateStack | |
| IndentingXMLFilter | back to summary |
|---|---|
| public IndentingXMLFilter() | |
| IndentingXMLFilter | back to summary |
|---|---|
| public IndentingXMLFilter(ContentHandler handler) | |
| IndentingXMLFilter | back to summary |
|---|---|
| public IndentingXMLFilter(ContentHandler handler, LexicalHandler lexical) | |
| characters | back to summary |
|---|---|
| public void characters(char[] ch, int start, int length) throws SAXException Overrides org. Implements org. Write a sequence of characters.
| |
| comment | back to summary |
|---|---|
| public void comment(char[] ch, int start, int length) throws SAXException Implements org. Doc from org. Report an XML comment anywhere in the document. This callback will be used for comments inside or outside the document element, including comments in the external DTD subset (if read). Comments in the DTD must be properly nested inside start/endDTD and start/endEntity events (if used).
| |
| doIndent | back to summary |
|---|---|
| private void doIndent() throws SAXException Print indentation for the current level.
| |
| endCDATA | back to summary |
|---|---|
| public void endCDATA() throws SAXException Implements org. Doc from org. Report the end of a CDATA section.
| |
| endDTD | back to summary |
|---|---|
| public void endDTD() throws SAXException Implements org. Doc from org. Report the end of DTD declarations. This method is intended to report the end of the DOCTYPE declaration; if the document has no DOCTYPE declaration, this method will not be invoked.
| |
| endElement | back to summary |
|---|---|
| public void endElement(String uri, String localName, String qName) throws SAXException Overrides org. Implements org. Write an end tag. If the element has contained other elements, the tag will appear indented on a new line; otherwise, it will appear immediately following whatever came before. The newline and indentation will be passed on down the filter chain through regular characters events.
| |
| endEntity | back to summary |
|---|---|
| public void endEntity(String name) throws SAXException Implements org. Doc from org. Report the end of an entity.
| |
| getIndentStep | back to summary |
|---|---|
| public int getIndentStep()
Deprecated Only return the length of the indent string. Return the current indent step. Return the current indent step: each start tag will be indented by this number of spaces times the number of ancestors that the element has.
| |
| getLexicalHandler | back to summary |
|---|---|
| public LexicalHandler getLexicalHandler() | |
| setIndentStep | back to summary |
|---|---|
| public void setIndentStep(int indentStep)
Deprecated Should use the version that takes string. Set the current indent step.
| |
| setIndentStep | back to summary |
|---|---|
| public void setIndentStep(String s) | |
| setLexicalHandler | back to summary |
|---|---|
| public void setLexicalHandler(LexicalHandler lexical) | |
| startCDATA | back to summary |
|---|---|
| public void startCDATA() throws SAXException Implements org. Doc from org. Report the start of a CDATA section. The contents of the CDATA section will be reported through
the regular
| |
| startDTD | back to summary |
|---|---|
| public void startDTD(String name, String publicId, String systemId) throws SAXException Implements org. Doc from org. Report the start of DTD declarations, if any. This method is intended to report the beginning of the DOCTYPE declaration; if the document has no DOCTYPE declaration, this method will not be invoked. All declarations reported through
Note that the start/endDTD events will appear within
the start/endDocument events from ContentHandler and
before the first
| |
| startElement | back to summary |
|---|---|
| public void startElement(String uri, String localName, String qName, Attributes atts) throws SAXException Overrides org. Implements org. Write a start tag. Each tag will begin on a new line, and will be indented by the current indent step times the number of ancestors that the element has. The newline and indentation will be passed on down the filter chain through regular characters events.
| |
| startEntity | back to summary |
|---|---|
| public void startEntity(String name) throws SAXException Implements org. Doc from org. Report the beginning of some internal and external XML entities. The reporting of parameter entities (including
the external DTD subset) is optional, and SAX2 drivers that
report LexicalHandler events may not implement it; you can use the
General entities are reported with their regular names, parameter entities have '%' prepended to their names, and the external DTD subset has the pseudo-entity name "[dtd]". When a SAX2 driver is providing these events, all other
events must be properly nested within start/end entity
events. There is no additional requirement that events from
Note that skipped entities will be reported through the
Because of the streaming event model that SAX uses, some entity boundaries cannot be reported under any circumstances:
These will be silently expanded, with no indication of where the original entity boundaries were. Note also that the boundaries of character references (which are not really entities anyway) are not reported. All start/endEntity events must be properly nested.
| |
| writeNewLine | back to summary |
|---|---|
| private void writeNewLine() throws SAXException | |