Package eu.bandm.tools.util.xml
Class SaxAuthor
java.lang.Object
eu.bandm.tools.util.xml.SaxAuthor
Facade for conveniently creating sequences of SAX events, more likely
to be well-formed.
For this, a stack is maintained of the currently open elements, and closing tags are checked for the correct sequence.
-
Field Summary
Modifier and TypeFieldDescriptionstatic final Attributes
evidentprotected ContentHandler
Target of the generated Sax events.Protocol of currently open elements. -
Constructor Summary
ConstructorDescriptionSaxAuthor
(ContentHandler sax0) Create a new instance with the given content handler as the target of all generated sax events. -
Method Summary
Modifier and TypeMethodDescriptionvoid
Output a SAX event representing the character data.void
"*CL*ose and re-*OP*en" = close and Close the elements with the given tags, one after the other, and then open them again, backwards.void
CLOSE()
Close the current top-level element = the latest opened element.void
CLOSE
(int i) Close the current top-level n elements = the latest opened n elements.void
Close one element with the given tags, check whether it is really currently open.void
Close the elements with the given tags, one after the other, and check whether they are really currently open.void
Output two SAX event which correspond to an empty element with the given tag- Output one open event immediately folloed by a close.void
Output two SAX events which correspond to an empty element.void
Execute a "start element" sax call on the receiver, with empty attributes, and memoize the element as open.void
Perform a "start element" sax call with the tag and the collected attribute/value pairs as attribute, and memorize the element as open.void
OPEN
(String tag, Attributes atts) Execute a "start element" sax call on the receiver, and memorize the element as open.void
Execute a sequence of "start element" sax calls on the given tag sequence, and memorize all these elements as open.void
Output three SAX event which correspond to a element with plain character data.void
Output three SAX event which correspond to a element with plain character data.void
SPACE()
Output a SAX event representing threw whitespace characters- data.
-
Field Details
-
sax
Target of the generated Sax events. -
stack
Protocol of currently open elements. -
EMPTY_ATTRIBUTES
evident
-
-
Constructor Details
-
SaxAuthor
Create a new instance with the given content handler as the target of all generated sax events.
-
-
Method Details
-
OPEN
Execute a "start element" sax call on the receiver, and memorize the element as open.- Throws:
IllegalStateException
- if a SAXException is encountered
-
OPEN
Execute a "start element" sax call on the receiver, with empty attributes, and memoize the element as open.- Throws:
IllegalStateException
- if a SAXException is encountered
-
OPEN_S
Execute a sequence of "start element" sax calls on the given tag sequence, and memorize all these elements as open.- Throws:
IllegalStateException
- if a SAXException is encountered
-
OPEN
Perform a "start element" sax call with the tag and the collected attribute/value pairs as attribute, and memorize the element as open.- Throws:
IllegalStateException
- if a SAXException is encountered
-
CLOSE_S
Close the elements with the given tags, one after the other, and check whether they are really currently open.- Throws:
IllegalStateException
- if the tag does not match to the current protocol of opened elements, or when a SAXException is encountered during write.
-
CLOP
"*CL*ose and re-*OP*en" = close and Close the elements with the given tags, one after the other, and then open them again, backwards. Check whether they are really currently open.- Throws:
IllegalStateException
- if the tag does not match to the current protocol of opened elements, or when a SAXException is encountered during write.
-
CLOSE
Close one element with the given tags, check whether it is really currently open.- Throws:
IllegalStateException
- if the tag does not match to the current protocol of opened elements, or when a SAXException is encountered during write.
-
CLOSE
public void CLOSE()Close the current top-level element = the latest opened element.- Throws:
IllegalStateException
- if no element is open, or when a SAXException is encountered during write.
-
CLOSE
public void CLOSE(int i) Close the current top-level n elements = the latest opened n elements.- Parameters:
i
- number of elements to close.- Throws:
IllegalStateException
- if not enough elements are open, or when a SAXException is encountered during write.
-
CHARS
Output a SAX event representing the character data.- Throws:
IllegalStateException
- if a SAXException is encountered during write.
-
SPACE
public void SPACE()Output a SAX event representing threw whitespace characters- data.- Throws:
IllegalStateException
- if a SAXException is encountered during write.
-
SIMPLE
Output three SAX event which correspond to a element with plain character data. Output a SAX event starting an element with the given tag, then output the character data, then close the element immediately.- Throws:
IllegalStateException
- if a SAXException is encountered during write.
-
SIMPLE
Output three SAX event which correspond to a element with plain character data. Output a SAX event starting an element with the given tag and the key/value pairs as attributes, then output the character data, then close the element immediately.- Parameters:
text
- the character datapairs
- of attribute names (qnames, if namespace mode) and values- Throws:
IllegalStateException
- if a SAXException is encountered during write.
-
EMPTY
Output two SAX event which correspond to an empty element with the given tag- Output one open event immediately folloed by a close.- Throws:
IllegalStateException
- if a SAXException is encountered during write.
-
EMPTY
Output two SAX events which correspond to an empty element. Output one open event immediately followed by a close, with the given tag and the key/value pairs as attribute values.
-