|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.cyberneko.html.filters.DefaultFilter
org.cyberneko.html.filters.Writer
public class Writer
An HTML writer written as a filter. Besides serializing the HTML event stream, the writer also passes the document events to the next stage in the pipeline. This allows applications to insert writer filters between other custom filters for debugging purposes.
Since an HTML document may have specified its encoding using the <META> tag and http-equiv/content attributes, the writer will automatically change any character set specified in this tag to match the encoding of the output stream. Therefore, the character encoding name used to construct the writer should be an official IANA encoding name and not a Java encoding name.
Note: The modified character set in the <META> tag is not propagated to the next stage in the pipeline. The changed value is only output to the stream; the original value is sent to the next stage in the pipeline.
Field Summary | |
---|---|
protected static java.lang.String |
AUGMENTATIONS
Augmentations feature identifier. |
protected int |
fElementDepth
Element depth. |
protected java.lang.String |
fEncoding
The encoding. |
protected static java.lang.String |
FILTERS
Filters property identifier. |
protected boolean |
fNormalize
Normalize character content. |
protected boolean |
fPrintChars
Print characters. |
protected java.io.PrintWriter |
fPrinter
The print writer used for serializing the document with the appropriate character encoding. |
protected boolean |
fSeenHttpEquiv
Seen http-equiv directive. |
protected boolean |
fSeenRootElement
Seen root element. |
static java.lang.String |
NOTIFY_CHAR_REFS
Notify character entity references. |
static java.lang.String |
NOTIFY_HTML_BUILTIN_REFS
Notify built-in entity references. |
Fields inherited from class org.cyberneko.html.filters.DefaultFilter |
---|
fDocumentHandler, fDocumentSource |
Constructor Summary | |
---|---|
Writer()
Constructs a writer filter that prints to standard out. |
|
Writer(java.io.OutputStream outputStream,
java.lang.String encoding)
Constructs a writer filter using the specified output stream and encoding. |
|
Writer(java.io.Writer writer,
java.lang.String encoding)
Constructs a writer filter using the specified Java writer and encoding. |
Method Summary | |
---|---|
void |
characters(org.apache.xerces.xni.XMLString text,
org.apache.xerces.xni.Augmentations augs)
Characters. |
void |
comment(org.apache.xerces.xni.XMLString text,
org.apache.xerces.xni.Augmentations augs)
Comment. |
void |
emptyElement(org.apache.xerces.xni.QName element,
org.apache.xerces.xni.XMLAttributes attributes,
org.apache.xerces.xni.Augmentations augs)
Empty element. |
void |
endElement(org.apache.xerces.xni.QName element,
org.apache.xerces.xni.Augmentations augs)
End element. |
void |
endGeneralEntity(java.lang.String name,
org.apache.xerces.xni.Augmentations augs)
End general entity. |
static void |
main(java.lang.String[] argv)
Main. |
protected void |
printAttributeValue(java.lang.String text)
Print attribute value. |
protected void |
printCharacters(org.apache.xerces.xni.XMLString text,
boolean normalize)
Print characters. |
protected void |
printEndElement(org.apache.xerces.xni.QName element)
Print end element. |
protected void |
printEntity(java.lang.String name)
Print entity. |
protected void |
printStartElement(org.apache.xerces.xni.QName element,
org.apache.xerces.xni.XMLAttributes attributes)
Print start element. |
void |
startDocument(org.apache.xerces.xni.XMLLocator locator,
java.lang.String encoding,
org.apache.xerces.xni.Augmentations augs)
Start document. |
void |
startDocument(org.apache.xerces.xni.XMLLocator locator,
java.lang.String encoding,
org.apache.xerces.xni.NamespaceContext nscontext,
org.apache.xerces.xni.Augmentations augs)
Start document. |
void |
startElement(org.apache.xerces.xni.QName element,
org.apache.xerces.xni.XMLAttributes attributes,
org.apache.xerces.xni.Augmentations augs)
Start element. |
void |
startGeneralEntity(java.lang.String name,
org.apache.xerces.xni.XMLResourceIdentifier id,
java.lang.String encoding,
org.apache.xerces.xni.Augmentations augs)
Start general entity. |
Methods inherited from class org.cyberneko.html.filters.DefaultFilter |
---|
doctypeDecl, endCDATA, endDocument, endPrefixMapping, getDocumentHandler, getDocumentSource, getFeatureDefault, getPropertyDefault, getRecognizedFeatures, getRecognizedProperties, ignorableWhitespace, merge, processingInstruction, reset, setDocumentHandler, setDocumentSource, setFeature, setProperty, startCDATA, startPrefixMapping, textDecl, xmlDecl |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final java.lang.String NOTIFY_CHAR_REFS
public static final java.lang.String NOTIFY_HTML_BUILTIN_REFS
protected static final java.lang.String AUGMENTATIONS
protected static final java.lang.String FILTERS
protected java.lang.String fEncoding
protected java.io.PrintWriter fPrinter
protected boolean fSeenRootElement
protected boolean fSeenHttpEquiv
protected int fElementDepth
protected boolean fNormalize
protected boolean fPrintChars
Constructor Detail |
---|
public Writer()
public Writer(java.io.OutputStream outputStream, java.lang.String encoding) throws java.io.UnsupportedEncodingException
outputStream
- The output stream to write to.encoding
- The encoding to be used for the output. The encoding name
should be an official IANA encoding name.
java.io.UnsupportedEncodingException
public Writer(java.io.Writer writer, java.lang.String encoding)
writer
- The Java writer to write to.encoding
- The encoding to be used for the output. The encoding name
should be an official IANA encoding name.Method Detail |
---|
public void startDocument(org.apache.xerces.xni.XMLLocator locator, java.lang.String encoding, org.apache.xerces.xni.NamespaceContext nscontext, org.apache.xerces.xni.Augmentations augs) throws org.apache.xerces.xni.XNIException
startDocument
in interface org.apache.xerces.xni.XMLDocumentHandler
startDocument
in class DefaultFilter
org.apache.xerces.xni.XNIException
public void startDocument(org.apache.xerces.xni.XMLLocator locator, java.lang.String encoding, org.apache.xerces.xni.Augmentations augs) throws org.apache.xerces.xni.XNIException
startDocument
in class DefaultFilter
org.apache.xerces.xni.XNIException
public void comment(org.apache.xerces.xni.XMLString text, org.apache.xerces.xni.Augmentations augs) throws org.apache.xerces.xni.XNIException
comment
in interface org.apache.xerces.xni.XMLDocumentHandler
comment
in class DefaultFilter
org.apache.xerces.xni.XNIException
public void startElement(org.apache.xerces.xni.QName element, org.apache.xerces.xni.XMLAttributes attributes, org.apache.xerces.xni.Augmentations augs) throws org.apache.xerces.xni.XNIException
startElement
in interface org.apache.xerces.xni.XMLDocumentHandler
startElement
in class DefaultFilter
org.apache.xerces.xni.XNIException
public void emptyElement(org.apache.xerces.xni.QName element, org.apache.xerces.xni.XMLAttributes attributes, org.apache.xerces.xni.Augmentations augs) throws org.apache.xerces.xni.XNIException
emptyElement
in interface org.apache.xerces.xni.XMLDocumentHandler
emptyElement
in class DefaultFilter
org.apache.xerces.xni.XNIException
public void characters(org.apache.xerces.xni.XMLString text, org.apache.xerces.xni.Augmentations augs) throws org.apache.xerces.xni.XNIException
characters
in interface org.apache.xerces.xni.XMLDocumentHandler
characters
in class DefaultFilter
org.apache.xerces.xni.XNIException
public void endElement(org.apache.xerces.xni.QName element, org.apache.xerces.xni.Augmentations augs) throws org.apache.xerces.xni.XNIException
endElement
in interface org.apache.xerces.xni.XMLDocumentHandler
endElement
in class DefaultFilter
org.apache.xerces.xni.XNIException
public void startGeneralEntity(java.lang.String name, org.apache.xerces.xni.XMLResourceIdentifier id, java.lang.String encoding, org.apache.xerces.xni.Augmentations augs) throws org.apache.xerces.xni.XNIException
startGeneralEntity
in interface org.apache.xerces.xni.XMLDocumentHandler
startGeneralEntity
in class DefaultFilter
org.apache.xerces.xni.XNIException
public void endGeneralEntity(java.lang.String name, org.apache.xerces.xni.Augmentations augs) throws org.apache.xerces.xni.XNIException
endGeneralEntity
in interface org.apache.xerces.xni.XMLDocumentHandler
endGeneralEntity
in class DefaultFilter
org.apache.xerces.xni.XNIException
protected void printAttributeValue(java.lang.String text)
protected void printCharacters(org.apache.xerces.xni.XMLString text, boolean normalize)
protected void printStartElement(org.apache.xerces.xni.QName element, org.apache.xerces.xni.XMLAttributes attributes)
protected void printEndElement(org.apache.xerces.xni.QName element)
protected void printEntity(java.lang.String name)
public static void main(java.lang.String[] argv) throws java.lang.Exception
java.lang.Exception
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |