Java Doc for IndentingXMLStreamWriter.java in  » XML » stax-utils » javanet » staxutils » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Home
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
26.ERP CRM Financial
27.ESB
28.Forum
29.Game
30.GIS
31.Graphic 3D
32.Graphic Library
33.Groupware
34.HTML Parser
35.IDE
36.IDE Eclipse
37.IDE Netbeans
38.Installer
39.Internationalization Localization
40.Inversion of Control
41.Issue Tracking
42.J2EE
43.J2ME
44.JBoss
45.JMS
46.JMX
47.Library
48.Mail Clients
49.Music
50.Net
51.Parser
52.PDF
53.Portal
54.Profiler
55.Project Management
56.Report
57.RSS RDF
58.Rule Engine
59.Science
60.Scripting
61.Search Engine
62.Security
63.Sevlet Container
64.Source Control
65.Swing Library
66.Template Engine
67.Test Coverage
68.Testing
69.UML
70.Web Crawler
71.Web Framework
72.Web Mail
73.Web Server
74.Web Services
75.Web Services apache cxf 2.2.6
76.Web Services AXIS2
77.Wiki Engine
78.Workflow Engines
79.XML
80.XML UI
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)

ww_w__.___j__a_v__a___2_s._c_om___ | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.