Package net.ontopia.xml
Class CanonicalPrinter
- java.lang.Object
-
- net.ontopia.xml.CanonicalPrinter
-
- All Implemented Interfaces:
ContentHandler
- Direct Known Subclasses:
CanonicalTopicMapWriter.CanonicalXTMPrinter
public class CanonicalPrinter extends Object implements ContentHandler
INTERNAL: SAX document handler that prints canonical XML. Note that this does not support all of http://www.w3.org/TR/xml-c14n, only what is needed for Canonical XTM.
-
-
Field Summary
Fields Modifier and Type Field Description protected PrintWriter
writer
-
Constructor Summary
Constructors Constructor Description CanonicalPrinter(OutputStream stream, boolean closeWRiter)
Creates a CanonicalPrinter that writes to the given OutputStream.CanonicalPrinter(Writer writer, boolean closeWRiter)
Creates a CanonicalPrinter that writes to the given Writer.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
characters(char[] ch, int start, int length)
void
endDocument()
void
endElement(String uri, String localName, String name)
void
endPrefixMapping(String prefix)
String
escape(String attrval)
void
ignorableWhitespace(char[] ch, int start, int length)
void
processingInstruction(String target, String data)
void
setDocumentLocator(Locator locator)
void
skippedEntity(String name)
void
startDocument()
void
startElement(String uri, String localName, String name, Attributes atts)
void
startPrefixMapping(String prefix, String uri)
-
-
-
Field Detail
-
writer
protected PrintWriter writer
-
-
Constructor Detail
-
CanonicalPrinter
public CanonicalPrinter(OutputStream stream, boolean closeWRiter)
Creates a CanonicalPrinter that writes to the given OutputStream. The encoding used is always utf-8.
-
CanonicalPrinter
public CanonicalPrinter(Writer writer, boolean closeWRiter)
Creates a CanonicalPrinter that writes to the given Writer.
-
-
Method Detail
-
startDocument
public void startDocument()
- Specified by:
startDocument
in interfaceContentHandler
-
startElement
public void startElement(String uri, String localName, String name, Attributes atts)
- Specified by:
startElement
in interfaceContentHandler
-
endElement
public void endElement(String uri, String localName, String name)
- Specified by:
endElement
in interfaceContentHandler
-
characters
public void characters(char[] ch, int start, int length)
- Specified by:
characters
in interfaceContentHandler
-
ignorableWhitespace
public void ignorableWhitespace(char[] ch, int start, int length)
- Specified by:
ignorableWhitespace
in interfaceContentHandler
-
processingInstruction
public void processingInstruction(String target, String data)
- Specified by:
processingInstruction
in interfaceContentHandler
-
endDocument
public void endDocument()
- Specified by:
endDocument
in interfaceContentHandler
-
setDocumentLocator
public void setDocumentLocator(Locator locator)
- Specified by:
setDocumentLocator
in interfaceContentHandler
-
startPrefixMapping
public void startPrefixMapping(String prefix, String uri) throws SAXException
- Specified by:
startPrefixMapping
in interfaceContentHandler
- Throws:
SAXException
-
endPrefixMapping
public void endPrefixMapping(String prefix) throws SAXException
- Specified by:
endPrefixMapping
in interfaceContentHandler
- Throws:
SAXException
-
skippedEntity
public void skippedEntity(String name) throws SAXException
- Specified by:
skippedEntity
in interfaceContentHandler
- Throws:
SAXException
-
-