Java Doc for XMLPrinter.java in  » J2EE » Expresso » com » jcorporate » expresso » ext » report » 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 » J2EE » Expresso » com.jcorporate.expresso.ext.report 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   com.jcorporate.expresso.ext.report.XMLPrinter

All known Subclasses:   com.jcorporate.expresso.ext.report.DocBookPrinter,
XMLPrinter
public class XMLPrinter implements ErrorHandler,DOMWriter(Code)
XMLPrinter is a simple (DOM) parser that outputs XML to a Writer stream.
author:
   David Lloyd


Field Summary
final public static  StringDEFAULT_INDENT
    
final public static  OutputStreamWriterSYSTEM_OUT
    
protected  int_column
     The current indention level.
protected  String_indent
     The indention prefix string.
protected  char_indentChar
     The character to use for indenting.
protected  int_indentLength
     The virtual area occupied by an indention.
protected  String_newline
     The character sequence for a newline.
protected  boolean_omitXmlDecl
     Set to keep the <?xml ...
protected  Writer_out
     The writer that will contain the XML written.
protected static  Loggerlog
    

Constructor Summary
public  XMLPrinter()
    

Method Summary
public  voidcloseWriter()
     Closes the output writer ignoring any errors recieved.
protected  StringconvertNewline(String text)
     Convert newlines to what we want.
protected static  voidcopyFile(File in, File out)
    
public  voiderror(SAXParseException ex)
    
public  voidfatalError(SAXParseException ex)
     Fatal error.
protected  StringgetIndent(int col)
     Get the normal indentation for a level.
public  StringgetRequiredClass()
     Retrieve a class that must exist in the classpath for this to work.
public  WritergetWriter()
     Get the output writer.
public static  voidmain(String[] args)
    
public static  StringnodeToString(Node node)
     Return the given node as a string.
public  voidoutputDocument(Node node)
     Output the document whose root element is the specified node.
public  voidprint(String string, String indent)
     Prints the string to the output at an indentation.
public  voidprint(String string)
     Prints the string to the output.
protected  voidprintTree(Node node, int col)
     Output the node (and children) at the specified indentation level.
protected  voidprintTree(Node node)
     Output the node (and children) at the current indentation level.
public  voidprintln(String string, String indent)
     Prints the string to the output at an indentation following it with a newline.
public  voidprintln(String string)
     Prints the string to the output following it with a newline.
public static  intrun(String[] args, XMLPrinter printer)
    
public static  intrun(String[] args)
    
public  voidsaveDocument(OutputStream os, Document document)
    
public  voidsetFile(File file)
     Creates an output writer that will create the file specified and any parent directories needed to do so.
public  voidsetFile(String filename)
     Creates an output writer that will create the file specified and any parent directories needed to do so.
public  voidsetIndent(char indentChar, int size)
     Set the indent semantics.
public  voidsetIndentSize(int indentSize)
     Set the indentation size to the number of characters specified using the current indent character.
public  voidsetOmitXmlDecl(boolean b)
     Set whether the xml declaration should be output at the start of a document.
public  voidsetWriter(Writer out)
     Set the output writer.
public static  StringtoXML(String html)
    
public static  StringtoXML(String html, boolean escapeAll)
     Parse an string and convert it to xml style
Parameters:
  html - The string to be parsed
Parameters:
  escapeAll - If false, the semicolon, apostrophe, and quote are left alone (useful for text nodes).
public  voidwarning(SAXParseException ex)
    

Field Detail
DEFAULT_INDENT
final public static String DEFAULT_INDENT(Code)



SYSTEM_OUT
final public static OutputStreamWriter SYSTEM_OUT(Code)



_column
protected int _column(Code)
The current indention level.



_indent
protected String _indent(Code)
The indention prefix string.



_indentChar
protected char _indentChar(Code)
The character to use for indenting.



_indentLength
protected int _indentLength(Code)
The virtual area occupied by an indention.



_newline
protected String _newline(Code)
The character sequence for a newline.



_omitXmlDecl
protected boolean _omitXmlDecl(Code)
Set to keep the <?xml ... header from printing.



_out
protected Writer _out(Code)
The writer that will contain the XML written.



log
protected static Logger log(Code)




Constructor Detail
XMLPrinter
public XMLPrinter()(Code)




Method Detail
closeWriter
public void closeWriter()(Code)
Closes the output writer ignoring any errors recieved. You are encouraged to close the writer yourself to recieve any errors encountered.



convertNewline
protected String convertNewline(String text)(Code)
Convert newlines to what we want.



copyFile
protected static void copyFile(File in, File out) throws IOException(Code)



error
public void error(SAXParseException ex)(Code)
Issue an error
Parameters:
  ex - A Sax Parse Exception event



fatalError
public void fatalError(SAXParseException ex) throws SAXException(Code)
Fatal error. Used Internally for parsing only
Parameters:
  ex - A Sax Parse Exception event
throws:
  SAXException - after logging the Parsing Exception



getIndent
protected String getIndent(int col)(Code)
Get the normal indentation for a level.
Parameters:
  col - The level of indentation.



getRequiredClass
public String getRequiredClass()(Code)
Retrieve a class that must exist in the classpath for this to work. Used as a sanity check to make sure the appropriate jars are installed. java.lang.String a name of a class



getWriter
public Writer getWriter()(Code)
Get the output writer.



main
public static void main(String[] args)(Code)



nodeToString
public static String nodeToString(Node node)(Code)
Return the given node as a string. If any error occurs in processing (likely an io exception from outputDocument()), null will be returned.



outputDocument
public void outputDocument(Node node) throws IOException(Code)
Output the document whose root element is the specified node.



print
public void print(String string, String indent) throws IOException(Code)
Prints the string to the output at an indentation.
Parameters:
  string - The string to print.
Parameters:
  indent - The indentation to prefix the string.



print
public void print(String string) throws IOException(Code)
Prints the string to the output.
Parameters:
  string - The string to print.



printTree
protected void printTree(Node node, int col) throws IOException(Code)
Output the node (and children) at the specified indentation level.



printTree
protected void printTree(Node node) throws IOException(Code)
Output the node (and children) at the current indentation level.



println
public void println(String string, String indent) throws IOException(Code)
Prints the string to the output at an indentation following it with a newline.
Parameters:
  string - The string to print.
Parameters:
  indent - The indentation to prefix the string.



println
public void println(String string) throws IOException(Code)
Prints the string to the output following it with a newline.
Parameters:
  string - The string to print.



run
public static int run(String[] args, XMLPrinter printer)(Code)



run
public static int run(String[] args)(Code)



saveDocument
public void saveDocument(OutputStream os, Document document) throws ExpressoRuntimeException(Code)
Override to actually save a DOM document to the output stream via whatever method you desire
Parameters:
  os - The output stream to save to
Parameters:
  document - the DOM document representing the config.
throws:
  ExpressoRuntimeException - if there's an error saving the file.



setFile
public void setFile(File file) throws IOException(Code)
Creates an output writer that will create the file specified and any parent directories needed to do so.



setFile
public void setFile(String filename) throws IOException(Code)
Creates an output writer that will create the file specified and any parent directories needed to do so.



setIndent
public void setIndent(char indentChar, int size)(Code)
Set the indent semantics.
Parameters:
  indentChar - The character to use for indentions.
Parameters:
  size - The number of characters to use for each indention level.



setIndentSize
public void setIndentSize(int indentSize)(Code)
Set the indentation size to the number of characters specified using the current indent character.



setOmitXmlDecl
public void setOmitXmlDecl(boolean b)(Code)
Set whether the xml declaration should be output at the start of a document.



setWriter
public void setWriter(Writer out)(Code)
Set the output writer.



toXML
public static String toXML(String html)(Code)
Parse an string and convert it to xml style
Parameters:
  html - The string to be parsed The resulting xml string



toXML
public static String toXML(String html, boolean escapeAll)(Code)
Parse an string and convert it to xml style
Parameters:
  html - The string to be parsed
Parameters:
  escapeAll - If false, the semicolon, apostrophe, and quote are left alone (useful for text nodes). The resulting xml string



warning
public void warning(SAXParseException ex)(Code)
Issue a warning on parsing errors
Parameters:
  ex - A Sax Parse Exception event



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.