|
Devsphere.com |
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Object
|
+--org.xml.sax.helpers.DefaultHandler
|
+--com.devsphere.xml.taglib.process.parse.Handler
This handler receives the SAX events as method calls and creates event objects. This is useful when the parsing is performed in one thread and the events must be processed/consumed by another thread. In the case of this tag library, the tag handlers consume the event objects in the JSP thread. The parsing must be done in a separate thread. Otherwise, the parsing would block the JSP thread until the whole document is parsed. The separate parsing thread allows the tag library to parse the document and process the events in parallel.
| Constructor Summary | |
Handler(boolean ignoreSpaces)
Initializes the handler. |
|
| Method Summary | |
protected boolean |
addEvent(EventSupport event)
Makes an event available for processing. |
void |
characters(char[] ch,
int start,
int length)
Adds a Characters event. |
void |
comment(char[] ch,
int start,
int length)
Does nothing. |
void |
endCDATA()
Does nothing. |
void |
endDocument()
Adds an EndDocument event. |
void |
endDTD()
Does nothing. |
void |
endElement(java.lang.String namespaceURI,
java.lang.String localName,
java.lang.String qualifiedName)
Adds an EndElement event. |
void |
endEntity(java.lang.String name)
Does nothing. |
void |
endParse()
Sets the parseEnded to true. |
EventSupport |
getEvent()
Returns the current parsing event. |
void |
handleDOM(org.w3c.dom.Element element)
Receives the DOM sub-trees for handling. |
void |
processingInstruction(java.lang.String target,
java.lang.String data)
Adds a Processing event. |
boolean |
removeEvent(EventSupport event)
Removes the current event to make room for a new event. |
void |
setDocumentLocator(org.xml.sax.Locator locator)
Does nothing. |
void |
startCDATA()
Does nothing. |
void |
startDocument()
Adds a StartDocument event. |
void |
startDTD(java.lang.String name,
java.lang.String publicId,
java.lang.String systemId)
Does nothing. |
void |
startElement(java.lang.String namespaceURI,
java.lang.String localName,
java.lang.String qualifiedName,
org.xml.sax.Attributes attributes)
Doesn't add any event because the StartElement event was
created and added by wantDOM() |
void |
startEntity(java.lang.String name)
Does nothing. |
boolean |
wantDOM(java.lang.String namespaceURI,
java.lang.String localName,
java.lang.String qualifiedName,
org.xml.sax.Attributes attributes)
Returns true when the application wants to receive
a DOM sub-tree for handling. |
| Methods inherited from class org.xml.sax.helpers.DefaultHandler |
endPrefixMapping, error, fatalError, ignorableWhitespace, notationDecl, resolveEntity, skippedEntity, startPrefixMapping, unparsedEntityDecl, warning |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
public Handler(boolean ignoreSpaces)
ignoreSpaces - a flag indicating if white space character data
should be ignored| Method Detail |
protected boolean addEvent(EventSupport event)
throws Ender
getEvent(). Before that, this
method waits until the old current event, if any, is consumed.
event - the new current event
true if the event was accepted or
false if the parsing ended before receiving
this event
Ender - to interrupt the parsing when parseEnded
is true and the parsing thread must
be stoppedpublic EventSupport getEvent()
null if the parsing endedpublic boolean removeEvent(EventSupport event)
event - this must coincide with the current event in order
to be removed
true if the current event was removedpublic void endParse()
parseEnded to true. Next time a SAX
event is received for handling an Ender exception will
be thrown in order to interrupt the parsing.
public boolean wantDOM(java.lang.String namespaceURI,
java.lang.String localName,
java.lang.String qualifiedName,
org.xml.sax.Attributes attributes)
throws org.xml.sax.SAXException
true when the application wants to receive
a DOM sub-tree for handling.
During the SAX parsing, a builder object invokes the
wantDOM() method for each startElement()
parsing event. If wantDOM() returns false
the SAX parsing mode continues. When wantDOM() returns
true the builder enters in DOM parsing mode and starts
creating a DOM sub-tree from all SAX events between the current
startElement() and the corresponding
endElement().
wantDOM in interface SDXControllernamespaceURI - The element's namespace URIlocalName - The element's local namequalifiedName - The element's qualified nameattributes - The element's attributes
org.xml.sax.SAXException - If an error must be signaled
public void handleDOM(org.w3c.dom.Element element)
throws org.xml.sax.SAXException
After wantDOM() returns true, the builder
constructs a DOM sub-tree from SAX events and passes it to the
handleDOM() method. After handling, the builder
returns to the SAX parsing mode.
handleDOM in interface SDXControllerelement - The root of the DOM sub-tree
org.xml.sax.SAXException - If an error must be signaledpublic void setDocumentLocator(org.xml.sax.Locator locator)
setDocumentLocator in interface org.xml.sax.ContentHandlersetDocumentLocator in class org.xml.sax.helpers.DefaultHandlerlocator - The SAX Locator object
public void startDocument()
throws org.xml.sax.SAXException
StartDocument event.
startDocument in interface org.xml.sax.ContentHandlerstartDocument in class org.xml.sax.helpers.DefaultHandlerorg.xml.sax.SAXException - Error reported by the handler's method
public void endDocument()
throws org.xml.sax.SAXException
EndDocument event.
endDocument in interface org.xml.sax.ContentHandlerendDocument in class org.xml.sax.helpers.DefaultHandlerorg.xml.sax.SAXException - Error reported by the handler's method
public void startElement(java.lang.String namespaceURI,
java.lang.String localName,
java.lang.String qualifiedName,
org.xml.sax.Attributes attributes)
throws org.xml.sax.SAXException
StartElement event was
created and added by wantDOM()
startElement in interface org.xml.sax.ContentHandlerstartElement in class org.xml.sax.helpers.DefaultHandlernamespaceURI - The element's namespace URIlocalName - The element's local namequalifiedName - The element's qualified nameattributes - The element's attributes
org.xml.sax.SAXException - Error reported by the handler's method
public void endElement(java.lang.String namespaceURI,
java.lang.String localName,
java.lang.String qualifiedName)
throws org.xml.sax.SAXException
EndElement event.
endElement in interface org.xml.sax.ContentHandlerendElement in class org.xml.sax.helpers.DefaultHandlernamespaceURI - The element's namespace URIlocalName - The element's local namequalifiedName - The element's qualified name
org.xml.sax.SAXException - Error reported by the handler's method
public void characters(char[] ch,
int start,
int length)
throws org.xml.sax.SAXException
Characters event.
characters in interface org.xml.sax.ContentHandlercharacters in class org.xml.sax.helpers.DefaultHandlerch - The characters from the XML documentstart - The start position in the arraylength - The number of characters to get from the array
org.xml.sax.SAXException - Error reported by the handler's method
public void processingInstruction(java.lang.String target,
java.lang.String data)
throws org.xml.sax.SAXException
Processing event.
processingInstruction in interface org.xml.sax.ContentHandlerprocessingInstruction in class org.xml.sax.helpers.DefaultHandlertarget - The target of the processing instruction.data - The data of the processing instruction.
org.xml.sax.SAXException - Error reported by the handler's method
public void startDTD(java.lang.String name,
java.lang.String publicId,
java.lang.String systemId)
throws org.xml.sax.SAXException
startDTD in interface org.xml.sax.ext.LexicalHandlername - The name of the document's root element.publicId - The public identifier of the external DTDsystemId - The system identifier of the external DTD
org.xml.sax.SAXException - Cannot be thrown since the method does nothing
public void endDTD()
throws org.xml.sax.SAXException
endDTD in interface org.xml.sax.ext.LexicalHandlerorg.xml.sax.SAXException - Cannot be thrown since the method does nothing
public void startEntity(java.lang.String name)
throws org.xml.sax.SAXException
startEntity in interface org.xml.sax.ext.LexicalHandlername - The name of an entity
org.xml.sax.SAXException - Cannot be thrown since the method does nothing
public void endEntity(java.lang.String name)
throws org.xml.sax.SAXException
endEntity in interface org.xml.sax.ext.LexicalHandlername - The name of an entity
org.xml.sax.SAXException - Cannot be thrown since the method does nothing
public void startCDATA()
throws org.xml.sax.SAXException
startCDATA in interface org.xml.sax.ext.LexicalHandlerorg.xml.sax.SAXException - Error reported by the handler's method
public void endCDATA()
throws org.xml.sax.SAXException
endCDATA in interface org.xml.sax.ext.LexicalHandlerorg.xml.sax.SAXException - Error reported by the handler's method
public void comment(char[] ch,
int start,
int length)
throws org.xml.sax.SAXException
comment in interface org.xml.sax.ext.LexicalHandlerch - An array holding the characters in the commentstart - The start position in the arraylength - The number of characters to get from the array
org.xml.sax.SAXException - Error reported by the handler's method
|
Devsphere.com |
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||