Package eu.simuline.util.sgml
Class SavingHandler
- java.lang.Object
-
- eu.simuline.util.sgml.SavingHandler
-
- All Implemented Interfaces:
ParseExceptionHandler,org.xml.sax.ContentHandler
public final class SavingHandler extends java.lang.Object implements org.xml.sax.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 java.lang.StringEND_OF_DOCUMENTprivate java.util.List<java.lang.String>eventsThe sequence of events taken place so far.static java.lang.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(java.lang.String namespaceURI, java.lang.String localName, java.lang.String qName)voidendPrefixMapping(java.lang.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(java.lang.String attrName, java.lang.Object oldAttrValue)Notifies the occurence of a duplicate attribute declaration within a start tag.voidfoundUnexpectedEndOfDocument()java.util.List<java.lang.String>getEvents()Returns the sequence of events taken place so far.voidignorableWhitespace(char[] chr, int start, int length)voidprocessingInstruction(java.lang.String target, java.lang.String data)voidsetDocumentLocator(org.xml.sax.Locator locator)voidskippedEntity(java.lang.String name)voidstartDocument()voidstartElement(java.lang.String namespaceURI, java.lang.String localName, java.lang.String qName, org.xml.sax.Attributes atts)voidstartPrefixMapping(java.lang.String prefix, java.lang.String uri)
-
-
-
Field Detail
-
START_OF_DOCUMENT
public static final java.lang.String START_OF_DOCUMENT
- See Also:
- Constant Field Values
-
END_OF_DOCUMENT
public static final java.lang.String END_OF_DOCUMENT
- See Also:
- Constant Field Values
-
events
private java.util.List<java.lang.String> events
The sequence of events taken place so far.
-
strict
private boolean strict
Whether to save things like processing instructions as well.
-
-
Method Detail
-
getEvents
public java.util.List<java.lang.String> getEvents()
Returns the sequence of events taken place so far.- Returns:
events.
-
setDocumentLocator
public void setDocumentLocator(org.xml.sax.Locator locator)
- Specified by:
setDocumentLocatorin interfaceorg.xml.sax.ContentHandler
-
startDocument
public void startDocument() throws org.xml.sax.SAXException- Specified by:
startDocumentin interfaceorg.xml.sax.ContentHandler- Throws:
org.xml.sax.SAXException
-
endDocument
public void endDocument() throws org.xml.sax.SAXException- Specified by:
endDocumentin interfaceorg.xml.sax.ContentHandler- Throws:
org.xml.sax.SAXException
-
startPrefixMapping
public void startPrefixMapping(java.lang.String prefix, java.lang.String uri) throws org.xml.sax.SAXException- Specified by:
startPrefixMappingin interfaceorg.xml.sax.ContentHandler- Throws:
org.xml.sax.SAXException
-
endPrefixMapping
public void endPrefixMapping(java.lang.String prefix) throws org.xml.sax.SAXException- Specified by:
endPrefixMappingin interfaceorg.xml.sax.ContentHandler- Throws:
org.xml.sax.SAXException
-
startElement
public void startElement(java.lang.String namespaceURI, java.lang.String localName, java.lang.String qName, org.xml.sax.Attributes atts) throws org.xml.sax.SAXException- Specified by:
startElementin interfaceorg.xml.sax.ContentHandler- Throws:
org.xml.sax.SAXException
-
endElement
public void endElement(java.lang.String namespaceURI, java.lang.String localName, java.lang.String qName) throws org.xml.sax.SAXException- Specified by:
endElementin interfaceorg.xml.sax.ContentHandler- Throws:
org.xml.sax.SAXException
-
characters
public void characters(char[] chr, int start, int length) throws org.xml.sax.SAXException- Specified by:
charactersin interfaceorg.xml.sax.ContentHandler- Throws:
org.xml.sax.SAXException
-
ignorableWhitespace
public void ignorableWhitespace(char[] chr, int start, int length) throws org.xml.sax.SAXException- Specified by:
ignorableWhitespacein interfaceorg.xml.sax.ContentHandler- Throws:
org.xml.sax.SAXException
-
processingInstruction
public void processingInstruction(java.lang.String target, java.lang.String data) throws org.xml.sax.SAXException- Specified by:
processingInstructionin interfaceorg.xml.sax.ContentHandler- Throws:
org.xml.sax.SAXException
-
skippedEntity
public void skippedEntity(java.lang.String name) throws org.xml.sax.SAXException- Specified by:
skippedEntityin interfaceorg.xml.sax.ContentHandler- Throws:
org.xml.sax.SAXException
-
foundMultipleAttribute
public void foundMultipleAttribute(java.lang.String attrName, java.lang.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
-
-