Java Doc for HandlerStack.java in  » Workflow-Engines » wfmopen-2.1.1 » de » danet » an » util » sax » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Workflow Engines » wfmopen 2.1.1 » de.danet.an.util.sax 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   de.danet.an.util.sax.HandlerStack

HandlerStack
public class HandlerStack (Code)
HandlerStack provides support for dispatching SAX events to the appropriate target during processing of an XML document.

Writing an event handler for a SAX parser and being object oriented isn't easy. Most people tend to write one large event handler that knows far too much about the objects that it has to create and provide with information. According to the object oriented approach, every object should implement its own handling for the parts of the XML text that provides information about the object's state.

This means changing the parser's content handler in a controlled way. Each time that a handler encounters an element that denotes the start of another object, it should create another object and delegate further processing to this object. Or even better, it should call a (static) factory method for the class associated with the encountered element and leave all further processing to the factory method.

Effectively, this results in a stack of handler with events being delivered to the top of stack handler. This class implements such a stack with as much automation as possible.




Constructor Summary
public  HandlerStack(XMLReader theReader, ContentHandler initialHandler)
     Create a new stack for a given reader.
public  HandlerStack(ContentHandler initialHandler)
     Create a new stack.

Method Summary
public  ContentHandlercontentHandler()
     Return the event handler associated with this stack.
public  StringcurrentPath()
     Return the current path.
public  voidendAllPrefixMappings(ContentHandler handler)
     Send prefix mapping end events for all namespaces currently in effect to the given handler.
public  ObjectgetContextData(String name)
     Retrieves a context item.
Parameters:
  name - the name of the context item.
public  StringgetPrefixForURI(String uri)
     Return the prefix for a given URI based on the namespaces currently in effect.
public  intgetRelativeDepth()
     Returns the relative depth of an element.
public  StringgetURIForPrefix(String prefix)
     Return the URI for a given prefix based on the namespaces currently in effect.
public  voidpush(ContentHandler handler)
     Pushes the given handler on top of stack.
public  ObjectremoveContextData(String name)
     Retrieves and removes a context item.
Parameters:
  name - the name of the context item.
public  voidsetContextData(String name, Object value)
     Sets a context data item.
public  voidstartAllPrefixMappings(ContentHandler handler)
     Send prefix mapping start events for all namespaces currently in effect to the given handler.
public  Stringtext()
     Return the accumulated text from characters events for the current element.


Constructor Detail
HandlerStack
public HandlerStack(XMLReader theReader, ContentHandler initialHandler)(Code)
Create a new stack for a given reader. The stack's event handler will be set as the reader's content handler.
Parameters:
  theReader - the reader associated with this stack.
Parameters:
  initialHandler - the initial active handler (new top of stack).



HandlerStack
public HandlerStack(ContentHandler initialHandler)(Code)
Create a new stack. To pass events to the stack, the stack's event handler can be retrieved with HandlerStack.contentHandlereventHandler() .
Parameters:
  initialHandler - the initial active handler (new top of stack).




Method Detail
contentHandler
public ContentHandler contentHandler()(Code)
Return the event handler associated with this stack. the event handler.



currentPath
public String currentPath()(Code)
Return the current path. The current path consists of all elements for which a startElement event has been received. The path is denoted as /{uri1}loc1/loc2/{uri3}loc3. the current path.



endAllPrefixMappings
public void endAllPrefixMappings(ContentHandler handler) throws SAXException(Code)
Send prefix mapping end events for all namespaces currently in effect to the given handler.
Parameters:
  handler - the handler.
throws:
  SAXException - if signalled by the receiving handler.



getContextData
public Object getContextData(String name)(Code)
Retrieves a context item.
Parameters:
  name - the name of the context item. the associated value or null if the attributehas not been set.
See Also:   HandlerStack.setContextData



getPrefixForURI
public String getPrefixForURI(String uri)(Code)
Return the prefix for a given URI based on the namespaces currently in effect.
Parameters:
  uri - the namespace URI the prefix or null



getRelativeDepth
public int getRelativeDepth()(Code)
Returns the relative depth of an element. The relative depth is tracked for every handler. When the startElement method of a newly pushed handler is called, the relative depth is 0. It is incremented immediately after startElement returns, so during the next call to startElement the value will be 1 (unless there has been a call to endElement, of course). the relative depth



getURIForPrefix
public String getURIForPrefix(String prefix)(Code)
Return the URI for a given prefix based on the namespaces currently in effect.
Parameters:
  prefix - the namespace URI the URI or null



push
public void push(ContentHandler handler) throws SAXException, IllegalStateException(Code)
Pushes the given handler on top of stack. This method may only be called from a ContentHandler.startElementContentHandler.startElement that has been invoked by the stack.

When a handler is pushed, the pushed handler's ContentHandler.startElement startElement is called with the current context, i.e. the values for uri, localName and qName passed to the pushing startElement that initially caused the push.
Parameters:
  handler - the new active handler.
throws:
  IllegalStateException - if the method is called outside aContentHandler.startElement that has been calledby the stack.
throws:
  SAXException - if thrown by the calledstartElement.




removeContextData
public Object removeContextData(String name)(Code)
Retrieves and removes a context item.
Parameters:
  name - the name of the context item. the associated value or null if the attributehas not been set.
See Also:   HandlerStack.setContextData
See Also:   HandlerStack.getContextData



setContextData
public void setContextData(String name, Object value)(Code)
Sets a context data item. context data items may be used to communicate data between different handlers.
Parameters:
  name - the name of the context item.
Parameters:
  value - the associated value.
See Also:   HandlerStack.getContextData



startAllPrefixMappings
public void startAllPrefixMappings(ContentHandler handler) throws SAXException(Code)
Send prefix mapping start events for all namespaces currently in effect to the given handler.
Parameters:
  handler - the handler.
throws:
  SAXException - if signalled by the receiving handler.



text
public String text()(Code)
Return the accumulated text from characters events for the current element. Returns valid data during processing of endElement events only. the accumulated text.



Methods inherited from java.lang.Object
native protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public boolean equals(Object obj)(Code)(Java Doc)
protected void finalize() throws Throwable(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.