Java Doc for SaxWriter.java in  » XML » xstream-1.3 » com » thoughtworks » xstream » io » xml » 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 » XML » xstream 1.3 » com.thoughtworks.xstream.io.xml 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   com.thoughtworks.xstream.io.xml.AbstractXmlWriter
      com.thoughtworks.xstream.io.xml.SaxWriter

SaxWriter
final public class SaxWriter extends AbstractXmlWriter implements XMLReader(Code)
A SAX org.xml.sax.XMLReader parser that acts as an XStream com.thoughtworks.xstream.io.HierarchicalStreamWriter to enable direct generation of a SAX event flow from the XStream serialization of a list of list of Java objects.

As a custom SAX parser, this class ignores the arguments of the two standard parse methods ( SaxWriter.parse(java.lang.String) and SaxWriter.parse(org.xml.sax.InputSource) ) but relies on a proprietary SAX property SaxWriter.SOURCE_OBJECT_LIST_PROPERTY to define the list of objects to serialize.

Configuration of this SAX parser is achieved through the standard SaxWriter.setProperty SAX property mechanism . While specific setter methods require direct access to the parser instance, SAX properties support configuration settings to be propagated through a chain of org.xml.sax.XMLFilter filters down to the underlying parser object.

This mechanism shall be used to configure the SaxWriter.SOURCE_OBJECT_LIST_PROPERTY objects to be serialized as well as the SaxWriter.CONFIGURED_XSTREAM_PROPERTY XStream facade .


author:
   Laurent Bihanic


Field Summary
final public static  StringCONFIGURED_XSTREAM_PROPERTY
     The SaxWriter.setProperty SAX property to configure the XStream facade to be used for object serialization.
final public static  StringSOURCE_OBJECT_LIST_PROPERTY
     The SaxWriter.setProperty SAX property to configure the list of Java objects to serialize.

Constructor Summary
public  SaxWriter(XmlFriendlyReplacer replacer)
    
public  SaxWriter(boolean includeEnclosingDocument, XmlFriendlyReplacer replacer)
    
public  SaxWriter(boolean includeEnclosingDocument)
    
public  SaxWriter()
    

Method Summary
public  voidaddAttribute(String name, String value)
    
public  voidclose()
    
public  voidendNode()
    
public  voidflush()
    
public  ContentHandlergetContentHandler()
     Returns the current content handler.
public  DTDHandlergetDTDHandler()
     Returns the current DTD handler.
public  EntityResolvergetEntityResolver()
     Returns the current entity resolver.
public  ErrorHandlergetErrorHandler()
     Returns the current error handler.
public  booleangetFeature(String name)
     Looks up the value of a feature.

The feature name is any fully-qualified URI.

public  ObjectgetProperty(String name)
     Looks up the value of a property.

The property name is any fully-qualified URI.

public  voidparse(String systemId)
     Parses an XML document from a system identifier (URI).

This method is a shortcut for the common case of reading a document from a system identifier.

public  voidparse(InputSource input)
     Parse an XML document.

The application can use this method to instruct the XML reader to begin parsing an XML document from any valid input source (a character stream, a byte stream, or a URI).

Applications may not invoke this method while a parse is in progress (they should create a new XMLReader instead for each nested XML document).

public  voidsetContentHandler(ContentHandler handler)
     Allows an application to register a content event handler.
public  voidsetDTDHandler(DTDHandler handler)
     Allows an application to register a DTD event handler.
public  voidsetEntityResolver(EntityResolver resolver)
     Allows an application to register an entity resolver.
public  voidsetErrorHandler(ErrorHandler handler)
     Allows an application to register an error event handler.

If the application does not register an error handler, all error events reported by the SAX parser will be silently ignored; however, normal processing may not continue.

public  voidsetFeature(String name, boolean value)
     Sets the state of a feature.
public  voidsetProperty(String name, Object value)
     Sets the value of a property.

The property name is any fully-qualified URI.

public  voidsetValue(String text)
    
public  voidstartNode(String name)
    

Field Detail
CONFIGURED_XSTREAM_PROPERTY
final public static String CONFIGURED_XSTREAM_PROPERTY(Code)
The SaxWriter.setProperty SAX property to configure the XStream facade to be used for object serialization. If the property is not set, a new XStream facade will be allocated for each parse.



SOURCE_OBJECT_LIST_PROPERTY
final public static String SOURCE_OBJECT_LIST_PROPERTY(Code)
The SaxWriter.setProperty SAX property to configure the list of Java objects to serialize. Setting this property prior invoking one of the parse() methods is mandatory.
See Also:   SaxWriter.parse(java.lang.String)
See Also:   SaxWriter.parse(org.xml.sax.InputSource)




Constructor Detail
SaxWriter
public SaxWriter(XmlFriendlyReplacer replacer)(Code)



SaxWriter
public SaxWriter(boolean includeEnclosingDocument, XmlFriendlyReplacer replacer)(Code)



SaxWriter
public SaxWriter(boolean includeEnclosingDocument)(Code)



SaxWriter
public SaxWriter()(Code)




Method Detail
addAttribute
public void addAttribute(String name, String value)(Code)



close
public void close()(Code)



endNode
public void endNode()(Code)



flush
public void flush()(Code)



getContentHandler
public ContentHandler getContentHandler()(Code)
Returns the current content handler. the current content handler, or null if nonehas been registered.
See Also:   SaxWriter.setContentHandler



getDTDHandler
public DTDHandler getDTDHandler()(Code)
Returns the current DTD handler. the current DTD handler, or null if nonehas been registered.
See Also:   SaxWriter.setDTDHandler



getEntityResolver
public EntityResolver getEntityResolver()(Code)
Returns the current entity resolver. the current entity resolver, or null if nonehas been registered.
See Also:   SaxWriter.setEntityResolver



getErrorHandler
public ErrorHandler getErrorHandler()(Code)
Returns the current error handler. the current error handler, or null if nonehas been registered.
See Also:   SaxWriter.setErrorHandler



getFeature
public boolean getFeature(String name) throws SAXNotRecognizedException(Code)
Looks up the value of a feature.

The feature name is any fully-qualified URI. It is possible for an XMLReader to recognize a feature name but to be unable to return its value; this is especially true in the case of an adapter for a SAX1 Parser, which has no way of knowing whether the underlying parser is performing validation or expanding external entities.

All XMLReaders are required to recognize the http://xml.org/sax/features/namespaces and the http://xml.org/sax/features/namespace-prefixes feature names.

Some feature values may be available only in specific contexts, such as before, during, or after a parse.

Implementors are free (and encouraged) to invent their own features, using names built on their own URIs.


Parameters:
  name - the feature name, which is a fully-qualified URI. the current state of the feature (true or false).
throws:
  SAXNotRecognizedException - when the XMLReader does notrecognize the feature name.
See Also:   SaxWriter.setFeature



getProperty
public Object getProperty(String name) throws SAXNotRecognizedException(Code)
Looks up the value of a property.

The property name is any fully-qualified URI. It is possible for an XMLReader to recognize a property name but to be unable to return its state.

XMLReaders are not required to recognize any specific property names, though an initial core set is documented for SAX2.

Some property values may be available only in specific contexts, such as before, during, or after a parse.

Implementors are free (and encouraged) to invent their own properties, using names built on their own URIs.


Parameters:
  name - the property name, which is a fully-qualified URI. the current value of the property.
throws:
  SAXNotRecognizedException - when the XMLReader does notrecognize the property name.
See Also:   SaxWriter.getProperty



parse
public void parse(String systemId) throws SAXException(Code)
Parses an XML document from a system identifier (URI).

This method is a shortcut for the common case of reading a document from a system identifier. It is the exact equivalent of the following:

 parse(new InputSource(systemId));
 

If the system identifier is a URL, it must be fully resolved by the application before it is passed to the parser.

Note: As a custom SAX parser, this class ignores the systemId argument of this method and relies on the proprietary SAX property SaxWriter.SOURCE_OBJECT_LIST_PROPERTY ) to define the list of objects to serialize.


Parameters:
  systemId - the system identifier (URI).
throws:
  SAXException - Any SAX exception, possibly wrappinganother exception.
See Also:   SaxWriter.parse(org.xml.sax.InputSource)



parse
public void parse(InputSource input) throws SAXException(Code)
Parse an XML document.

The application can use this method to instruct the XML reader to begin parsing an XML document from any valid input source (a character stream, a byte stream, or a URI).

Applications may not invoke this method while a parse is in progress (they should create a new XMLReader instead for each nested XML document). Once a parse is complete, an application may reuse the same XMLReader object, possibly with a different input source.

During the parse, the XMLReader will provide information about the XML document through the registered event handlers.

This method is synchronous: it will not return until parsing has ended. If a client application wants to terminate parsing early, it should throw an exception.

Note: As a custom SAX parser, this class ignores the source argument of this method and relies on the proprietary SAX property SaxWriter.SOURCE_OBJECT_LIST_PROPERTY ) to define the list of objects to serialize.


Parameters:
  input - The input source for the top-level of theXML document.
throws:
  SAXException - Any SAX exception, possibly wrappinganother exception.
See Also:   org.xml.sax.InputSource
See Also:   SaxWriter.parse(java.lang.String)
See Also:   SaxWriter.setEntityResolver
See Also:   SaxWriter.setDTDHandler
See Also:   SaxWriter.setContentHandler
See Also:   SaxWriter.setErrorHandler



setContentHandler
public void setContentHandler(ContentHandler handler)(Code)
Allows an application to register a content event handler.

If the application does not register a content handler, all content events reported by the SAX parser will be silently ignored.

Applications may register a new or different handler in the middle of a parse, and the SAX parser must begin using the new handler immediately.


Parameters:
  handler - the content handler.
throws:
  NullPointerException - if the handler argument isnull.
See Also:   SaxWriter.getContentHandler



setDTDHandler
public void setDTDHandler(DTDHandler handler)(Code)
Allows an application to register a DTD event handler.

If the application does not register a DTD handler, all DTD events reported by the SAX parser will be silently ignored.

Applications may register a new or different handler in the middle of a parse, and the SAX parser must begin using the new handler immediately.


Parameters:
  handler - the DTD handler.
throws:
  NullPointerException - if the handler argument isnull.
See Also:   SaxWriter.getDTDHandler



setEntityResolver
public void setEntityResolver(EntityResolver resolver)(Code)
Allows an application to register an entity resolver.

If the application does not register an entity resolver, the XMLReader will perform its own default resolution.

Applications may register a new or different resolver in the middle of a parse, and the SAX parser must begin using the new resolver immediately.


Parameters:
  resolver - the entity resolver.
throws:
  NullPointerException - if the resolver argument isnull.
See Also:   SaxWriter.getEntityResolver



setErrorHandler
public void setErrorHandler(ErrorHandler handler)(Code)
Allows an application to register an error event handler.

If the application does not register an error handler, all error events reported by the SAX parser will be silently ignored; however, normal processing may not continue. It is highly recommended that all SAX applications implement an error handler to avoid unexpected bugs.

Applications may register a new or different handler in the middle of a parse, and the SAX parser must begin using the new handler immediately.


Parameters:
  handler - the error handler.
throws:
  NullPointerException - if the handler argument isnull.
See Also:   SaxWriter.getErrorHandler



setFeature
public void setFeature(String name, boolean value) throws SAXNotRecognizedException(Code)
Sets the state of a feature.

The feature name is any fully-qualified URI.

All XMLReaders are required to support setting http://xml.org/sax/features/namespaces to true and http://xml.org/sax/features/namespace-prefixes to false.

Some feature values may be immutable or mutable only in specific contexts, such as before, during, or after a parse.

Note: This implementation only supports the two mandatory SAX features.


Parameters:
  name - the feature name, which is a fully-qualified URI.
Parameters:
  value - the requested state of the feature (true or false).
throws:
  SAXNotRecognizedException - when the XMLReader does notrecognize the feature name.
See Also:   SaxWriter.getFeature



setProperty
public void setProperty(String name, Object value) throws SAXNotRecognizedException, SAXNotSupportedException(Code)
Sets the value of a property.

The property name is any fully-qualified URI. It is possible for an XMLReader to recognize a property name but to be unable to set its value.

XMLReaders are not required to recognize setting any specific property names, though a core set is provided with SAX2.

Some property values may be immutable or mutable only in specific contexts, such as before, during, or after a parse.

This method is also the standard mechanism for setting extended handlers.

Note: This implementation only supports two (proprietary) properties: SaxWriter.CONFIGURED_XSTREAM_PROPERTY and SaxWriter.SOURCE_OBJECT_LIST_PROPERTY .


Parameters:
  name - the property name, which is a fully-qualified URI.
Parameters:
  value - the requested value for the property.
throws:
  SAXNotRecognizedException - when the XMLReader does notrecognize the property name.
throws:
  SAXNotSupportedException - when the XMLReader recognizesthe property name but cannot setthe requested value.
See Also:   SaxWriter.getProperty



setValue
public void setValue(String text)(Code)



startNode
public void startNode(String name)(Code)



Methods inherited from com.thoughtworks.xstream.io.xml.AbstractXmlWriter
public String escapeXmlName(String name)(Code)(Java Doc)
public void startNode(String name, Class clazz)(Code)(Java Doc)
public HierarchicalStreamWriter underlyingWriter()(Code)(Java Doc)

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.