Java Doc for AbstractSAXTransformer.java in  » Content-Management-System » apache-lenya-2.0 » org » apache » cocoon » transformation » 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 » Content Management System » apache lenya 2.0 » org.apache.cocoon.transformation 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


org.apache.cocoon.transformation.AbstractTransformer
   org.apache.cocoon.transformation.AbstractSAXTransformer

All known Subclasses:   org.apache.cocoon.transformation.SQLTransformer,  org.apache.cocoon.portal.tools.transformation.CheckAccessTransformer,  org.apache.cocoon.portal.tools.transformation.PortalToolsLayoutTransformer,  org.apache.cocoon.transformation.VariableRewriterTransformer,  org.apache.lenya.cms.cocoon.transformation.UsecaseMenuTransformer,  org.apache.lenya.cms.cocoon.transformation.AccessControlSitetreeTransformer,  org.apache.cocoon.transformation.UuidToUrlTransformer,  org.apache.cocoon.transformation.LinkRewriterTransformer,  org.apache.cocoon.portal.transformation.AbstractCopletTransformer,  org.apache.cocoon.transformation.SourceWritingTransformer,  org.apache.lenya.cms.cocoon.transformation.AbstractLinkTransformer,  org.apache.cocoon.webapps.session.transformation.AbstractSessionTransformer,  org.apache.cocoon.mail.transformation.SendMailTransformer,  org.apache.cocoon.transformation.CleanupTransformer,  org.apache.cocoon.transformation.TeeTransformer,  org.apache.cocoon.transformation.DASLTransformer,  org.apache.cocoon.portal.coplets.basket.AbstractBasketTransformer,  org.apache.cocoon.transformation.NekoHTMLTransformer,  org.apache.lenya.cms.cocoon.transformation.WorkflowMenuTransformer,  org.apache.cocoon.transformation.SimpleFormTransformer,  org.apache.cocoon.transformation.CIncludeTransformer,  org.apache.lenya.cms.cocoon.transformation.MetaDataTransformer,  org.apache.cocoon.transformation.HTMLTransformer,  org.apache.cocoon.transformation.JPathTransformer,  org.apache.cocoon.portal.transformation.RSSTransformer,  org.apache.cocoon.transformation.SourcePropsWritingTransformer,  org.apache.cocoon.transformation.WebDAVTransformer,
AbstractSAXTransformer
abstract public class AbstractSAXTransformer extends AbstractTransformer implements Serviceable,Configurable,Disposable(Code)
This class is the basis for all transformers. It provides various useful methods and hooks for implementing own custom transformers.

The basic behaviour of each transformer consists of the following four parts:

  • Listen for specific events with a given namespace
  • Collect information via these events
  • Process the information
  • Create new events from the processed information

For all these four purposes the AbstractSAXTransformer offers some powerful methods and hooks:

Namespace handling

By setting the instance variable namespaceURI to the namespace the events are filtered and only events with this namespace are send to the two hooks: startTransformingElement and endTransformingElement. It is possible to override the default namespace for the transformer by specifying the parameter "namespaceURI" in the pipeline. This avoids possible namespace collisions.

Recording of information

There are several methods for recording information, e.g. startRecording(), startTextRecording() etc. These methods collect information from the xml stream for further processing.

Creating new events

New events can be easily created with the sendEvents() method, the sendStartElementEvent() methods, the sendEndElementEvent() method or the sendTextEvent() method.

Initialization

Before the document is processed the setupTransforming hook is invoked.
author:
   Carsten Ziegeler
version:
   $Id: AbstractSAXTransformer.java 433543 2006-08-22 06:22:54Z crossley $


Field Summary
final protected static  AttributesEMPTY_ATTRIBUTES
     Empty immutable attributes (for performance).
protected  Contextcontext
    
protected  StringdefaultNamespaceURI
     This is the default namespace used by the transformer.
protected  AttributesemptyAttributes
     Empty attributes (for performance).
protected  booleanignoreEmptyCharacters
     Controlls SAX event handling.
protected  intignoreEventsCount
     Controlls SAX event handling.
protected  intignoreHooksCount
     Controlls SAX event handling. If this is greater than zero, the hooks are not called.
protected  booleanignoreWhitespaces
     Controlls SAX event handling.
protected  ServiceManagermanager
    
protected  StringnamespaceURI
     The namespace used by the transformer for the SAX events filtering.
protected  MapobjectModel
    
protected  Parametersparameters
    
final protected  StackrecorderStack
    
protected  Requestrequest
    
protected  SourceResolverresolver
    
protected  Responseresponse
    
protected  Stringsource
    
final protected  Stackstack
     A stack for collecting information.


Method Summary
protected  voidaddRecorder(XMLConsumer recorder)
     Add a new recorder to the recording chain.
public  voidcharacters(char[] p0, int p1, int p2)
     Process the SAX event.
public  voidcomment(char ary, int start, int length)
    
public  voidconfigure(Configuration configuration)
    
public  voiddispose()
    
public  voidendCDATA()
    
public  voidendDTD()
    
public  voidendDocument()
     Process the SAX event.
public  voidendElement(String uri, String name, String raw)
     Process the SAX event.
public  voidendEntity(String name)
    
public  SourceParametersendParametersRecording(Parameters source)
     End recording of parameters If source is null a new parameters object is created, otherwise the parameters are added to this object.
Parameters:
  source - An optional parameters object.
public  SourceParametersendParametersRecording(SourceParameters source)
     End recording of parameters If source is null a new parameters object is created, otherwise the parameters are added to this object.
Parameters:
  source - An optional parameters object.
public  voidendPrefixMapping(String prefix)
     Process the SAX event.
public  DocumentFragmentendRecording()
     Stop DOM DocumentFragment recording.
public  XMLizableendSAXRecording()
     Stop recording of SAX events.
public  StringendSerializedXMLRecording()
     Return the serialized xml string.
public  StringendTextRecording()
     Stop recording of text and return the recorded information.
public  voidendTransformingElement(String uri, String name, String raw)
     Start processing elements of our namespace.
protected  StringfindPrefixMapping(String uri)
     Find prefix mapping for the given namespace URI.
protected  AttributesImplgetMutableAttributes(Attributes a)
     Helper method to get a modifiable attribute set.
public  voidignorableWhitespace(char[] p0, int p1, int p2)
     Process the SAX event.
public  voidprocessingInstruction(String target, String data)
     Process the SAX event.
public  voidrecycle()
    
protected  ObjectremoveRecorder()
     Remove a recorder from the recording chain.
public  voidsendEndElementEvent(String localname)
     Send SAX events to the next pipeline component.
public  voidsendEndElementEventNS(String localname)
     Send SAX events to the next pipeline component.
protected  voidsendEndPrefixMapping()
    
public  voidsendEvents(Node node)
     Send SAX events to the next pipeline component.
public  voidsendParametersEvents(SourceParameters pars)
     Send SAX events for the SourceParameters.
public  voidsendStartElementEvent(String localname)
     Send SAX events to the next pipeline component.
public  voidsendStartElementEvent(String localname, Attributes attr)
     Send SAX events to the next pipeline component.
public  voidsendStartElementEventNS(String localname)
     Send SAX events to the next pipeline component.
public  voidsendStartElementEventNS(String localname, Attributes attr)
     Send SAX events to the next pipeline component.
protected  voidsendStartPrefixMapping()
    
public  voidsendTextEvent(String text)
     Send SAX events to the next pipeline component.
public  voidservice(ServiceManager manager)
    
public  voidsetDocumentLocator(Locator locator)
     Process the SAX event.
public  voidsetup(SourceResolver resolver, Map objectModel, String src, Parameters params)
    
public  voidsetupTransforming()
     Setup the transformation of an xml document. This method is called just before the transformation (sending of sax events) starts.
public  voidskippedEntity(String name)
     Process the SAX event.
public  voidstartCDATA()
    
public  voidstartDTD(String name, String public_id, String system_id)
    
public  voidstartDocument()
     Process the SAX event.
public  voidstartElement(String uri, String name, String raw, Attributes attr)
     Process the SAX event.
public  voidstartEntity(String name)
    
public  voidstartParametersRecording()
     Start recording of parameters. All events are not forwarded and the incoming xml is converted to parameters.
public  voidstartPrefixMapping(String prefix, String uri)
     Process the SAX event.
public  voidstartRecording()
     Start DOM DocumentFragment recording. All incoming events are recorded and not forwarded.
public  voidstartSAXRecording()
     Start recording of SAX events. All incoming events are recorded and not forwarded.
public  voidstartSerializedXMLRecording(Properties format)
     Start recording of serialized xml All events are converted to an xml string which can be retrieved by endSerializedXMLRecording.
Parameters:
  format - The format for the serialized output.
public  voidstartTextRecording()
     Start recording of a text.
public  voidstartTransformingElement(String uri, String name, String raw, Attributes attr)
     Start processing elements of our namespace.

Field Detail
EMPTY_ATTRIBUTES
final protected static Attributes EMPTY_ATTRIBUTES(Code)
Empty immutable attributes (for performance). Use them whenever creating an element with no attributes.



context
protected Context context(Code)
The current Context object



defaultNamespaceURI
protected String defaultNamespaceURI(Code)
This is the default namespace used by the transformer. Implementations should set its value in the constructor. Must never be null.



emptyAttributes
protected Attributes emptyAttributes(Code)
Empty attributes (for performance). This can be used do create own attributes, but make sure to clean them afterwords. AbstractSAXTransformer.EMPTY_ATTRIBUTES



ignoreEmptyCharacters
protected boolean ignoreEmptyCharacters(Code)
Controlls SAX event handling. If set to true all characters events containing only whitespaces are ignored.



ignoreEventsCount
protected int ignoreEventsCount(Code)
Controlls SAX event handling. If this is incremented all events are not forwarded to the next pipeline component, but the hooks are still called.



ignoreHooksCount
protected int ignoreHooksCount(Code)
Controlls SAX event handling. If this is greater than zero, the hooks are not called. Attention, make sure, that you decrement this counter properly as your hooks are not called anymore!



ignoreWhitespaces
protected boolean ignoreWhitespaces(Code)
Controlls SAX event handling. If set to true all whitespace events are ignored.



manager
protected ServiceManager manager(Code)
The Avalon ServiceManager for getting Components



namespaceURI
protected String namespaceURI(Code)
The namespace used by the transformer for the SAX events filtering. This either equals to the AbstractSAXTransformer.defaultNamespaceURI or to the value set by the namespaceURI sitemap parameter for the pipeline. Must never be null.



objectModel
protected Map objectModel(Code)
The current objectModel of the environment



parameters
protected Parameters parameters(Code)
The parameters specified in the sitemap



recorderStack
final protected Stack recorderStack(Code)
The stack of current used recorders



request
protected Request request(Code)
The current Request object



resolver
protected SourceResolver resolver(Code)
The SourceResolver for this request



response
protected Response response(Code)
The current Response object



source
protected String source(Code)
The source attribute specified in the sitemap



stack
final protected Stack stack(Code)
A stack for collecting information. The stack is important for collection information especially when the tags can be nested.





Method Detail
addRecorder
protected void addRecorder(XMLConsumer recorder)(Code)
Add a new recorder to the recording chain. Do not invoke this method directly.



characters
public void characters(char[] p0, int p1, int p2) throws SAXException(Code)
Process the SAX event.
See Also:   org.xml.sax.ContentHandler.characters



comment
public void comment(char ary, int start, int length) throws SAXException(Code)

See Also:   LexicalHandler.comment



configure
public void configure(Configuration configuration) throws ConfigurationException(Code)



dispose
public void dispose()(Code)



endCDATA
public void endCDATA() throws SAXException(Code)

See Also:   LexicalHandler.endCDATA



endDTD
public void endDTD() throws SAXException(Code)

See Also:   LexicalHandler.endDTD



endDocument
public void endDocument() throws SAXException(Code)
Process the SAX event. The processing of the document is finished.
See Also:   org.xml.sax.ContentHandler.endDocument



endElement
public void endElement(String uri, String name, String raw) throws SAXException(Code)
Process the SAX event. The namespace of the event is checked. If it is the defined namespace for this transformer, the AbstractSAXTransformer.endTransformingElement hook is called.
See Also:   org.xml.sax.ContentHandler.endElement



endEntity
public void endEntity(String name) throws SAXException(Code)

See Also:   LexicalHandler.endEntity



endParametersRecording
public SourceParameters endParametersRecording(Parameters source) throws SAXException(Code)
End recording of parameters If source is null a new parameters object is created, otherwise the parameters are added to this object.
Parameters:
  source - An optional parameters object. The object containing all parameters.



endParametersRecording
public SourceParameters endParametersRecording(SourceParameters source) throws SAXException(Code)
End recording of parameters If source is null a new parameters object is created, otherwise the parameters are added to this object.
Parameters:
  source - An optional parameters object. The object containing all parameters.



endPrefixMapping
public void endPrefixMapping(String prefix) throws SAXException(Code)
Process the SAX event.
See Also:   org.xml.sax.ContentHandler.endPrefixMapping



endRecording
public DocumentFragment endRecording() throws SAXException(Code)
Stop DOM DocumentFragment recording. This method returns the resulting DocumentFragment, normalized.



endSAXRecording
public XMLizable endSAXRecording() throws SAXException(Code)
Stop recording of SAX events. This method returns the resulting XMLizable.
since:
   2.1.5



endSerializedXMLRecording
public String endSerializedXMLRecording() throws SAXException, ProcessingException(Code)
Return the serialized xml string. A string containing the recorded xml information, formatted bythe properties passed to the corresponding startSerializedXMLRecording().



endTextRecording
public String endTextRecording() throws SAXException(Code)
Stop recording of text and return the recorded information. The String, trimmed.



endTransformingElement
public void endTransformingElement(String uri, String name, String raw) throws ProcessingException, IOException, SAXException(Code)
Start processing elements of our namespace. This hook is invoked for each sax event with our namespace.
Parameters:
  uri - The namespace of the element.
Parameters:
  name - The local name of the element.
Parameters:
  raw - The qualified name of the element.



findPrefixMapping
protected String findPrefixMapping(String uri)(Code)
Find prefix mapping for the given namespace URI. Prefix mapping or null if no prefix defined



getMutableAttributes
protected AttributesImpl getMutableAttributes(Attributes a)(Code)
Helper method to get a modifiable attribute set.



ignorableWhitespace
public void ignorableWhitespace(char[] p0, int p1, int p2) throws SAXException(Code)
Process the SAX event.
See Also:   org.xml.sax.ContentHandler.ignorableWhitespace



processingInstruction
public void processingInstruction(String target, String data) throws SAXException(Code)
Process the SAX event.
See Also:   ContentHandler.processingInstruction



recycle
public void recycle()(Code)



removeRecorder
protected Object removeRecorder()(Code)
Remove a recorder from the recording chain. Do not invoke this method directly.



sendEndElementEvent
public void sendEndElementEvent(String localname) throws SAXException(Code)
Send SAX events to the next pipeline component. The endElement event for the given element is send to the next component in the current pipeline. The element has no namespace.
Parameters:
  localname - The name of the event.



sendEndElementEventNS
public void sendEndElementEventNS(String localname) throws SAXException(Code)
Send SAX events to the next pipeline component. The endElement event for the given element is send to the next component in the current pipeline. The element has the namespace of the transformer.
Parameters:
  localname - The name of the event.



sendEndPrefixMapping
protected void sendEndPrefixMapping() throws SAXException(Code)
Send all end prefix mapping events to the current content handler



sendEvents
public void sendEvents(Node node) throws SAXException(Code)
Send SAX events to the next pipeline component. The node is parsed and the events are send to the next component in the pipeline.
Parameters:
  node - The tree to be included.



sendParametersEvents
public void sendParametersEvents(SourceParameters pars) throws SAXException(Code)
Send SAX events for the SourceParameters. For each parametername/value pair an element is created with the name of the parameter and the content of this element is the value.



sendStartElementEvent
public void sendStartElementEvent(String localname) throws SAXException(Code)
Send SAX events to the next pipeline component. The startElement event for the given element is send to the next component in the current pipeline. The element has no namespace and no attributes
Parameters:
  localname - The name of the event.



sendStartElementEvent
public void sendStartElementEvent(String localname, Attributes attr) throws SAXException(Code)
Send SAX events to the next pipeline component. The startElement event for the given element is send to the next component in the current pipeline. The element has no namespace.
Parameters:
  localname - The name of the event.
Parameters:
  attr - The Attributes of the element



sendStartElementEventNS
public void sendStartElementEventNS(String localname) throws SAXException(Code)
Send SAX events to the next pipeline component. The startElement event for the given element is send to the next component in the current pipeline. The element has the namespace of the transformer, but not attributes
Parameters:
  localname - The name of the event.



sendStartElementEventNS
public void sendStartElementEventNS(String localname, Attributes attr) throws SAXException(Code)
Send SAX events to the next pipeline component. The startElement event for the given element is send to the next component in the current pipeline. The element has the namespace of the transformer.
Parameters:
  localname - The name of the event.
Parameters:
  attr - The Attributes of the element



sendStartPrefixMapping
protected void sendStartPrefixMapping() throws SAXException(Code)
Send all start prefix mapping events to the current content handler



sendTextEvent
public void sendTextEvent(String text) throws SAXException(Code)
Send SAX events to the next pipeline component. The characters event for the given text is send to the next component in the current pipeline.
Parameters:
  text - The string containing the information.



service
public void service(ServiceManager manager) throws ServiceException(Code)



setDocumentLocator
public void setDocumentLocator(Locator locator)(Code)
Process the SAX event.
See Also:   ContentHandler.setDocumentLocator



setup
public void setup(SourceResolver resolver, Map objectModel, String src, Parameters params) throws ProcessingException, SAXException, IOException(Code)



setupTransforming
public void setupTransforming() throws IOException, ProcessingException, SAXException(Code)
Setup the transformation of an xml document. This method is called just before the transformation (sending of sax events) starts. It should be used to initialize setup parameter depending on the object modell.



skippedEntity
public void skippedEntity(String name) throws SAXException(Code)
Process the SAX event.
See Also:   ContentHandler.skippedEntity



startCDATA
public void startCDATA() throws SAXException(Code)

See Also:   LexicalHandler.startCDATA



startDTD
public void startDTD(String name, String public_id, String system_id) throws SAXException(Code)

See Also:   LexicalHandler.startDTD



startDocument
public void startDocument() throws SAXException(Code)
Process the SAX event. A new document is processed. The hook method AbstractSAXTransformer.setupTransforming is invoked.
See Also:   ContentHandler.startDocument



startElement
public void startElement(String uri, String name, String raw, Attributes attr) throws SAXException(Code)
Process the SAX event. The namespace of the event is checked. If it is the defined namespace for this transformer, the AbstractSAXTransformer.startTransformingElement hook is called.
See Also:   org.xml.sax.ContentHandler.startElement



startEntity
public void startEntity(String name) throws SAXException(Code)

See Also:   LexicalHandler.startEntity



startParametersRecording
public void startParametersRecording() throws SAXException(Code)
Start recording of parameters. All events are not forwarded and the incoming xml is converted to parameters. Each toplevel node is a parameter and its text subnodes form the value. The Parameters can eiter be retrieved by endParametersRecording().



startPrefixMapping
public void startPrefixMapping(String prefix, String uri) throws SAXException(Code)
Process the SAX event.
See Also:   org.xml.sax.ContentHandler.startPrefixMapping



startRecording
public void startRecording() throws SAXException(Code)
Start DOM DocumentFragment recording. All incoming events are recorded and not forwarded. The resulting DocumentFragment can be obtained by the matching AbstractSAXTransformer.endRecording call.



startSAXRecording
public void startSAXRecording() throws SAXException(Code)
Start recording of SAX events. All incoming events are recorded and not forwarded. The resulting XMLizable can be obtained by the matching AbstractSAXTransformer.endSAXRecording call.
since:
   2.1.5



startSerializedXMLRecording
public void startSerializedXMLRecording(Properties format) throws SAXException(Code)
Start recording of serialized xml All events are converted to an xml string which can be retrieved by endSerializedXMLRecording.
Parameters:
  format - The format for the serialized output. If nullis specified, the default format is used.



startTextRecording
public void startTextRecording() throws SAXException(Code)
Start recording of a text. No events forwarded, and all characters events are collected into a string.



startTransformingElement
public void startTransformingElement(String uri, String name, String raw, Attributes attr) throws ProcessingException, IOException, SAXException(Code)
Start processing elements of our namespace. This hook is invoked for each sax event with our namespace.
Parameters:
  uri - The namespace of the element.
Parameters:
  name - The local name of the element.
Parameters:
  raw - The qualified name of the element.
Parameters:
  attr - The attributes of the element.




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