public final class NormalizationChecker extends Checker
Checks that the following constructs are in the Unicode Normalization Form C. (It is assumed the normalization of the rest of the constructs is enforced by other means, such as checking the document source for normalization.)
All String
s must be valid UTF-16!
This class can also be used as a source code mode where the source
code of the document is fed to characters()
. The mode
modifies the error messages appropriately.
Constructor and Description |
---|
NormalizationChecker()
Constructor for non-source mode.
|
NormalizationChecker(boolean sourceTextMode)
Constructor with mode selection.
|
Modifier and Type | Method and Description |
---|---|
void |
characters(char[] ch,
int start,
int length)
In the normal mode, this method has the usual SAX semantics.
|
void |
endElement(java.lang.String uri,
java.lang.String localName,
java.lang.String qName) |
void |
flush()
Called to indicate the end of a run of characters.
|
void |
processingInstruction(java.lang.String target,
java.lang.String data) |
void |
reset()
Does nothing.
|
void |
startElement(java.lang.String uri,
java.lang.String localName,
java.lang.String qName,
org.xml.sax.Attributes atts) |
void |
startPrefixMapping(java.lang.String prefix,
java.lang.String uri) |
static boolean |
startsWithComposingChar(java.lang.String str)
Returns
true if the argument starts with a composing
character and false otherwise. |
endDocument, endPrefixMapping, err, err, getDocumentLocator, getErrorHandler, ignorableWhitespace, setDocumentLocator, setErrorHandler, skippedEntity, startDocument, warn, warn
public NormalizationChecker()
public NormalizationChecker(boolean sourceTextMode)
sourceTextMode
- whether the source text-related messages
should be enabled.public static boolean startsWithComposingChar(java.lang.String str) throws org.xml.sax.SAXException
true
if the argument starts with a composing
character and false
otherwise.str
- a stringtrue
if the argument starts with a composing
character and false
otherwise.org.xml.sax.SAXException
- on malformed UTF-16public void reset()
Checker
reset
in class Checker
Checker.reset()
public void characters(char[] ch, int start, int length) throws org.xml.sax.SAXException
characters
in interface org.xml.sax.ContentHandler
characters
in class Checker
org.xml.sax.SAXException
Checker.characters(char[], int, int)
public void endElement(java.lang.String uri, java.lang.String localName, java.lang.String qName) throws org.xml.sax.SAXException
endElement
in interface org.xml.sax.ContentHandler
endElement
in class Checker
org.xml.sax.SAXException
Checker.endElement(java.lang.String,
java.lang.String, java.lang.String)
public void processingInstruction(java.lang.String target, java.lang.String data) throws org.xml.sax.SAXException
processingInstruction
in interface org.xml.sax.ContentHandler
processingInstruction
in class Checker
org.xml.sax.SAXException
Checker.processingInstruction(java.lang.String,
java.lang.String)
public void startElement(java.lang.String uri, java.lang.String localName, java.lang.String qName, org.xml.sax.Attributes atts) throws org.xml.sax.SAXException
startElement
in interface org.xml.sax.ContentHandler
startElement
in class Checker
org.xml.sax.SAXException
Checker.startElement(java.lang.String,
java.lang.String, java.lang.String, org.xml.sax.Attributes)
public void startPrefixMapping(java.lang.String prefix, java.lang.String uri) throws org.xml.sax.SAXException
startPrefixMapping
in interface org.xml.sax.ContentHandler
startPrefixMapping
in class Checker
org.xml.sax.SAXException
Checker.startPrefixMapping(java.lang.String, java.lang.String)
public void flush() throws org.xml.sax.SAXException
characters()
.org.xml.sax.SAXException
- if the ErrorHandler
throws.