Class XMLReadHandlerImpl
- java.lang.Object
-
- de.uni_trier.wi2.procake.utils.composition.FactoryObjectImplementation
-
- de.uni_trier.wi2.procake.data.io.IOImpl
-
- de.uni_trier.wi2.procake.data.io.xml.xerces_saxImpl.XMLReadHandlerImpl
-
- All Implemented Interfaces:
ContentHandler,IO,ContentHandler
- Direct Known Subclasses:
AdaptationConfigHandler,DependencyHandler,ModelHandler,NESTGraphHandler,ObjectHandler,ObjectPoolHandler,SimilarityModelHandler,TrainingPoolHandler,TransformationConfigHandler,WorkflowHandler
public abstract class XMLReadHandlerImpl extends IOImpl implements ContentHandler
Base-class for all XML-handler-implementations.- Author:
- Alexander Stromer
-
-
Field Summary
-
Fields inherited from interface de.uni_trier.wi2.procake.utils.io.IO
COMPONENT, COMPONENT_KEY, DEFAULT_ENCODING, LOG_CONTENTHANDLER_NOT_FOUND, LOG_FILE_NOT_FOUND, LOG_IO_EXCEPTION, LOG_READER_NOT_FOUND, LOG_SAX_EXCEPTION, LOG_UNKNOWN_PARAMETER, LOG_WRITER_NOT_FOUND, LOG_WRONG_PARAMATER_TYPE, RESOURCE_XML
-
-
Constructor Summary
Constructors Constructor Description XMLReadHandlerImpl()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected booleancallSubHandlerEnd(String uri, String localName, String qName)Tries to call a subHandler with the given (SAX-)parameters.protected booleancallSubHandlerStart(String uri, String localName, String qName, Attributes attributes)Tries to call a subHandler with the given (SAX-)parameters.voidcharacters(char[] ch, int start, int length)Appends the given characters, at the given position, to the internal StringBuffervoidendDocument()voidendPrefixMapping(String prefix)protected StringgetCharacterString()Gets the characterstream between the last open-tag and the last-closing tag.LocatorgetDocumentLocator()To generate usefull log messages it is very important to know the location of the exception or log information.voidignorableWhitespace(char[] ch, int start, int length)protected voidinitiateSubHandler(String uri, String localName, String qName, Attributes attributes)Calls the appropriate handler for the given (SAX-)parametersprotected voidnotifyParentHandler(Object subHandlerObject)Notifies the parentHandler about the fact, that the object finished importing, which the subHandler had to managevoidprocessingInstruction(String target, String data)voidresetSubHandler()Sets the Subhandler of this handler to empty → clears the usage of this subHandlervoidsetCharacterString(String characters)Transfers the characterstring from the parentHandler to the subHandler (necessary, because all SAX-calls are carried via all parentHandlers)voidsetDocumentLocator(Locator documentLocator)voidsetParentHandler(ContentHandler parentHandler)Sets the given Handler as parentHandlervoidskippedEntity(String name)voidstartDocument()voidstartPrefixMapping(String prefix, String uri)abstract voidsubHandlerFinishedWithObject(Object subHandlerObject)Callback-method from the subHandler to inform the parentHandler about the finished object-
Methods inherited from class de.uni_trier.wi2.procake.data.io.IOImpl
getDescription, getFamily, getParameters, postInit, preInit, setFamily
-
Methods inherited from class de.uni_trier.wi2.procake.utils.composition.FactoryObjectImplementation
getParameter, initParametersBasedOn
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface de.uni_trier.wi2.procake.utils.io.ContentHandler
getObject, isHandlerFor
-
Methods inherited from interface org.xml.sax.ContentHandler
endElement, startElement
-
Methods inherited from interface de.uni_trier.wi2.procake.utils.io.IO
copy, getDescription, getFamily, getName, isHandlerFor, setFamily
-
-
-
-
Method Detail
-
getDocumentLocator
public Locator getDocumentLocator()
To generate usefull log messages it is very important to know the location of the exception or log information. Therefore, each ContentHandler should provide theLocatorobject of the parser.- Specified by:
getDocumentLocatorin interfaceContentHandler- Returns:
- The locate object.
- See Also:
Locator
-
setDocumentLocator
public void setDocumentLocator(Locator documentLocator)
- Specified by:
setDocumentLocatorin interfaceContentHandler
-
endDocument
public void endDocument()
- Specified by:
endDocumentin interfaceContentHandler
-
endPrefixMapping
public void endPrefixMapping(String prefix)
- Specified by:
endPrefixMappingin interfaceContentHandler
-
ignorableWhitespace
public void ignorableWhitespace(char[] ch, int start, int length)- Specified by:
ignorableWhitespacein interfaceContentHandler
-
processingInstruction
public void processingInstruction(String target, String data)
- Specified by:
processingInstructionin interfaceContentHandler
-
skippedEntity
public void skippedEntity(String name)
- Specified by:
skippedEntityin interfaceContentHandler
-
startDocument
public void startDocument()
- Specified by:
startDocumentin interfaceContentHandler
-
startPrefixMapping
public void startPrefixMapping(String prefix, String uri)
- Specified by:
startPrefixMappingin interfaceContentHandler
-
initiateSubHandler
protected void initiateSubHandler(String uri, String localName, String qName, Attributes attributes) throws SAXException
Calls the appropriate handler for the given (SAX-)parameters- Parameters:
uri- aStringobjectlocalName- aStringobjectqName- aStringobjectattributes- aAttributesobject- Throws:
SAXException
-
callSubHandlerStart
protected boolean callSubHandlerStart(String uri, String localName, String qName, Attributes attributes) throws SAXException
Tries to call a subHandler with the given (SAX-)parameters. If none is available, false is returned.- Parameters:
uri- aStringobjectlocalName- aStringobjectqName- aStringobjectattributes- aAttributesobject- Returns:
- a boolean
- Throws:
SAXException
-
callSubHandlerEnd
protected boolean callSubHandlerEnd(String uri, String localName, String qName) throws SAXException
Tries to call a subHandler with the given (SAX-)parameters. If none is available, false is returned.- Parameters:
uri- aStringobjectlocalName- aStringobjectqName- aStringobject- Returns:
- a boolean
- Throws:
SAXException
-
subHandlerFinishedWithObject
public abstract void subHandlerFinishedWithObject(Object subHandlerObject)
Callback-method from the subHandler to inform the parentHandler about the finished object- Specified by:
subHandlerFinishedWithObjectin interfaceContentHandler- Parameters:
subHandlerObject- The object created by the subHandler.
-
notifyParentHandler
protected void notifyParentHandler(Object subHandlerObject)
Notifies the parentHandler about the fact, that the object finished importing, which the subHandler had to manage- Parameters:
subHandlerObject- the object, which was finished importing
-
setParentHandler
public void setParentHandler(ContentHandler parentHandler)
Sets the given Handler as parentHandler- Specified by:
setParentHandlerin interfaceContentHandler
-
resetSubHandler
public void resetSubHandler()
Sets the Subhandler of this handler to empty → clears the usage of this subHandler- Specified by:
resetSubHandlerin interfaceContentHandler
-
characters
public void characters(char[] ch, int start, int length)Appends the given characters, at the given position, to the internal StringBuffer- Specified by:
charactersin interfaceContentHandler
-
getCharacterString
protected String getCharacterString()
Gets the characterstream between the last open-tag and the last-closing tag. It does only make sense reading this variable at a closing-tag.- Returns:
- a
Stringobject
-
setCharacterString
public void setCharacterString(String characters)
Transfers the characterstring from the parentHandler to the subHandler (necessary, because all SAX-calls are carried via all parentHandlers)- Specified by:
setCharacterStringin interfaceContentHandler
-
-