Package javanet.staxutils
Class StAXEventContentHandler
java.lang.Object
org.xml.sax.helpers.DefaultHandler
javanet.staxutils.StAXContentHandler
javanet.staxutils.StAXEventContentHandler
- All Implemented Interfaces:
ContentHandler,DTDHandler,EntityResolver,ErrorHandler,LexicalHandler
SAX ContentHandler that writes events to a StAX
XMLEventConsumer.- Version:
- $Revision: 1.5 $
- Author:
- Christian Niles
-
Field Summary
Fields inherited from class javanet.staxutils.StAXContentHandler
CDATABuffer, docLocator, isCDATA, namespaces, reporter -
Constructor Summary
ConstructorsConstructorDescriptionConstructs a default instance with a default event factory.StAXEventContentHandler(XMLEventConsumer consumer) Constructs an instance that writes events to the provided XMLEventConsumer.StAXEventContentHandler(XMLEventConsumer consumer, XMLEventFactory factory) Constructs an instance that writes events constructed with the provided XMLEventFactory to the provided XMLEventConsumer -
Method Summary
Modifier and TypeMethodDescriptionvoidcharacters(char[] ch, int start, int length) voidcomment(char[] ch, int start, int length) protected NamespacecreateNamespace(String prefix, String uri) protected voidcreateStartEvents(Attributes attributes, Collection[] events) voidendCDATA()voidvoidendElement(String uri, String localName, String qName) Returns a reference to theXMLEventConsumerto which events will be written.Returns a reference to theXMLEventFactoryused to construct events.voidignorableWhitespace(char[] ch, int start, int length) voidprocessingInstruction(String target, String data) voidsetEventConsumer(XMLEventConsumer consumer) Sets theXMLEventConsumerto which events are written.voidsetEventFactory(XMLEventFactory factory) Sets theXMLEventFactoryused to create events.voidvoidstartElement(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, warningMethods inherited from class org.xml.sax.helpers.DefaultHandler
notationDecl, resolveEntity, skippedEntity, unparsedEntityDecl
-
Constructor Details
-
StAXEventContentHandler
public StAXEventContentHandler()Constructs a default instance with a default event factory. You must set theXMLEventConsumervia thesetEventConsumer(XMLEventConsumer)method. -
StAXEventContentHandler
Constructs an instance that writes events to the provided XMLEventConsumer. Events will be constructed from a default XMLEventFactory instance.- Parameters:
consumer- TheXMLEventConsumerto which events will be written.
-
StAXEventContentHandler
Constructs an instance that writes events constructed with the provided XMLEventFactory to the provided XMLEventConsumer- Parameters:
consumer- TheXMLEventConsumerto which events will be written.factory- TheXMLEventFactoryused to construct events. Ifnull, a default instance will be constructed.
-
-
Method Details
-
getEventConsumer
Returns a reference to theXMLEventConsumerto which events will be written.- Returns:
- The
XMLEventConsumerto which events will be written.
-
setEventConsumer
Sets theXMLEventConsumerto which events are written.- Parameters:
consumer- TheXMLEventConsumerto which events will be written.
-
getEventFactory
Returns a reference to theXMLEventFactoryused to construct events.- Returns:
- The
XMLEventFactoryused to construct events.
-
setEventFactory
Sets theXMLEventFactoryused to create events.- Parameters:
factory- TheXMLEventFactoryused to create events.
-
startDocument
- Specified by:
startDocumentin interfaceContentHandler- Overrides:
startDocumentin classStAXContentHandler- Throws:
SAXException
-
endDocument
- 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
- Specified by:
endElementin interfaceContentHandler- Overrides:
endElementin classStAXContentHandler- Throws:
SAXException
-
comment
- Specified by:
commentin interfaceLexicalHandler- Overrides:
commentin classStAXContentHandler- Throws:
SAXException
-
characters
- Specified by:
charactersin interfaceContentHandler- Overrides:
charactersin classStAXContentHandler- Throws:
SAXException
-
ignorableWhitespace
- Specified by:
ignorableWhitespacein interfaceContentHandler- Overrides:
ignorableWhitespacein classDefaultHandler- Throws:
SAXException
-
processingInstruction
- Specified by:
processingInstructionin interfaceContentHandler- Overrides:
processingInstructionin classDefaultHandler- Throws:
SAXException
-
endCDATA
- Specified by:
endCDATAin interfaceLexicalHandler- Overrides:
endCDATAin classStAXContentHandler- Throws:
SAXException
-
createStartEvents
-
createNamespace
-