Java Doc for IndentingXMLStreamWriter.java in  » XML » stax-utils » javanet » staxutils » 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 » stax utils » javanet.staxutils 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   javanet.staxutils.StreamWriterDelegate
      javanet.staxutils.IndentingXMLStreamWriter

IndentingXMLStreamWriter
public class IndentingXMLStreamWriter extends StreamWriterDelegate (Code)
A filter that indents an XML stream. To apply it, construct a filter that contains another XMLStreamWriter , which you pass to the constructor. Then call methods of the filter instead of the contained stream. For example:
XMLStreamWriter  stream = ...
 stream = new 
IndentingXMLStreamWriter (stream);
 stream.writeStartDocument();
 ...
 

The filter inserts characters to format the document as an outline, with nested elements indented. Basically, it inserts a line break and whitespace before:

  • each DTD, processing instruction or comment that's not preceded by data
  • each starting tag that's not preceded by data
  • each ending tag that's preceded by nested elements but not data
This works well with 'data-oriented' XML, wherein each element contains either data or nested elements but not both. It can work badly with other styles of XML. For example, the data in a 'mixed content' document are apt to be polluted with indentation characters.
author:
   John Kristian


Field Summary
final public static  StringDEFAULT_INDENT
     Two spaces; the default indentation.
final public static  StringNORMAL_END_OF_LINE
     "\n"; the normalized representation of end-of-line in XML.

Constructor Summary
public  IndentingXMLStreamWriter(XMLStreamWriter out)
    

Method Summary
protected  voidafterData()
     Note that data were written.
protected  voidafterEndDocument()
     Note that a document was ended.
protected  voidafterEndElement()
     Note that an element was ended.
protected  voidafterMarkup()
     Note that markup or indentation was written.
protected  voidafterStartElement()
     Note that an element was started.
protected  voidbeforeEndElement()
     Prepare to end an element, by writing a new line and indentation.
protected  voidbeforeMarkup()
     Prepare to write markup, by writing a new line and indentation.
protected  voidbeforeStartElement()
     Prepare to start an element, by allocating stack space.
public  StringgetIndent()
    
public static  StringgetLineSeparator()
    
public  StringgetNewLine()
    
public  voidsetIndent(String indent)
     Set the characters for one level of indentation.
public  voidsetNewLine(String newLine)
     Set the characters that introduce a new line.
public  voidwriteCData(String data)
    
public  voidwriteCharacters(String text)
    
public  voidwriteCharacters(char[] text, int start, int len)
    
public  voidwriteComment(String data)
    
public  voidwriteDTD(String dtd)
    
public  voidwriteEmptyElement(String localName)
    
public  voidwriteEmptyElement(String namespaceURI, String localName)
    
public  voidwriteEmptyElement(String prefix, String localName, String namespaceURI)
    
public  voidwriteEndDocument()
    
public  voidwriteEndElement()
    
public  voidwriteEntityRef(String name)
    
protected  voidwriteNewLine(int indentation)
     Write a line separator followed by indentation.
public  voidwriteProcessingInstruction(String target)
    
public  voidwriteProcessingInstruction(String target, String data)
    
public  voidwriteStartDocument()
    
public  voidwriteStartDocument(String version)
    
public  voidwriteStartDocument(String encoding, String version)
    
public  voidwriteStartElement(String localName)
    
public  voidwriteStartElement(String namespaceURI, String localName)
    
public  voidwriteStartElement(String prefix, String localName, String namespaceURI)
    

Field Detail
DEFAULT_INDENT
final public static String DEFAULT_INDENT(Code)
Two spaces; the default indentation.



NORMAL_END_OF_LINE
final public static String NORMAL_END_OF_LINE(Code)
"\n"; the normalized representation of end-of-line in XML.




Constructor Detail
IndentingXMLStreamWriter
public IndentingXMLStreamWriter(XMLStreamWriter out)(Code)




Method Detail
afterData
protected void afterData()(Code)
Note that data were written.



afterEndDocument
protected void afterEndDocument()(Code)
Note that a document was ended.



afterEndElement
protected void afterEndElement()(Code)
Note that an element was ended.



afterMarkup
protected void afterMarkup()(Code)
Note that markup or indentation was written.



afterStartElement
protected void afterStartElement()(Code)
Note that an element was started.



beforeEndElement
protected void beforeEndElement()(Code)
Prepare to end an element, by writing a new line and indentation.



beforeMarkup
protected void beforeMarkup()(Code)
Prepare to write markup, by writing a new line and indentation.



beforeStartElement
protected void beforeStartElement()(Code)
Prepare to start an element, by allocating stack space.



getIndent
public String getIndent()(Code)



getLineSeparator
public static String getLineSeparator()(Code)
System.getProperty("line.separator"); orIndentingXMLStreamWriter.NORMAL_END_OF_LINE if that fails.



getNewLine
public String getNewLine()(Code)



setIndent
public void setIndent(String indent)(Code)
Set the characters for one level of indentation. The default is IndentingXMLStreamWriter.DEFAULT_INDENT . "\t" is a popular alternative.



setNewLine
public void setNewLine(String newLine)(Code)
Set the characters that introduce a new line. The default is IndentingXMLStreamWriter.NORMAL_END_OF_LINE . IndentingXMLStreamWriter.getLineSeparator () is a popular alternative.



writeCData
public void writeCData(String data) throws XMLStreamException(Code)



writeCharacters
public void writeCharacters(String text) throws XMLStreamException(Code)



writeCharacters
public void writeCharacters(char[] text, int start, int len) throws XMLStreamException(Code)



writeComment
public void writeComment(String data) throws XMLStreamException(Code)



writeDTD
public void writeDTD(String dtd) throws XMLStreamException(Code)



writeEmptyElement
public void writeEmptyElement(String localName) throws XMLStreamException(Code)



writeEmptyElement
public void writeEmptyElement(String namespaceURI, String localName) throws XMLStreamException(Code)



writeEmptyElement
public void writeEmptyElement(String prefix, String localName, String namespaceURI) throws XMLStreamException(Code)



writeEndDocument
public void writeEndDocument() throws XMLStreamException(Code)



writeEndElement
public void writeEndElement() throws XMLStreamException(Code)



writeEntityRef
public void writeEntityRef(String name) throws XMLStreamException(Code)



writeNewLine
protected void writeNewLine(int indentation) throws XMLStreamException(Code)
Write a line separator followed by indentation.



writeProcessingInstruction
public void writeProcessingInstruction(String target) throws XMLStreamException(Code)



writeProcessingInstruction
public void writeProcessingInstruction(String target, String data) throws XMLStreamException(Code)



writeStartDocument
public void writeStartDocument() throws XMLStreamException(Code)



writeStartDocument
public void writeStartDocument(String version) throws XMLStreamException(Code)



writeStartDocument
public void writeStartDocument(String encoding, String version) throws XMLStreamException(Code)



writeStartElement
public void writeStartElement(String localName) throws XMLStreamException(Code)



writeStartElement
public void writeStartElement(String namespaceURI, String localName) throws XMLStreamException(Code)



writeStartElement
public void writeStartElement(String prefix, String localName, String namespaceURI) throws XMLStreamException(Code)



Fields inherited from javanet.staxutils.StreamWriterDelegate
protected XMLStreamWriter out(Code)(Java Doc)

Methods inherited from javanet.staxutils.StreamWriterDelegate
public void close() throws XMLStreamException(Code)(Java Doc)
public void flush() throws XMLStreamException(Code)(Java Doc)
public NamespaceContext getNamespaceContext()(Code)(Java Doc)
public String getPrefix(String uri) throws XMLStreamException(Code)(Java Doc)
public Object getProperty(String name) throws IllegalArgumentException(Code)(Java Doc)
public void setDefaultNamespace(String uri) throws XMLStreamException(Code)(Java Doc)
public void setNamespaceContext(NamespaceContext context) throws XMLStreamException(Code)(Java Doc)
public void setPrefix(String prefix, String uri) throws XMLStreamException(Code)(Java Doc)
public void writeAttribute(String localName, String value) throws XMLStreamException(Code)(Java Doc)
public void writeAttribute(String namespaceURI, String localName, String value) throws XMLStreamException(Code)(Java Doc)
public void writeAttribute(String prefix, String namespaceURI, String localName, String value) throws XMLStreamException(Code)(Java Doc)
public void writeCData(String data) throws XMLStreamException(Code)(Java Doc)
public void writeCharacters(String text) throws XMLStreamException(Code)(Java Doc)
public void writeCharacters(char[] text, int start, int len) throws XMLStreamException(Code)(Java Doc)
public void writeComment(String data) throws XMLStreamException(Code)(Java Doc)
public void writeDTD(String dtd) throws XMLStreamException(Code)(Java Doc)
public void writeDefaultNamespace(String namespaceURI) throws XMLStreamException(Code)(Java Doc)
public void writeEmptyElement(String localName) throws XMLStreamException(Code)(Java Doc)
public void writeEmptyElement(String namespaceURI, String localName) throws XMLStreamException(Code)(Java Doc)
public void writeEmptyElement(String prefix, String localName, String namespaceURI) throws XMLStreamException(Code)(Java Doc)
public void writeEndDocument() throws XMLStreamException(Code)(Java Doc)
public void writeEndElement() throws XMLStreamException(Code)(Java Doc)
public void writeEntityRef(String name) throws XMLStreamException(Code)(Java Doc)
public void writeNamespace(String prefix, String namespaceURI) throws XMLStreamException(Code)(Java Doc)
public void writeProcessingInstruction(String target) throws XMLStreamException(Code)(Java Doc)
public void writeProcessingInstruction(String target, String data) throws XMLStreamException(Code)(Java Doc)
public void writeStartDocument() throws XMLStreamException(Code)(Java Doc)
public void writeStartDocument(String version) throws XMLStreamException(Code)(Java Doc)
public void writeStartDocument(String encoding, String version) throws XMLStreamException(Code)(Java Doc)
public void writeStartElement(String localName) throws XMLStreamException(Code)(Java Doc)
public void writeStartElement(String namespaceURI, String localName) throws XMLStreamException(Code)(Java Doc)
public void writeStartElement(String prefix, String localName, String namespaceURI) throws XMLStreamException(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.