Package javanet.staxutils
Class StAXStreamContentHandler
- java.lang.Object
-
- org.xml.sax.helpers.DefaultHandler
-
- javanet.staxutils.StAXContentHandler
-
- javanet.staxutils.StAXStreamContentHandler
-
- All Implemented Interfaces:
ContentHandler,DTDHandler,EntityResolver,ErrorHandler,LexicalHandler
public class StAXStreamContentHandler extends StAXContentHandler
SAX ContentHandler that writes events to a StAXXMLStreamWriter.- Version:
- $Revision: 1.5 $
- Author:
- Christian Niles
-
-
Field Summary
-
Fields inherited from class javanet.staxutils.StAXContentHandler
CDATABuffer, docLocator, isCDATA, namespaces, reporter
-
-
Constructor Summary
Constructors Constructor Description StAXStreamContentHandler()StAXStreamContentHandler(XMLStreamWriter writer)Constructs an instance that writes SAX events to the specified StAX stream.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidcharacters(char[] ch, int start, int length)voidcomment(char[] ch, int start, int length)voidendCDATA()voidendDocument()voidendElement(String uri, String localName, String qName)XMLStreamWritergetStreamWriter()Returns a reference to theXMLStreamWriterto which SAX events are written.voidignorableWhitespace(char[] ch, int start, int length)voidprocessingInstruction(String target, String data)voidsetStreamWriter(XMLStreamWriter writer)Sets theXMLStreamWriterto which SAX events will be written.voidstartDocument()voidstartElement(String uri, String localName, String qName, Attributes attributes)-
Methods inherited from class javanet.staxutils.StAXContentHandler
endDTD, endEntity, endPrefixMapping, error, fatalError, getCurrentLocation, parseQName, reportException, setDocumentLocator, setXMLReporter, startCDATA, startDTD, startEntity, startPrefixMapping, warning
-
Methods inherited from class org.xml.sax.helpers.DefaultHandler
notationDecl, resolveEntity, skippedEntity, unparsedEntityDecl
-
-
-
-
Constructor Detail
-
StAXStreamContentHandler
public StAXStreamContentHandler()
-
StAXStreamContentHandler
public StAXStreamContentHandler(XMLStreamWriter writer)
Constructs an instance that writes SAX events to the specified StAX stream.- Parameters:
writer- The StAX stream to which events will be written.
-
-
Method Detail
-
getStreamWriter
public XMLStreamWriter getStreamWriter()
Returns a reference to theXMLStreamWriterto which SAX events are written.- Returns:
- The
XMLStreamWriterto which SAX events are written.
-
setStreamWriter
public void setStreamWriter(XMLStreamWriter writer)
Sets theXMLStreamWriterto which SAX events will be written.- Parameters:
writer- TheXMLStreamWriterto which SAX events will be written.
-
startDocument
public void startDocument() throws SAXException- Specified by:
startDocumentin interfaceContentHandler- Overrides:
startDocumentin classStAXContentHandler- Throws:
SAXException
-
endDocument
public void endDocument() throws SAXException- Specified by:
endDocumentin interfaceContentHandler- Overrides:
endDocumentin classStAXContentHandler- Throws:
SAXException
-
startElement
public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException
- Specified by:
startElementin interfaceContentHandler- Overrides:
startElementin classStAXContentHandler- Throws:
SAXException
-
endElement
public void endElement(String uri, String localName, String qName) throws SAXException
- Specified by:
endElementin interfaceContentHandler- Overrides:
endElementin classStAXContentHandler- Throws:
SAXException
-
comment
public void comment(char[] ch, int start, int length) throws SAXException- Specified by:
commentin interfaceLexicalHandler- Overrides:
commentin classStAXContentHandler- Throws:
SAXException
-
characters
public void characters(char[] ch, int start, int length) throws SAXException- Specified by:
charactersin interfaceContentHandler- Overrides:
charactersin classStAXContentHandler- Throws:
SAXException
-
endCDATA
public void endCDATA() throws SAXException- Specified by:
endCDATAin interfaceLexicalHandler- Overrides:
endCDATAin classStAXContentHandler- Throws:
SAXException
-
ignorableWhitespace
public void ignorableWhitespace(char[] ch, int start, int length) throws SAXException- Specified by:
ignorableWhitespacein interfaceContentHandler- Overrides:
ignorableWhitespacein classDefaultHandler- Throws:
SAXException
-
processingInstruction
public void processingInstruction(String target, String data) throws SAXException
- Specified by:
processingInstructionin interfaceContentHandler- Overrides:
processingInstructionin classDefaultHandler- Throws:
SAXException
-
-