Package eu.simuline.util.sgml
Class SavingHandler
- java.lang.Object
-
- eu.simuline.util.sgml.SavingHandler
-
- All Implemented Interfaces:
ParseExceptionHandler,ContentHandler
public final class SavingHandler extends Object implements ContentHandler, ParseExceptionHandler
Saves all events in a list to be returned bygetEvents().- Version:
- 1.0
- Author:
- Ernst Reissner
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface eu.simuline.util.sgml.ParseExceptionHandler
ParseExceptionHandler.Impl
-
-
Field Summary
Fields Modifier and Type Field Description static StringEND_OF_DOCUMENTprivate List<String>eventsThe sequence of events taken place so far.static StringSTART_OF_DOCUMENTprivate booleanstrictWhether to save things like processing instructions as well.
-
Constructor Summary
Constructors Constructor Description SavingHandler()Creates a newSavingHandler.SavingHandler(boolean strict)Creates a newSavingHandlerinstance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidcharacters(char[] chr, int start, int length)voidendDocument()voidendElement(String namespaceURI, String localName, String qName)voidendPrefixMapping(String prefix)voidfoundCharAfterEndOfEndTag(char chr)Notifies that a character was found after the "/" of an end tag.voidfoundIllegalCharInTag(char chr)Notifies that an illegal character was found in a tag *****.voidfoundMultipleAttribute(String attrName, Object oldAttrValue)Notifies the occurence of a duplicate attribute declaration within a start tag.voidfoundUnexpectedEndOfDocument()List<String>getEvents()Returns the sequence of events taken place so far.voidignorableWhitespace(char[] chr, int start, int length)voidprocessingInstruction(String target, String data)voidsetDocumentLocator(Locator locator)voidskippedEntity(String name)voidstartDocument()voidstartElement(String namespaceURI, String localName, String qName, Attributes atts)voidstartPrefixMapping(String prefix, String uri)
-
-
-
Field Detail
-
START_OF_DOCUMENT
public static final String START_OF_DOCUMENT
- See Also:
- Constant Field Values
-
END_OF_DOCUMENT
public static final String END_OF_DOCUMENT
- See Also:
- Constant Field Values
-
strict
private boolean strict
Whether to save things like processing instructions as well.
-
-
Method Detail
-
getEvents
public List<String> getEvents()
Returns the sequence of events taken place so far.- Returns:
events.
-
setDocumentLocator
public void setDocumentLocator(Locator locator)
- Specified by:
setDocumentLocatorin interfaceContentHandler
-
startDocument
public void startDocument() throws SAXException- Specified by:
startDocumentin interfaceContentHandler- Throws:
SAXException
-
endDocument
public void endDocument() throws SAXException- Specified by:
endDocumentin interfaceContentHandler- Throws:
SAXException
-
startPrefixMapping
public void startPrefixMapping(String prefix, String uri) throws SAXException
- Specified by:
startPrefixMappingin interfaceContentHandler- Throws:
SAXException
-
endPrefixMapping
public void endPrefixMapping(String prefix) throws SAXException
- Specified by:
endPrefixMappingin interfaceContentHandler- Throws:
SAXException
-
startElement
public void startElement(String namespaceURI, String localName, String qName, Attributes atts) throws SAXException
- Specified by:
startElementin interfaceContentHandler- Throws:
SAXException
-
endElement
public void endElement(String namespaceURI, String localName, String qName) throws SAXException
- Specified by:
endElementin interfaceContentHandler- Throws:
SAXException
-
characters
public void characters(char[] chr, int start, int length) throws SAXException- Specified by:
charactersin interfaceContentHandler- Throws:
SAXException
-
ignorableWhitespace
public void ignorableWhitespace(char[] chr, int start, int length) throws SAXException- Specified by:
ignorableWhitespacein interfaceContentHandler- Throws:
SAXException
-
processingInstruction
public void processingInstruction(String target, String data) throws SAXException
- Specified by:
processingInstructionin interfaceContentHandler- Throws:
SAXException
-
skippedEntity
public void skippedEntity(String name) throws SAXException
- Specified by:
skippedEntityin interfaceContentHandler- Throws:
SAXException
-
foundMultipleAttribute
public void foundMultipleAttribute(String attrName, Object oldAttrValue)
Description copied from interface:ParseExceptionHandlerNotifies the occurence of a duplicate attribute declaration within a start tag.- Specified by:
foundMultipleAttributein interfaceParseExceptionHandler- Parameters:
attrName- a non-emptyStringrepresenting the name of the attribute.oldAttrValue- anObjectwhich is either aStringrepresenting the value of the attribute or the objectAttributesImpl.NO_VALUEwhich signifies the absence of a value. Here the old value (which is overwritten in the attribute list) should be passed to the application. ****** it is not clear to me whether the ordering of the attribute list is significant. The former occurence of the attribute is lost. **** is this true?
-
foundIllegalCharInTag
public void foundIllegalCharInTag(char chr)
Description copied from interface:ParseExceptionHandlerNotifies that an illegal character was found in a tag *****. To be more precise: at the beginning of the tag. Note that this is ignored and the next one is read.- Specified by:
foundIllegalCharInTagin interfaceParseExceptionHandler- Parameters:
chr- the illegalcharvalue.
-
foundCharAfterEndOfEndTag
public void foundCharAfterEndOfEndTag(char chr)
Description copied from interface:ParseExceptionHandlerNotifies that a character was found after the "/" of an end tag. Note that this is ignored and the next one is read.- Specified by:
foundCharAfterEndOfEndTagin interfaceParseExceptionHandler- Parameters:
chr- the illegalcharvalue.
-
foundUnexpectedEndOfDocument
public void foundUnexpectedEndOfDocument()
- Specified by:
foundUnexpectedEndOfDocumentin interfaceParseExceptionHandler
-
-