|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.groiss.gui.HTMLOutputter
public class HTMLOutputter
| Field Summary | |
|---|---|
protected static java.lang.String |
STANDARD_INDENT
standard value to indent by, if we are indenting, is two spaces |
| Constructor Summary | |
|---|---|
HTMLOutputter()
default constructor |
|
| Method Summary | |
|---|---|
protected java.lang.String |
escapeAttributeEntities(java.lang.String st)
This will take the pre-defined entities in XML 1.0 and convert their character representation to the appropriate entity reference, suitable for XML attributes. |
protected java.lang.String |
escapeElementEntities(java.lang.String st)
This will take the three pre-defined entities in XML 1.0 (used specifically in XML elements) and convert their character representation to the appropriate entity reference, suitable for XML element. |
protected java.lang.String |
escapeTextEntities(java.lang.String st)
only escape ampersand |
protected void |
indent(java.io.Writer out,
int level)
This will print the proper indent characters for the given indent level. |
protected java.io.Writer |
makeWriter(java.io.OutputStream out)
Get an OutputStreamWriter, use preferred encoding. |
protected java.io.Writer |
makeWriter(java.io.OutputStream out,
java.lang.String enc)
Get an OutputStreamWriter, use specified encoding. |
protected void |
maybePrintln(java.io.Writer out)
This will print a new line only if the newlines flag was set to true |
void |
output(org.jdom.Comment comment,
java.io.OutputStream out)
Print out a
|
void |
output(org.jdom.Comment comment,
java.io.Writer out)
Print out a
|
void |
output(org.jdom.Document doc,
java.io.OutputStream out)
This will print the Document to the given output stream. |
void |
output(org.jdom.Document doc,
java.io.Writer out)
This will print the Document to the given
Writer. |
void |
output(org.jdom.Element element,
java.io.OutputStream out)
Print out an , including
its s, and its value, and all
contained (child) elements etc. |
void |
output(org.jdom.Element element,
java.io.Writer out)
Print out an , including
its s, and its value, and all
contained (child) elements etc. |
void |
output(java.lang.String string,
java.io.OutputStream out)
Print out a . |
void |
output(java.lang.String string,
java.io.Writer out)
Print out a . |
void |
output(org.jdom.Text text,
java.io.OutputStream out)
Print out a . |
void |
output(org.jdom.Text text,
java.io.Writer out)
Print out a . |
void |
outputElementContent(org.jdom.Element element,
java.io.OutputStream out)
This will handle printing out an 's content only, not including its tag, and
attributes. |
void |
outputElementContent(org.jdom.Element element,
java.io.Writer out)
This will handle printing out an 's content only, not including its tag, and
attributes. |
java.lang.String |
outputString(org.jdom.Comment comment)
Return a string representing a comment. |
java.lang.String |
outputString(org.jdom.Document doc)
Return a string representing a document. |
java.lang.String |
outputString(org.jdom.Element element)
Return a string representing an element. |
protected void |
printAttributes(java.util.List attributes,
org.jdom.Element parent,
java.io.Writer out)
This will handle printing out an list. |
protected void |
printComment(org.jdom.Comment comment,
java.io.Writer out)
This will write the comment to the specified writer. |
protected void |
printElement(org.jdom.Element element,
java.io.Writer out,
int indentLevel)
This will handle printing out an ,
its s, and its value. |
protected void |
printElementContent(org.jdom.Element element,
java.io.Writer out,
int indentLevel,
java.util.List eltContent)
This will handle printing out an 's content only, not including its tag,
attributes, and namespace info. |
void |
printRawElement(RawElement element,
java.io.Writer out)
|
protected void |
printString(java.lang.String s,
java.io.Writer out)
Print a string. |
void |
setEncoding(java.lang.String encoding)
Sets the output encoding. |
void |
setExpandEmptyElements(boolean expandEmptyElements)
This will set whether empty elements are expanded from <tagName> to
<tagName></tagName>. |
void |
setIndent(boolean doIndent)
Set the indent on or off. |
void |
setIndent(java.lang.String indent)
This will set the indent String to use; this
is usually a String of empty spaces. |
void |
setIndentSize(int indentSize)
This will set the indent String's size; an indentSize
of 4 would result in the indentation being equivalent to the
String " " (four space chars). |
void |
setLineSeparator(java.lang.String separator)
This will set the new-line separator. |
void |
setNewlines(boolean newlines)
|
void |
setOmitEncoding(boolean omitEncoding)
This will set whether the XML declaration ( <? |
void |
setTextNormalize(boolean textNormalize)
This will set whether the text is output verbatim (false) or with whitespace normalized as per . |
void |
setTrimText(boolean textTrim)
Deprecated. Deprecated in beta7, use setTextNormalize() instead |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected static final java.lang.String STANDARD_INDENT
| Constructor Detail |
|---|
public HTMLOutputter()
| Method Detail |
|---|
public void setLineSeparator(java.lang.String separator)
This will set the new-line separator. The default is
\r\n. Note that if the "newlines" property is
false, this value is irrelevant. To make it output the system
default line ending string, call
setLineSeparator(System.getProperty("line.separator"))
To output "UNIX-style" documents, call
setLineSeparator("\n"). To output "Mac-style"
documents, call setLineSeparator("\r"). DOS-style
documents use CR-LF ("\r\n"), which is the default.
Note that this only applies to newlines generated by the
outputter. If you parse an XML document that contains newlines
embedded inside a text node, and you do not call
setTextNormalize, then the newlines will be output
verbatim, as "\n" which is how parsers normalize them.
separator - String line separator to use.setNewlines(boolean),
setTextNormalize(boolean)public void setNewlines(boolean newlines)
newlines - true indicates new lines should be
printed, else new lines are ignored (compacted).setLineSeparator(String)public void setEncoding(java.lang.String encoding)
encoding - the encoding format. Use XML-style names like
"UTF-8" or "ISO-8859-1" or "US-ASCII"public void setOmitEncoding(boolean omitEncoding)
This will set whether the XML declaration
(<?xml version="1.0" encoding="UTF-8"?>)
includes the encoding of the document. It is common to omit
this in uses such as WML and other wireless device protocols.
omitEncoding - boolean indicating whether or not
the XML declaration should indicate the document encoding.public void setExpandEmptyElements(boolean expandEmptyElements)
This will set whether empty elements are expanded from
<tagName> to
<tagName></tagName>.
expandEmptyElements - boolean indicating whether or not
empty elements should be expanded.public void setTextNormalize(boolean textNormalize)
This will set whether the text is output verbatim (false)
or with whitespace normalized as per .Element.getTextNormalize()
Default: false
textNormalize - boolean true=>normalize the
whitespace, false=>use text verbatimpublic void setTrimText(boolean textTrim)
This will set whether the text is output verbatim (false) or with whitespace stripped.
Default: false
textTrim - boolean true=>trim the whitespace,
false=>use text verbatimpublic void setIndent(java.lang.String indent)
This will set the indent String to use; this
is usually a String of empty spaces. If you pass
null, or the empty string (""), then no indentation will
happen.
indent - String to use for indentation.public void setIndent(boolean doIndent)
doIndent - if true, set indenting on; if false, set indenting offpublic void setIndentSize(int indentSize)
This will set the indent String's size; an indentSize
of 4 would result in the indentation being equivalent to the
String " " (four space chars).
indentSize - int number of spaces in indentation.
protected void indent(java.io.Writer out,
int level)
throws java.io.IOException
This will print the proper indent characters for the given indent level.
out - Writer to write tolevel - int indentation level
java.io.IOException
protected void maybePrintln(java.io.Writer out)
throws java.io.IOException
This will print a new line only if the newlines flag was set to true
out - Writer to write to
java.io.IOException
protected java.io.Writer makeWriter(java.io.OutputStream out)
throws java.io.UnsupportedEncodingException
java.io.UnsupportedEncodingException
protected java.io.Writer makeWriter(java.io.OutputStream out,
java.lang.String enc)
throws java.io.UnsupportedEncodingException
java.io.UnsupportedEncodingException
public void output(org.jdom.Document doc,
java.io.OutputStream out)
throws java.io.IOException
This will print the Document to the given output stream.
The characters are printed using the encoding specified in the
constructor, or a default of UTF-8.
doc - Document to format.out - OutputStream to write to.
java.io.IOException - - if there's any problem writing.
public void output(org.jdom.Document doc,
java.io.Writer out)
throws java.io.IOException
This will print the Document to the given
Writer.
Warning: using your own Writer may cause the outputter's preferred character encoding to be ignored. If you use encodings other than UTF-8, we recommend using the method that takes an OutputStream instead.
doc - Document to format.out - Writer to write to.
java.io.IOException - - if there's any problem writing.
public void output(org.jdom.Element element,
java.io.Writer out)
throws java.io.IOException
Print out an , including
its Elements, and its value, and all
contained (child) elements etc.
Attribute
element - Element to output.out - Writer to write to.
java.io.IOException
public void output(org.jdom.Element element,
java.io.OutputStream out)
throws java.io.IOException
Print out an , including
its Elements, and its value, and all
contained (child) elements etc.
Attribute
element - Element to output.out - Writer to write to.
java.io.IOException
public void outputElementContent(org.jdom.Element element,
java.io.Writer out)
throws java.io.IOException
This will handle printing out an 's content only, not including its tag, and
attributes. This can be useful for printing the content of an
element that contains HTML, like "<description>JDOM is
<b>fun>!</description>". Element
element - Element to output.out - Writer to write to.
java.io.IOException
public void outputElementContent(org.jdom.Element element,
java.io.OutputStream out)
throws java.io.IOException
This will handle printing out an 's content only, not including its tag, and
attributes. This can be useful for printing the content of an
element that contains HTML, like "<description>JDOM is
<b>fun>!</description>". Element
element - Element to output.out - OutputStream to write to.
java.io.IOException
public void output(org.jdom.Comment comment,
java.io.Writer out)
throws java.io.IOException
Print out a Comment
comment - Comment to output.out - Writer to write to.
java.io.IOException
public void output(org.jdom.Comment comment,
java.io.OutputStream out)
throws java.io.IOException
Print out a Comment
comment - Comment to output.out - OutputStream to write to.
java.io.IOException
public void output(java.lang.String string,
java.io.Writer out)
throws java.io.IOException
Print out a . Perfoms
the necessary entity escaping and whitespace stripping. String
string - String to output.out - Writer to write to.
java.io.IOException
public void output(java.lang.String string,
java.io.OutputStream out)
throws java.io.IOException
Print out a . Perfoms
the necessary entity escaping and whitespace stripping. String
string - String to output.out - OutputStream to write to.
java.io.IOException
public void output(org.jdom.Text text,
java.io.Writer out)
throws java.io.IOException
Print out a . Perfoms
the necessary entity escaping and whitespace stripping. Text
text - Text to output.out - Writer to write to.
java.io.IOException
public void output(org.jdom.Text text,
java.io.OutputStream out)
throws java.io.IOException
Print out a . Perfoms
the necessary entity escaping and whitespace stripping. Text
text - Text to output.out - OutputStream to write to.
java.io.IOExceptionpublic java.lang.String outputString(org.jdom.Document doc)
doc - Document to format.public java.lang.String outputString(org.jdom.Element element)
element - Element to format.public java.lang.String outputString(org.jdom.Comment comment)
comment - Comment to format.
protected void printComment(org.jdom.Comment comment,
java.io.Writer out)
throws java.io.IOException
This will write the comment to the specified writer.
comment - Comment to write.out - Writer to write to.
java.io.IOException
protected void printElement(org.jdom.Element element,
java.io.Writer out,
int indentLevel)
throws java.io.IOException
This will handle printing out an ,
its Elements, and its value.
Attribute
element - Element to output.out - Writer to write to.indentLevel - int level of indention.
java.io.IOException
public void printRawElement(RawElement element,
java.io.Writer out)
throws java.io.IOException
java.io.IOException
protected void printElementContent(org.jdom.Element element,
java.io.Writer out,
int indentLevel,
java.util.List eltContent)
throws java.io.IOException
This will handle printing out an 's content only, not including its tag,
attributes, and namespace info. Element
element - Element to output.out - Writer to write to.indentLevel - int level of indention.eltContent - the content to print
java.io.IOException
protected void printString(java.lang.String s,
java.io.Writer out)
throws java.io.IOException
java.io.IOException
protected void printAttributes(java.util.List attributes,
org.jdom.Element parent,
java.io.Writer out)
throws java.io.IOException
This will handle printing out an list.
Attribute
attributes - List of Attribute objctsout - Writer to write to
java.io.IOExceptionprotected java.lang.String escapeAttributeEntities(java.lang.String st)
This will take the pre-defined entities in XML 1.0 and convert their character representation to the appropriate entity reference, suitable for XML attributes. It does no converstion for ' because it's not necessary as the outputter writes attributes surrounded by double-quotes.
st - String input to escape.
String with escaped content.protected java.lang.String escapeTextEntities(java.lang.String st)
protected java.lang.String escapeElementEntities(java.lang.String st)
This will take the three pre-defined entities in XML 1.0 (used specifically in XML elements) and convert their character representation to the appropriate entity reference, suitable for XML element.
st - String input to escape.
String with escaped content.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||