public class EsisHandler extends Object implements ContentHandler
Constructor and Description |
---|
EsisHandler(EsisWriter writer,
boolean normalize)
Creates a SAX ContentHandler which receives a stream of SAX events
and writes them out in the ESIS format.
|
EsisHandler(OutputStream out,
boolean normalize) |
Modifier and Type | Method and Description |
---|---|
void |
characters(char[] ch,
int start,
int length)
Writes
- on the output, followed by the
character string with \n , \r and
\t escaped. |
void |
endDocument()
Writes nothing on the output.
|
void |
endElement(String uri,
String localName,
String qName)
Indicates the end of an element.
|
void |
endPrefixMapping(String prefix)
Writes
mprefix on the output |
void |
ignorableWhitespace(char[] ch,
int start,
int length)
Displays ignorable whitespace.
|
void |
processingInstruction(String target,
String data)
Writes
?target data on the output. |
void |
setDocumentLocator(Locator locator)
Writes nothing to the output
|
void |
skippedEntity(String name)
Writes
Xname on the output. |
void |
startDocument()
Writes nothing on the output
|
void |
startElement(String uri,
String localName,
String qName,
Attributes atts)
Writes an element-start indicator on the output.
|
void |
startPrefixMapping(String prefix,
String uri)
Writes
Mprefix uri on the output. |
public EsisHandler(EsisWriter writer, boolean normalize) throws IOException
IOException
public EsisHandler(OutputStream out, boolean normalize) throws IOException
IOException
public void setDocumentLocator(Locator locator)
setDocumentLocator
in interface ContentHandler
public void startDocument() throws SAXException
startDocument
in interface ContentHandler
SAXException
public void endDocument() throws SAXException
endDocument
in interface ContentHandler
SAXException
public void startPrefixMapping(String prefix, String uri) throws SAXException
Mprefix uri
on the output.
We don't need to alphabetise these, for the sake of normalisation,
because in the normalised output, we skip these.startPrefixMapping
in interface ContentHandler
SAXException
public void endPrefixMapping(String prefix) throws SAXException
mprefix
on the outputendPrefixMapping
in interface ContentHandler
SAXException
public void startElement(String uri, String localName, String qName, Attributes atts) throws SAXException
If the element is not in a namespace, then write
(
<element-name>, and if it is
[
<namespace-uri> <element-name>.
This is preceded. by the attributes, (unconditionally) normalised into alphabetical order.
startElement
in interface ContentHandler
SAXException
public void endElement(String uri, String localName, String qName) throws SAXException
endElement
in interface ContentHandler
SAXException
startElement(java.lang.String, java.lang.String, java.lang.String, org.xml.sax.Attributes)
public void characters(char[] ch, int start, int length) throws SAXException
-
on the output, followed by the
character string with \n
, \r
and
\t
escaped.characters
in interface ContentHandler
SAXException
public void ignorableWhitespace(char[] ch, int start, int length) throws SAXException
If we are normalizing, then simply discard this. If not,
write =
on the output, followed by the
whitespace with \n
, \r
and
\t
escaped, and any other whitespace characters
indicated by \
unnn
notation.
ignorableWhitespace
in interface ContentHandler
SAXException
public void processingInstruction(String target, String data) throws SAXException
?target data
on the output.
If the target
is "signature", however, then
discard it.processingInstruction
in interface ContentHandler
SAXException
public void skippedEntity(String name) throws SAXException
Xname
on the output.
I confess I don't really understand what would generate this,
but it doesn't matter right now.skippedEntity
in interface ContentHandler
SAXException
Copyright © 2014. All rights reserved.