Package com.topologi.diffx.load
Class SAXRecorder.RecorderHandler
java.lang.Object
org.xml.sax.helpers.DefaultHandler
com.topologi.diffx.load.SAXRecorder.RecorderHandler
- All Implemented Interfaces:
ContentHandler,DTDHandler,EntityResolver,ErrorHandler
- Enclosing class:
- SAXRecorder
A SAX2 handler that records XML events.
This class is an inner class as there is no reason to expose its method to the public API.
- Version:
- 27 April 2005
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final StringBufferA buffer for character data.private final AttributeComparatorThe comparator in order to sort attribute correctly.private intThe weight of the current element.private EventFactoryThe factory that will produce events according to the configuration.private List<OpenElementEvent>The last open element event, should only containOpenElementEvents.private TextTokenizerThe text tokenizer according to the configuration.The stack of weight, should only containInteger. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidcharacters(char[] buf, int pos, int len) voidvoidendElement(String uri, String localName, String qName) private voidhandleAttributes(Attributes atts) Handles the attributes, will add them to the sequence in order if any.voidignorableWhitespace(char[] buf1, int pos, int len) private OpenElementEventReturns the last open element and remove it from the stack.private intReturns the last weight and remove it from the stack.voidprocessingInstruction(String target, String data) private voidRecords the characters which are in the buffer.voidvoidstartElement(String uri, String localName, String qName, Attributes atts) voidstartPrefixMapping(String prefix, String uri) Methods inherited from class org.xml.sax.helpers.DefaultHandler
endPrefixMapping, error, fatalError, notationDecl, resolveEntity, setDocumentLocator, skippedEntity, unparsedEntityDecl, warningMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.xml.sax.ContentHandler
declaration
-
Field Details
-
ch
A buffer for character data. -
comparator
The comparator in order to sort attribute correctly. -
currentWeight
private transient int currentWeightThe weight of the current element. -
openElements
The last open element event, should only containOpenElementEvents. -
weights
The stack of weight, should only containInteger. -
efactory
The factory that will produce events according to the configuration. -
tokenizer
The text tokenizer according to the configuration.
-
-
Constructor Details
-
RecorderHandler
private RecorderHandler()
-
-
Method Details
-
startDocument
public void startDocument()- Specified by:
startDocumentin interfaceContentHandler- Overrides:
startDocumentin classDefaultHandler- See Also:
-
startPrefixMapping
- Specified by:
startPrefixMappingin interfaceContentHandler- Overrides:
startPrefixMappingin classDefaultHandler- Throws:
SAXException
-
startElement
- Specified by:
startElementin interfaceContentHandler- Overrides:
startElementin classDefaultHandler
-
endElement
- Specified by:
endElementin interfaceContentHandler- Overrides:
endElementin classDefaultHandler
-
characters
public void characters(char[] buf, int pos, int len) - Specified by:
charactersin interfaceContentHandler- Overrides:
charactersin classDefaultHandler
-
ignorableWhitespace
public void ignorableWhitespace(char[] buf1, int pos, int len) - Specified by:
ignorableWhitespacein interfaceContentHandler- Overrides:
ignorableWhitespacein classDefaultHandler
-
processingInstruction
- Specified by:
processingInstructionin interfaceContentHandler- Overrides:
processingInstructionin classDefaultHandler
-
endDocument
- Specified by:
endDocumentin interfaceContentHandler- Overrides:
endDocumentin classDefaultHandler- Throws:
SAXException
-
recordCharacters
private void recordCharacters()Records the characters which are in the buffer. -
popLastOpenElement
Returns the last open element and remove it from the stack.- Returns:
- The last open element.
-
popWeight
private int popWeight()Returns the last weight and remove it from the stack.- Returns:
- The weight on top of the stack.
-
handleAttributes
Handles the attributes, will add them to the sequence in order if any.- Parameters:
atts- The attributes to handle.
-