Java Doc for XmlPrinter.java in  » EJB-Server-resin-3.1.5 » resin » com » caucho » 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 » EJB Server resin 3.1.5 » resin » com.caucho.xml 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   com.caucho.xml.XmlPrinter

XmlPrinter
public class XmlPrinter implements XMLWriter(Code)
Controls printing of XML documents. Typical use:
 Node node = ...;
 OutputStream os = Vfs.openWrite("test.xml");
 XmlPrinter printer = new XmlPrinter(os);
 printer.printXml(node);
 


Field Summary
final static  L10NL
    
 String_encoding
    
 boolean_escapeText
    
 boolean_hasMetaContentType
    
 boolean_inHead
    
 boolean_inVerbatim
    
 boolean_includeContentType
    
 int_indent
    
 boolean_isAutomaticMethod
    
 boolean_isAutomaticPretty
    
 boolean_isHtml
    
 boolean_isJsp
    
 boolean_isPretty
    
 boolean_isText
    
 boolean_isTop
    
 int_lastTextChar
    
 String_method
    
 int_preCount
    
 boolean_printDeclaration
    
 String_publicId
    
 String_standalone
    
 String_systemId
    
 String_version
    
final static  Loggerlog
    

Constructor Summary
public  XmlPrinter()
     Create an XmlPrinter.
public  XmlPrinter(OutputStream os)
     Creates a new XmlPrinter writing to an output stream.
public  XmlPrinter(Writer writer)
     Creates a new XmlPrinter writing to a writer.

Method Summary
static  voidadd(IntMap map, String name, int value)
    
static  voidadd(HashMap<String, String> map, String name)
    
public  voidaddCdataElement(String elt)
    
public  voidattribute(String uri, String localName, String qName, String value)
    
public  voidcdata(String text)
    
public  voidcdata(char[] buffer, int offset, int length)
    
public  voidcomment(String data)
    
public  voidendDocument()
    
public  voidendElement(String uri, String localName, String qName)
    
public  voidendPrefixMapping(String prefix)
    
public  booleanfinishAttributes()
     Complete printing of the attributes when the open tag completes.
public  booleangetEscapeText()
    
public  booleangetEscaping()
     Returns the current XML escaping.
public  booleangetIncludeContentType()
     Return true if the printer should automatically add the <meta content-type> to HTML.
public  LineMapgetLineMap()
    
public  PathgetPath()
    
 booleangetPrintDeclaration()
    
 StringgetPublicId()
    
 StringgetStandalone()
    
 WriteStreamgetStream()
    
 StringgetSystemId()
    
public  voidinit(WriteStream os)
     Initialize the XmlPrinter with the write stream.
 voidinit()
     Initialize the XmlWriter in preparation for serializing a new XML.
 booleanisHtml()
     Returns true if the printer is printing HTML.
public  booleanisJSP()
     True if this is JSP special cased.
public  booleanisPretty()
     Returns true if the printer is currently pretty-printing the output.
public static  voidprint(Path path, Node node)
     Prints the node as XML.
public  voidprint(Node node)
    
 voidprint(char[] buf)
     Prints a char buffer.
 voidprint(char[] buf, int off, int len)
     Prints a char buffer.
 voidprint(String text)
     Prints a chunk of text.
 voidprint(char ch)
     Prints a character.
 voidprint(int i)
     Prints an integer to the output stream.
 voidprintDecl(String text)
    
public  voidprintHeader(String top)
     Prints the header, if necessary.
public  voidprintHtml(Node node)
    
public  voidprintNode(Node node)
    
public  voidprintPrettyXml(Node node)
    
public  StringprintString(Node node)
     Prints the node as XML to a string.
public  voidprintXml(Node node)
     Prints the node as XML.
 voidprintln()
     Prints a newline to the output stream.
 voidprintln(String text)
    
public  voidprocessingInstruction(String name, String data)
    
public  voidsetDocumentLocator(Locator locator)
     Sets the locator.
public  voidsetEncoding(String encoding)
     Sets the character set encoding for the output file.
public  voidsetEscapeText(boolean isEscaped)
     Sets true if the text should be escaped, else it will be printed verbatim.
public  voidsetEscaping(boolean escapeText)
     Sets to true if XML entities like < should be escaped as &lt;.
public  voidsetIncludeContentType(boolean include)
     Set true if the printer should automatically add the <meta content-type> to HTML.
public  voidsetJSP(boolean isJsp)
     Set true if this is JSP special cased.
public  voidsetLineMap(String filename)
     Creates a new line map.
public  voidsetLocation(String filename, int line, int column)
     Sets the current location.
public  voidsetMethod(String method)
     Sets the output methods, like the XSL <xsl:output method='method'/>.
public  voidsetMimeType(String mimeType)
    
public  voidsetPretty(boolean isPretty)
     Set to true if the printer should add whitespace to 'pretty-print' the output.
public  voidsetPrintDeclaration(boolean printDeclaration)
    
public  voidsetPublicId(String id)
    
public  voidsetStandalone(String standalone)
    
public  voidsetSystemId(String id)
    
public  voidsetVersion(String version)
     Sets the XML/HTML version of the output file.
public  voidstartDocument(Document document)
    
public  voidstartDocument()
     Callback when the document starts printing.
public  voidstartElement(String url, String localName, String qName)
     Called at the start of a new element.
public  voidstartPrefixMapping(String prefix, String uri)
    
public  voidtext(String text)
     Prints text.
public  voidtext(char[] buffer, int offset, int length)
     Prints text.
 booleantrimPrettyWhitespace(char[] buffer, int offset, int length)
     If the text is completely whitespace, skip it.

Field Detail
L
final static L10N L(Code)



_encoding
String _encoding(Code)



_escapeText
boolean _escapeText(Code)



_hasMetaContentType
boolean _hasMetaContentType(Code)



_inHead
boolean _inHead(Code)



_inVerbatim
boolean _inVerbatim(Code)



_includeContentType
boolean _includeContentType(Code)



_indent
int _indent(Code)



_isAutomaticMethod
boolean _isAutomaticMethod(Code)



_isAutomaticPretty
boolean _isAutomaticPretty(Code)



_isHtml
boolean _isHtml(Code)



_isJsp
boolean _isJsp(Code)



_isPretty
boolean _isPretty(Code)



_isText
boolean _isText(Code)



_isTop
boolean _isTop(Code)



_lastTextChar
int _lastTextChar(Code)



_method
String _method(Code)



_preCount
int _preCount(Code)



_printDeclaration
boolean _printDeclaration(Code)



_publicId
String _publicId(Code)



_standalone
String _standalone(Code)



_systemId
String _systemId(Code)



_version
String _version(Code)



log
final static Logger log(Code)




Constructor Detail
XmlPrinter
public XmlPrinter()(Code)
Create an XmlPrinter. Using this API, you'll need to use printer.init(os) to assign an output stream.



XmlPrinter
public XmlPrinter(OutputStream os)(Code)
Creates a new XmlPrinter writing to an output stream.
Parameters:
  os - output stream serving as the destination



XmlPrinter
public XmlPrinter(Writer writer)(Code)
Creates a new XmlPrinter writing to a writer.
Parameters:
  writer - destination of the serialized node




Method Detail
add
static void add(IntMap map, String name, int value)(Code)



add
static void add(HashMap<String, String> map, String name)(Code)



addCdataElement
public void addCdataElement(String elt)(Code)



attribute
public void attribute(String uri, String localName, String qName, String value) throws IOException(Code)
Prints an attribute
Parameters:
  uri - namespace uri
Parameters:
  localName - localname of the attribute
Parameters:
  qName - qualified name of the attribute
Parameters:
  value - value of the attribute.



cdata
public void cdata(String text) throws IOException(Code)



cdata
public void cdata(char[] buffer, int offset, int length) throws IOException(Code)



comment
public void comment(String data) throws IOException(Code)
Prints a comment
Parameters:
  data - the comment data



endDocument
public void endDocument() throws IOException(Code)
Callback when the document completes



endElement
public void endElement(String uri, String localName, String qName) throws IOException(Code)
Prints the end tag of an element
Parameters:
  uri - the namespace uri of the element
Parameters:
  localName - the localname of the element tag
Parameters:
  qName - qualified name of the element



endPrefixMapping
public void endPrefixMapping(String prefix) throws IOException(Code)



finishAttributes
public boolean finishAttributes() throws IOException(Code)
Complete printing of the attributes when the open tag completes.



getEscapeText
public boolean getEscapeText()(Code)
Returns true if the text is currently being escaped



getEscaping
public boolean getEscaping()(Code)
Returns the current XML escaping. If true, entities like < will be escaped as &lt;. true if entities should be escaped.



getIncludeContentType
public boolean getIncludeContentType()(Code)
Return true if the printer should automatically add the <meta content-type> to HTML.



getLineMap
public LineMap getLineMap()(Code)



getPath
public Path getPath()(Code)



getPrintDeclaration
boolean getPrintDeclaration()(Code)



getPublicId
String getPublicId()(Code)



getStandalone
String getStandalone()(Code)



getStream
WriteStream getStream()(Code)



getSystemId
String getSystemId()(Code)



init
public void init(WriteStream os)(Code)
Initialize the XmlPrinter with the write stream.
Parameters:
  os - WriteStream containing the results.



init
void init()(Code)
Initialize the XmlWriter in preparation for serializing a new XML.



isHtml
boolean isHtml()(Code)
Returns true if the printer is printing HTML.



isJSP
public boolean isJSP()(Code)
True if this is JSP special cased.



isPretty
public boolean isPretty()(Code)
Returns true if the printer is currently pretty-printing the output.



print
public static void print(Path path, Node node) throws IOException(Code)
Prints the node as XML. The destination stream has already been set using init() or in the constructor.
Parameters:
  node - source DOM node



print
public void print(Node node) throws IOException(Code)



print
void print(char[] buf) throws IOException(Code)
Prints a char buffer.



print
void print(char[] buf, int off, int len) throws IOException(Code)
Prints a char buffer.



print
void print(String text) throws IOException(Code)
Prints a chunk of text.



print
void print(char ch) throws IOException(Code)
Prints a character.



print
void print(int i) throws IOException(Code)
Prints an integer to the output stream.



printDecl
void printDecl(String text) throws IOException(Code)



printHeader
public void printHeader(String top) throws IOException(Code)
Prints the header, if necessary.
Parameters:
  top - name of the top element



printHtml
public void printHtml(Node node) throws IOException(Code)
Prints the node and children as HTML
Parameters:
  node - the top node to print



printNode
public void printNode(Node node) throws IOException(Code)



printPrettyXml
public void printPrettyXml(Node node) throws IOException(Code)
Prints the node and children as XML, automatically indending
Parameters:
  node - the top node to print



printString
public String printString(Node node) throws IOException(Code)
Prints the node as XML to a string.
Parameters:
  node - the source node a string containing the XML.



printXml
public void printXml(Node node) throws IOException(Code)
Prints the node as XML. The destination stream has already been set using init() or in the constructor.
Parameters:
  node - source DOM node



println
void println() throws IOException(Code)
Prints a newline to the output stream.



println
void println(String text) throws IOException(Code)



processingInstruction
public void processingInstruction(String name, String data) throws IOException(Code)
Prints a processing instruction
Parameters:
  name - the name of the processing instruction
Parameters:
  data - the processing instruction data



setDocumentLocator
public void setDocumentLocator(Locator locator)(Code)
Sets the locator.



setEncoding
public void setEncoding(String encoding)(Code)
Sets the character set encoding for the output file.
Parameters:
  encoding - the mime name of the output encoding



setEscapeText
public void setEscapeText(boolean isEscaped)(Code)
Sets true if the text should be escaped, else it will be printed verbatim.



setEscaping
public void setEscaping(boolean escapeText)(Code)
Sets to true if XML entities like < should be escaped as &lt;. The default is true.
Parameters:
  escapeText - set to true if entities should be escaped.



setIncludeContentType
public void setIncludeContentType(boolean include)(Code)
Set true if the printer should automatically add the <meta content-type> to HTML.



setJSP
public void setJSP(boolean isJsp)(Code)
Set true if this is JSP special cased.



setLineMap
public void setLineMap(String filename)(Code)
Creates a new line map.



setLocation
public void setLocation(String filename, int line, int column)(Code)
Sets the current location.
Parameters:
  filename - the source filename
Parameters:
  line - the source line
Parameters:
  column - the source column



setMethod
public void setMethod(String method)(Code)
Sets the output methods, like the XSL <xsl:output method='method'/>.



setMimeType
public void setMimeType(String mimeType)(Code)



setPretty
public void setPretty(boolean isPretty)(Code)
Set to true if the printer should add whitespace to 'pretty-print' the output.
Parameters:
  isPretty - if true, add spaces for printing



setPrintDeclaration
public void setPrintDeclaration(boolean printDeclaration)(Code)



setPublicId
public void setPublicId(String id)(Code)



setStandalone
public void setStandalone(String standalone)(Code)



setSystemId
public void setSystemId(String id)(Code)



setVersion
public void setVersion(String version)(Code)
Sets the XML/HTML version of the output file.
Parameters:
  version - the output version



startDocument
public void startDocument(Document document) throws IOException(Code)



startDocument
public void startDocument() throws IOException(Code)
Callback when the document starts printing.



startElement
public void startElement(String url, String localName, String qName) throws IOException(Code)
Called at the start of a new element.
Parameters:
  url - the namespace url
Parameters:
  localName - the local name
Parameters:
  qName - the qualified name



startPrefixMapping
public void startPrefixMapping(String prefix, String uri) throws IOException(Code)



text
public void text(String text) throws IOException(Code)
Prints text. If the text is escaped, codes like < will be printed as &lt;.



text
public void text(char[] buffer, int offset, int length) throws IOException(Code)
Prints text. If the text is escaped, codes like < will be printed as &lt;.



trimPrettyWhitespace
boolean trimPrettyWhitespace(char[] buffer, int offset, int length)(Code)
If the text is completely whitespace, skip it.



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.