TResult - the type of the result provided by this parserTDocumentDataProvider - the type of the IDocumentDataProviderTElementFactory - the type of the IElementFactory @author Xyanid on 24.10.2015.public abstract class SAXParser<TResult,TDocumentDataProvider extends IDocumentDataProvider,TElementFactory extends IElementFactory<TDocumentDataProvider,TElement>,TElement extends ElementBase<?,?,TDocumentDataProvider,?,TElement>> extends org.xml.sax.helpers.DefaultHandler implements EntityResolver
| Type | Property and Description |
|---|---|
javafx.beans.property.ReadOnlyProperty<SAXParser.State> |
state
Gets the property State.
|
| Modifier and Type | Class and Description |
|---|---|
static class |
SAXParser.State
Determines in which state the converter is in.
|
| Constructor and Description |
|---|
SAXParser(TElementFactory elementFactory,
TDocumentDataProvider documentDataProvider)
Creates a new instance of the parser using the provided interfaces.
|
| Modifier and Type | Method and Description |
|---|---|
void |
characters(char[] ch,
int start,
int length) |
void |
clear()
This method will clear the current
result as well as calling IDocumentDataProvider.clear(). |
protected abstract void |
configureReader(XMLReader reader)
Allows to configure the reader that will be used to parse the file.
|
void |
endDocument() |
void |
endElement(String namespaceURI,
String localName,
String qName) |
protected abstract void |
enteringDocument()
This method will be called as soon as the parsing of the document has started.
|
long |
getAttemptedParses()
gets the
attemptedParses. |
TResult |
getResult()
Gets the
result, which is only set after parse(InputSource) has been called. |
SAXParser.State |
getState()
Gets the value of the State.
|
long |
getSuccessfulParses()
gets the
successfulParses. |
boolean |
isBusy()
Determines if the parser is busy doing its work, this is the case if the state is not IDLE or FINISHED.
|
protected abstract TResult |
leavingDocument(TElement element)
This method will be called as soon as the parsing of the document has been finished.
|
void |
parse(File file)
Parses the data of the given file.
|
void |
parse(InputSource data)
Parse the data of the given input source.
|
void |
parse(String path)
Parses the data of the file provided by the given path.
|
InputSource |
resolveEntity(String publicId,
String systemId) |
void |
startDocument() |
void |
startElement(String namespaceURI,
String localName,
String qName,
Attributes attributes) |
javafx.beans.property.ReadOnlyProperty<SAXParser.State> |
stateProperty()
Gets the property State.
|
endPrefixMapping, error, fatalError, ignorableWhitespace, notationDecl, processingInstruction, setDocumentLocator, skippedEntity, startPrefixMapping, unparsedEntityDecl, warningpublic final javafx.beans.property.ReadOnlyProperty<SAXParser.State> stateProperty
public SAXParser(TElementFactory elementFactory, TDocumentDataProvider documentDataProvider) throws IllegalArgumentException
elementFactory - element creator to be useddocumentDataProvider - data provider to be usedIllegalArgumentException - if either elementFactory or documentDataProvider are nullpublic final TResult getResult()
result, which is only set after parse(InputSource) has been called.resultpublic final long getAttemptedParses()
attemptedParses.attemptedParsespublic final long getSuccessfulParses()
successfulParses.successfulParsespublic final SAXParser.State getState()
public final boolean isBusy()
public final javafx.beans.property.ReadOnlyProperty<SAXParser.State> stateProperty()
protected abstract void configureReader(XMLReader reader) throws SAXException
reader - the XMLReader that is being used.SAXException - when an error occurs during the configuration.protected abstract void enteringDocument()
throws SAXException
SAXException - when an error occursprotected abstract TResult leavingDocument(TElement element) throws SAXException
element - the element that is the first element in the structure of the file.enteringDocument().SAXException - when an error occurs.public final void clear()
result as well as calling IDocumentDataProvider.clear().public final void parse(String path) throws SAXParseException, IllegalArgumentException, IllegalStateException, IOException
path - path of the file to be usedSAXParseException - if an exception occurs while parsing the dataIllegalArgumentException - if the given file is nullIllegalStateException - if this method is being called while the parser is still busyIOException - if the file can not be found or openedpublic final void parse(File file) throws SAXParseException, IllegalArgumentException, IllegalStateException, IOException
file - file to be usedSAXParseException - if an exception occurs while parsing the dataIllegalArgumentException - if the given file is nullIllegalStateException - if this method is being called while the parser is still busyIOException - if the file can not be found or openedpublic final void parse(InputSource data) throws SAXParseException, IllegalArgumentException, IllegalStateException
data - data to be used, must not be nullSAXParseException - if an exception occurs while parsing the dataIllegalArgumentException - if the given data is nullIllegalStateException - if this method is being called while the parser is still busypublic final void startDocument()
throws SAXException
startDocument in interface ContentHandlerstartDocument in class org.xml.sax.helpers.DefaultHandlerSAXExceptionpublic final void endDocument()
throws SAXException
endDocument in interface ContentHandlerendDocument in class org.xml.sax.helpers.DefaultHandlerSAXExceptionpublic final void startElement(String namespaceURI, String localName, String qName, Attributes attributes) throws SAXException
startElement in interface ContentHandlerstartElement in class org.xml.sax.helpers.DefaultHandlerSAXExceptionpublic final void endElement(String namespaceURI, String localName, String qName) throws SAXException
endElement in interface ContentHandlerendElement in class org.xml.sax.helpers.DefaultHandlerSAXExceptionpublic final void characters(char[] ch,
int start,
int length)
throws SAXException
characters in interface ContentHandlercharacters in class org.xml.sax.helpers.DefaultHandlerSAXExceptionpublic InputSource resolveEntity(String publicId, String systemId) throws SAXException, IOException
resolveEntity in interface EntityResolverresolveEntity in class org.xml.sax.helpers.DefaultHandlerSAXExceptionIOExceptionCopyright © 2017 Saxonia Systems AG. All rights reserved.