Java Doc for ToStream.java in  » XML » xalan » org » apache » xml » serializer » 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 » XML » xalan » org.apache.xml.serializer 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   org.apache.xml.serializer.SerializerBase
      org.apache.xml.serializer.ToStream

All known Subclasses:   org.apache.xml.serializer.ToTextStream,  org.apache.xml.serializer.ToHTMLStream,  org.apache.xml.serializer.ToXMLStream,
ToStream
abstract public class ToStream extends SerializerBase (Code)
This abstract class is a base class for other stream serializers (xml, html, text ...) that write output to a stream.

Inner Class :final static class BoolStack

Field Summary
protected  booleanm_cdataStartCalled
    
protected  CharInfom_charInfo
     Map that tells which characters should have special treatment, and it provides character to entity name lookup.
protected  BoolStackm_disableOutputEscapingStates
     Stack to keep track of disabling output escaping.
 EncodingInfom_encodingInfo
     The encoding information associated with this serializer. Although initially there is no encoding, there is a dummy EncodingInfo object that will say that every character is in the encoding.
protected  Propertiesm_format
     The xsl:output properties.
protected  booleanm_inDoctype
     Tells if we're in an internal document type subset.
 booleanm_isUTF8
     Flag to quickly tell if the encoding is UTF8.
protected  booleanm_ispreserve
     State flag to tell if preservation of whitespace is important.
protected  booleanm_isprevtext
     State flag that tells if the previous node processed was text, so we can tell if we should preserve whitespace. Used in endDocument() and shouldIndent() but only if m_doIndent is true.
protected  char[]m_lineSep
     The system line separator for writing out line breaks.
protected  intm_lineSepLen
     The length of the line seperator, since the write is done one character at a time.
protected  booleanm_lineSepUse
     True if the the system line separator is to be used.
protected  BoolStackm_preserves
     Stack to keep track of whether or not we need to preserve whitespace.
 booleanm_shouldFlush
     True if we control the buffer, and we should flush the output on endDocument.
protected  booleanm_spaceBeforeClose
     Add space before '/>' for XHTML.
 booleanm_startNewLine
     Flag to signal that a newline should be added.

Constructor Summary
public  ToStream()
    

Method Summary
protected  intaccumDefaultEntity(java.io.Writer writer, char ch, int i, char[] chars, int len, boolean fromTextNode, boolean escLF)
     Handle one of the default entities, return false if it is not a default entity.
Parameters:
  ch - character to be escaped.
Parameters:
  i - index into character array.
Parameters:
  chars - non-null reference to character array.
Parameters:
  len - length of chars.
Parameters:
  fromTextNode - true if the characters being processedare from a text node, false if they are from an attribute value
Parameters:
  escLF - true if the linefeed should be escaped.
protected  intaccumDefaultEscape(Writer writer, char ch, int i, char[] chars, int len, boolean fromTextNode, boolean escLF)
     Escape and writer.write a character.
Parameters:
  ch - character to be escaped.
Parameters:
  i - index into character array.
Parameters:
  chars - non-null reference to character array.
Parameters:
  len - length of chars.
Parameters:
  fromTextNode - true if the characters being processed arefrom a text node, false if the characters being processed are froman attribute value.
Parameters:
  escLF - true if the linefeed should be escaped.
public  booleanaddAttributeAlways(String uri, String localName, String rawName, String type, String value, boolean xslAttribute)
     Adds the given attribute to the set of attributes, even if there is no currently open element.
public  voidattributeDecl(String eName, String aName, String type, String valueDefault, String value)
     Report an attribute type declaration.

Only the effective (first) declaration for an attribute will be reported.

protected  voidcdata(char ch, int start, int length)
     Receive notification of cdata.

The Parser will call this method to report each chunk of character data.

public  voidcharacters(char chars, int start, int length)
     Receive notification of character data.

The Parser will call this method to report each chunk of character data.

public  voidcharacters(String s)
     Receive notification of character data.
protected  voidcharactersRaw(char ch, int start, int length)
     If available, when the disable-output-escaping attribute is used, output raw text without escaping.
protected  voidcloseCDATA()
     This helper method to writes out "]]>" when closing a CDATA section.
protected  voidcloseStartTag()
    
public  voidcomment(char ch, int start, int length)
     Receive notification of an XML comment anywhere in the document.
public  voidelementDecl(String name, String model)
     Report an element type declaration.

The content model will consist of the string "EMPTY", the string "ANY", or a parenthesised group, optionally followed by an occurrence indicator.

public  voidendCDATA()
     Report the end of a CDATA section.
public  voidendDTD()
     Report the end of DTD declarations.
public  voidendElement(String namespaceURI, String localName, String name)
     Receive notification of the end of an element.
public  voidendElement(String name)
     Receive notification of the end of an element.
public  voidendNonEscaping()
     Ends an un-escaping section.
public  voidendPrefixMapping(String prefix)
     End the scope of a prefix-URI Namespace mapping.
protected  StringensureAttributesNamespaceIsDeclared(String ns, String localName, String rawName)
     Makes sure that the namespace URI for the given qualified attribute name is declared.
Parameters:
  ns - the namespace URI
Parameters:
  rawName - the qualified name returns null if no action is taken, otherwise it returns theprefix used in declaring the namespace.
 voidensurePrefixIsDeclared(String ns, String rawName)
    
protected  booleanescapingNotNeeded(char ch)
     Tell if this character can be written without escaping.
public  voidexternalEntityDecl(String name, String publicId, String systemId)
     Report a parsed external entity declaration.

Only the effective (first) declaration for each entity will be reported.


Parameters:
  name - The name of the entity.
protected  voidfirePseudoAttributes()
     To fire off the pseudo characters of attributes, as they currently exist.
public  voidflushPending()
     This method flushes any pending events, which can be startDocument() closing the opening tag of an element, or closing an open CDATA section.
final protected  voidflushWriter()
     Flush the formatter's result stream.
public  intgetIndentAmount()
     Returns the m_indentAmount.
public  PropertiesgetOutputFormat()
     Returns the output format for this serializer.
public  OutputStreamgetOutputStream()
     Get the output stream where the events will be serialized to.
public  WritergetWriter()
     Get the character stream where the events will be serialized to.
public  voidignorableWhitespace(char ch, int start, int length)
     Receive notification of ignorable whitespace in element content.
protected  voidindent(int depth)
     Might print a newline character and the indentation amount of the given depth.
protected  voidindent()
     Indent at the current element nesting depth.
protected synchronized  voidinit(OutputStream output, Properties format, boolean defaultProperties)
     Initialize the serializer with the specified output stream and output format.
public  voidinternalEntityDecl(String name, String value)
     Report an internal entity declaration.

Only the effective (first) declaration for each entity will be reported.


Parameters:
  name - The name of the entity.
public  voidnotationDecl(String name, String pubID, String sysID)
     If this method is called, the serializer is used as a DTDHandler, which changes behavior how the serializer handles document entities.
 voidoutputDocTypeDecl(String name, boolean closeDecl)
     Output the doc type declaration.
 voidoutputEntityDecl(String name, String value)
     Output the doc type declaration.
final protected  voidoutputLineSep()
     Output a system-dependent line break.
public  voidprocessAttributes(java.io.Writer writer, int nAttrs)
     Process the attributes, which means to write out the currently collected attributes to the writer.
public  booleanreset()
     Try's to reset the super class and reset this class for re-use, so that you don't need to create a new serializer (mostly for performance reasons).
public  voidserialize(Node node)
     Serializes the DOM node.
public  voidsetCdataSectionElements(Vector URI_and_localNames)
     Remembers the cdata sections specified in the cdata-section-elements. The "official way to set URI and localName pairs.
public  voidsetContentHandler(ContentHandler ch)
    
public  voidsetDTDEntityExpansion(boolean expand)
    
public  voidsetEncoding(String encoding)
     Sets the character encoding coming from the xsl:output encoding stylesheet attribute.
public  booleansetEscaping(boolean escape)
    
public  voidsetIndentAmount(int m_indentAmount)
     Sets the m_indentAmount.
public  booleansetLineSepUse(boolean use_sytem_line_break)
     Set if the operating systems end-of-line line separator should be used when serializing.
public  voidsetOutputFormat(Properties format)
     Specifies an output format for this serializer.
public  voidsetOutputStream(OutputStream output)
     Specifies an output stream to which the document should be serialized.
public  voidsetTransformer(Transformer transformer)
    
public  voidsetWriter(Writer writer)
     Specifies a writer to which the document should be serialized.
protected  booleanshouldIndent()
     Tell if, based on space preservation constraints and the doIndent property, if an indent should occur.
public  voidskippedEntity(String name)
     Receive notification of a skipped entity.
See Also:   org.xml.sax.ContentHandler.skippedEntity
Parameters:
  name - The name of the skipped entity.
public  voidstartCDATA()
     Report the start of a CDATA section.
public  voidstartDTD(String name, String publicId, String systemId)
     Report the start of DTD declarations, if any.
public  voidstartElement(String namespaceURI, String localName, String name, Attributes atts)
     Receive notification of the beginning of an element, although this is a SAX method additional namespace or attribute information can occur before or after this call, that is associated with this element.
public  voidstartElement(String elementNamespaceURI, String elementLocalName, String elementName)
     Receive notification of the beginning of an element, additional namespace or attribute information can occur before or after this call, that is associated with this element.
public  voidstartElement(String elementName)
    
public  voidstartEntity(String name)
     Report the beginning of an entity. The start and end of the document entity are not reported. The start and end of the external DTD subset are reported using the pseudo-name "[dtd]".
public  voidstartNonEscaping()
     Starts an un-escaping section.
public  voidstartPrefixMapping(String prefix, String uri)
     Begin the scope of a prefix-URI Namespace mapping just before another element is about to start.
public  booleanstartPrefixMapping(String prefix, String uri, boolean shouldFlush)
     Handle a prefix/uri mapping, which is associated with a startElement() that is soon to follow.
public  voidunparsedEntityDecl(String name, String pubID, String sysID, String notationName)
     If this method is called, the serializer is used as a DTDHandler, which changes behavior how the serializer handles document entities.
public  voidwriteAttrString(Writer writer, String string, String encoding)
     Returns the specified string after substituting specials, and UTF-16 surrogates for chracter references &#xnn.
 voidwriteNormalizedChars(char ch, int start, int length, boolean isCData, boolean useSystemLineSeparator)
     Normalize the characters, but don't escape.
protected  intwriteUTF16Surrogate(char c, char ch, int i, int end)
     Once a surrogate has been detected, write out the pair of characters if it is in the encoding, or if there is no encoding, otherwise write out an entity reference of the value of the unicode code point of the character represented by the high/low surrogate pair.

An exception is thrown if there is no low surrogate in the pair, because the array ends unexpectely, or if the low char is there but its value is such that it is not a low surrogate.
Parameters:
  c - the first (high) part of the surrogate, whichmust be confirmed before calling this method.
Parameters:
  ch - Character array.
Parameters:
  i - position Where the surrogate was detected.
Parameters:
  end - The end index of the significant characters.


Field Detail
m_cdataStartCalled
protected boolean m_cdataStartCalled(Code)
remembers if we are in between the startCDATA() and endCDATA() callbacks



m_charInfo
protected CharInfo m_charInfo(Code)
Map that tells which characters should have special treatment, and it provides character to entity name lookup.



m_disableOutputEscapingStates
protected BoolStack m_disableOutputEscapingStates(Code)
Stack to keep track of disabling output escaping.



m_encodingInfo
EncodingInfo m_encodingInfo(Code)
The encoding information associated with this serializer. Although initially there is no encoding, there is a dummy EncodingInfo object that will say that every character is in the encoding. This is useful for a serializer that is in temporary output state and has no associated encoding. A serializer in final output state will have an encoding, and will worry about whether single chars or surrogate pairs of high/low chars form characters in the output encoding.



m_format
protected Properties m_format(Code)
The xsl:output properties.



m_inDoctype
protected boolean m_inDoctype(Code)
Tells if we're in an internal document type subset.



m_isUTF8
boolean m_isUTF8(Code)
Flag to quickly tell if the encoding is UTF8.



m_ispreserve
protected boolean m_ispreserve(Code)
State flag to tell if preservation of whitespace is important. Used only in shouldIndent() but only if m_doIndent is true. If m_doIndent is false this flag has no impact.



m_isprevtext
protected boolean m_isprevtext(Code)
State flag that tells if the previous node processed was text, so we can tell if we should preserve whitespace. Used in endDocument() and shouldIndent() but only if m_doIndent is true. If m_doIndent is false this flag has no impact.



m_lineSep
protected char[] m_lineSep(Code)
The system line separator for writing out line breaks. The default value is from the system property, but this value can be set through the xsl:output extension attribute xalan:line-separator.



m_lineSepLen
protected int m_lineSepLen(Code)
The length of the line seperator, since the write is done one character at a time.



m_lineSepUse
protected boolean m_lineSepUse(Code)
True if the the system line separator is to be used.



m_preserves
protected BoolStack m_preserves(Code)
Stack to keep track of whether or not we need to preserve whitespace. Used to push/pop values used for the field m_ispreserve, but m_ispreserve is only relevant if m_doIndent is true. If m_doIndent is false this field has no impact.



m_shouldFlush
boolean m_shouldFlush(Code)
True if we control the buffer, and we should flush the output on endDocument.



m_spaceBeforeClose
protected boolean m_spaceBeforeClose(Code)
Add space before '/>' for XHTML.



m_startNewLine
boolean m_startNewLine(Code)
Flag to signal that a newline should be added. Used only in indent() which is called only if m_doIndent is true. If m_doIndent is false this flag has no impact.




Constructor Detail
ToStream
public ToStream()(Code)
Default constructor




Method Detail
accumDefaultEntity
protected int accumDefaultEntity(java.io.Writer writer, char ch, int i, char[] chars, int len, boolean fromTextNode, boolean escLF) throws IOException(Code)
Handle one of the default entities, return false if it is not a default entity.
Parameters:
  ch - character to be escaped.
Parameters:
  i - index into character array.
Parameters:
  chars - non-null reference to character array.
Parameters:
  len - length of chars.
Parameters:
  fromTextNode - true if the characters being processedare from a text node, false if they are from an attribute value
Parameters:
  escLF - true if the linefeed should be escaped. i+1 if the character was written, else i.
throws:
  java.io.IOException -



accumDefaultEscape
protected int accumDefaultEscape(Writer writer, char ch, int i, char[] chars, int len, boolean fromTextNode, boolean escLF) throws IOException(Code)
Escape and writer.write a character.
Parameters:
  ch - character to be escaped.
Parameters:
  i - index into character array.
Parameters:
  chars - non-null reference to character array.
Parameters:
  len - length of chars.
Parameters:
  fromTextNode - true if the characters being processed arefrom a text node, false if the characters being processed are froman attribute value.
Parameters:
  escLF - true if the linefeed should be escaped. i+1 if a character was written, i+2 if two characterswere written out, else return i.
throws:
  org.xml.sax.SAXException -



addAttributeAlways
public boolean addAttributeAlways(String uri, String localName, String rawName, String type, String value, boolean xslAttribute)(Code)
Adds the given attribute to the set of attributes, even if there is no currently open element. This is useful if a SAX startPrefixMapping() should need to add an attribute before the element name is seen. This method is a copy of its super classes method, except that some tracing of events is done. This is so the tracing is only done for stream serializers, not for SAX ones.
Parameters:
  uri - the URI of the attribute
Parameters:
  localName - the local name of the attribute
Parameters:
  rawName - the qualified name of the attribute
Parameters:
  type - the type of the attribute (probably CDATA)
Parameters:
  value - the value of the attribute
Parameters:
  xslAttribute - true if this attribute is coming from an xsl:attribute element. true if the attribute value was added, false if the attribute already existed and the value wasreplaced with the new value.



attributeDecl
public void attributeDecl(String eName, String aName, String type, String valueDefault, String value) throws SAXException(Code)
Report an attribute type declaration.

Only the effective (first) declaration for an attribute will be reported. The type will be one of the strings "CDATA", "ID", "IDREF", "IDREFS", "NMTOKEN", "NMTOKENS", "ENTITY", "ENTITIES", or "NOTATION", or a parenthesized token group with the separator "|" and all whitespace removed.


Parameters:
  eName - The name of the associated element.
Parameters:
  aName - The name of the attribute.
Parameters:
  type - A string representing the attribute type.
Parameters:
  valueDefault - A string representing the attribute default("#IMPLIED", "#REQUIRED", or "#FIXED") or null ifnone of these applies.
Parameters:
  value - A string representing the attribute's default value,or null if there is none.
exception:
  SAXException - The application may raise an exception.



cdata
protected void cdata(char ch, int start, int length) throws org.xml.sax.SAXException(Code)
Receive notification of cdata.

The Parser will call this method to report each chunk of character data. SAX parsers may return all contiguous character data in a single chunk, or they may split it into several chunks; however, all of the characters in any single event must come from the same external entity, so that the Locator provides useful information.

The application must not attempt to read from the array outside of the specified range.

Note that some parsers will report whitespace using the ignorableWhitespace() method rather than this one (validating parsers must do so).


Parameters:
  ch - The characters from the XML document.
Parameters:
  start - The start position in the array.
Parameters:
  length - The number of characters to read from the array.
throws:
  org.xml.sax.SAXException - Any SAX exception, possiblywrapping another exception.
See Also:   ToStream.ignorableWhitespace
See Also:   org.xml.sax.Locator
throws:
  org.xml.sax.SAXException -



characters
public void characters(char chars, int start, int length) throws org.xml.sax.SAXException(Code)
Receive notification of character data.

The Parser will call this method to report each chunk of character data. SAX parsers may return all contiguous character data in a single chunk, or they may split it into several chunks; however, all of the characters in any single event must come from the same external entity, so that the Locator provides useful information.

The application must not attempt to read from the array outside of the specified range.

Note that some parsers will report whitespace using the ignorableWhitespace() method rather than this one (validating parsers must do so).


Parameters:
  chars - The characters from the XML document.
Parameters:
  start - The start position in the array.
Parameters:
  length - The number of characters to read from the array.
throws:
  org.xml.sax.SAXException - Any SAX exception, possiblywrapping another exception.
See Also:   ToStream.ignorableWhitespace
See Also:   org.xml.sax.Locator
throws:
  org.xml.sax.SAXException -



characters
public void characters(String s) throws org.xml.sax.SAXException(Code)
Receive notification of character data.
Parameters:
  s - The string of characters to process.
throws:
  org.xml.sax.SAXException -



charactersRaw
protected void charactersRaw(char ch, int start, int length) throws org.xml.sax.SAXException(Code)
If available, when the disable-output-escaping attribute is used, output raw text without escaping.
Parameters:
  ch - The characters from the XML document.
Parameters:
  start - The start position in the array.
Parameters:
  length - The number of characters to read from the array.
throws:
  org.xml.sax.SAXException -



closeCDATA
protected void closeCDATA() throws org.xml.sax.SAXException(Code)
This helper method to writes out "]]>" when closing a CDATA section.
throws:
  org.xml.sax.SAXException -



closeStartTag
protected void closeStartTag() throws SAXException(Code)
For the enclosing elements starting tag write out out any attributes followed by ">"
throws:
  org.xml.sax.SAXException -



comment
public void comment(char ch, int start, int length) throws org.xml.sax.SAXException(Code)
Receive notification of an XML comment anywhere in the document. This callback will be used for comments inside or outside the document element, including comments in the external DTD subset (if read).
Parameters:
  ch - An array holding the characters in the comment.
Parameters:
  start - The starting position in the array.
Parameters:
  length - The number of characters to use from the array.
throws:
  org.xml.sax.SAXException - The application may raise an exception.



elementDecl
public void elementDecl(String name, String model) throws SAXException(Code)
Report an element type declaration.

The content model will consist of the string "EMPTY", the string "ANY", or a parenthesised group, optionally followed by an occurrence indicator. The model will be normalized so that all whitespace is removed,and will include the enclosing parentheses.


Parameters:
  name - The element type name.
Parameters:
  model - The content model as a normalized string.
exception:
  SAXException - The application may raise an exception.



endCDATA
public void endCDATA() throws org.xml.sax.SAXException(Code)
Report the end of a CDATA section.
throws:
  org.xml.sax.SAXException - The application may raise an exception.
See Also:   ToStream.startCDATA



endDTD
public void endDTD() throws org.xml.sax.SAXException(Code)
Report the end of DTD declarations.
throws:
  org.xml.sax.SAXException - The application may raise an exception.
See Also:   ToStream.startDTD



endElement
public void endElement(String namespaceURI, String localName, String name) throws org.xml.sax.SAXException(Code)
Receive notification of the end of an element.
Parameters:
  namespaceURI - The Namespace URI, or the empty string if theelement has no Namespace URI or if Namespaceprocessing is not being performed.
Parameters:
  localName - The local name (without prefix), or theempty string if Namespace processing is not beingperformed.
Parameters:
  name - The element type name
throws:
  org.xml.sax.SAXException - Any SAX exception, possiblywrapping another exception.
throws:
  org.xml.sax.SAXException -



endElement
public void endElement(String name) throws org.xml.sax.SAXException(Code)
Receive notification of the end of an element.
Parameters:
  name - The element type name
throws:
  org.xml.sax.SAXException - Any SAX exception, possiblywrapping another exception.



endNonEscaping
public void endNonEscaping() throws org.xml.sax.SAXException(Code)
Ends an un-escaping section.
See Also:   ToStream.startNonEscaping
throws:
  org.xml.sax.SAXException -



endPrefixMapping
public void endPrefixMapping(String prefix) throws org.xml.sax.SAXException(Code)
End the scope of a prefix-URI Namespace mapping.
See Also:   org.xml.sax.ContentHandler.endPrefixMapping
Parameters:
  prefix - The prefix that was being mapping.
throws:
  org.xml.sax.SAXException - The client may throwan exception during processing.



ensureAttributesNamespaceIsDeclared
protected String ensureAttributesNamespaceIsDeclared(String ns, String localName, String rawName) throws org.xml.sax.SAXException(Code)
Makes sure that the namespace URI for the given qualified attribute name is declared.
Parameters:
  ns - the namespace URI
Parameters:
  rawName - the qualified name returns null if no action is taken, otherwise it returns theprefix used in declaring the namespace.
throws:
  SAXException -



ensurePrefixIsDeclared
void ensurePrefixIsDeclared(String ns, String rawName) throws org.xml.sax.SAXException(Code)



escapingNotNeeded
protected boolean escapingNotNeeded(char ch)(Code)
Tell if this character can be written without escaping.



externalEntityDecl
public void externalEntityDecl(String name, String publicId, String systemId) throws SAXException(Code)
Report a parsed external entity declaration.

Only the effective (first) declaration for each entity will be reported.


Parameters:
  name - The name of the entity. If it is a parameterentity, the name will begin with '%'.
Parameters:
  publicId - The declared public identifier of the entity, ornull if none was declared.
Parameters:
  systemId - The declared system identifier of the entity.
exception:
  SAXException - The application may raise an exception.
See Also:   ToStream.internalEntityDecl
See Also:   org.xml.sax.DTDHandler.unparsedEntityDecl



firePseudoAttributes
protected void firePseudoAttributes()(Code)
To fire off the pseudo characters of attributes, as they currently exist. This method should be called everytime an attribute is added, or when an attribute value is changed, or an element is created.



flushPending
public void flushPending() throws SAXException(Code)
This method flushes any pending events, which can be startDocument() closing the opening tag of an element, or closing an open CDATA section.



flushWriter
final protected void flushWriter() throws org.xml.sax.SAXException(Code)
Flush the formatter's result stream.
throws:
  org.xml.sax.SAXException -



getIndentAmount
public int getIndentAmount()(Code)
Returns the m_indentAmount. int



getOutputFormat
public Properties getOutputFormat()(Code)
Returns the output format for this serializer. The output format in use



getOutputStream
public OutputStream getOutputStream()(Code)
Get the output stream where the events will be serialized to. reference to the result stream, or null of only a writer wasset.



getWriter
public Writer getWriter()(Code)
Get the character stream where the events will be serialized to. Reference to the result Writer, or null.



ignorableWhitespace
public void ignorableWhitespace(char ch, int start, int length) throws org.xml.sax.SAXException(Code)
Receive notification of ignorable whitespace in element content. Not sure how to get this invoked quite yet.
Parameters:
  ch - The characters from the XML document.
Parameters:
  start - The start position in the array.
Parameters:
  length - The number of characters to read from the array.
throws:
  org.xml.sax.SAXException - Any SAX exception, possiblywrapping another exception.
See Also:   ToStream.characters
throws:
  org.xml.sax.SAXException -



indent
protected void indent(int depth) throws IOException(Code)
Might print a newline character and the indentation amount of the given depth.
Parameters:
  depth - the indentation depth (element nesting depth)
throws:
  org.xml.sax.SAXException - if an error occurs during writing.



indent
protected void indent() throws IOException(Code)
Indent at the current element nesting depth.
throws:
  IOException -



init
protected synchronized void init(OutputStream output, Properties format, boolean defaultProperties) throws UnsupportedEncodingException(Code)
Initialize the serializer with the specified output stream and output format. Must be called before calling any of the serialize methods.
Parameters:
  output - The output stream to use
Parameters:
  format - The output format
Parameters:
  defaultProperties - true if the properties are the defaultproperties
throws:
  UnsupportedEncodingException - The encoding specified in theoutput format is not supported



internalEntityDecl
public void internalEntityDecl(String name, String value) throws SAXException(Code)
Report an internal entity declaration.

Only the effective (first) declaration for each entity will be reported.


Parameters:
  name - The name of the entity. If it is a parameterentity, the name will begin with '%'.
Parameters:
  value - The replacement text of the entity.
exception:
  SAXException - The application may raise an exception.
See Also:   ToStream.externalEntityDecl
See Also:   org.xml.sax.DTDHandler.unparsedEntityDecl



notationDecl
public void notationDecl(String name, String pubID, String sysID) throws SAXException(Code)
If this method is called, the serializer is used as a DTDHandler, which changes behavior how the serializer handles document entities.
See Also:   org.xml.sax.DTDHandler.notationDecl(java.lang.Stringjava.lang.Stringjava.lang.String)



outputDocTypeDecl
void outputDocTypeDecl(String name, boolean closeDecl) throws SAXException(Code)
Output the doc type declaration.
Parameters:
  name - non-null reference to document type name.NEEDSDOC @param closeDecl
throws:
  java.io.IOException -



outputEntityDecl
void outputEntityDecl(String name, String value) throws IOException(Code)
Output the doc type declaration.
Parameters:
  name - non-null reference to document type name.NEEDSDOC @param value
throws:
  org.xml.sax.SAXException -



outputLineSep
final protected void outputLineSep() throws IOException(Code)
Output a system-dependent line break.
throws:
  org.xml.sax.SAXException -



processAttributes
public void processAttributes(java.io.Writer writer, int nAttrs) throws IOException, SAXException(Code)
Process the attributes, which means to write out the currently collected attributes to the writer. The attributes are not cleared by this method
Parameters:
  writer - the writer to write processed attributes to.
Parameters:
  nAttrs - the number of attributes in m_attributes to be processed
throws:
  java.io.IOException -
throws:
  org.xml.sax.SAXException -



reset
public boolean reset()(Code)
Try's to reset the super class and reset this class for re-use, so that you don't need to create a new serializer (mostly for performance reasons). true if the class was successfuly reset.



serialize
public void serialize(Node node) throws IOException(Code)
Serializes the DOM node. Throws an exception only if an I/O exception occured while serializing.
Parameters:
  node - Node to serialize.
throws:
  IOException - An I/O exception occured while serializing



setCdataSectionElements
public void setCdataSectionElements(Vector URI_and_localNames)(Code)
Remembers the cdata sections specified in the cdata-section-elements. The "official way to set URI and localName pairs. This method should be used by both Xalan and XSLTC.
Parameters:
  URI_and_localNames - a vector of pairs of Strings (URI/local)



setContentHandler
public void setContentHandler(ContentHandler ch)(Code)



setDTDEntityExpansion
public void setDTDEntityExpansion(boolean expand)(Code)
If set to false the serializer does not expand DTD entities, but leaves them as is, the default value is true;



setEncoding
public void setEncoding(String encoding)(Code)
Sets the character encoding coming from the xsl:output encoding stylesheet attribute.
Parameters:
  encoding - the character encoding



setEscaping
public boolean setEscaping(boolean escape)(Code)

See Also:   SerializationHandler.setEscaping(boolean)



setIndentAmount
public void setIndentAmount(int m_indentAmount)(Code)
Sets the m_indentAmount.
Parameters:
  m_indentAmount - The m_indentAmount to set



setLineSepUse
public boolean setLineSepUse(boolean use_sytem_line_break)(Code)
Set if the operating systems end-of-line line separator should be used when serializing. If set false NL character (decimal 10) is left alone, otherwise the new-line will be replaced on output with the systems line separator. For example on UNIX this is NL, while on Windows it is two characters, CR NL, where CR is the carriage-return (decimal 13).
Parameters:
  use_sytem_line_break - True if an input NL is replaced with the operating systems end-of-line separator. The previously set value of the serializer.



setOutputFormat
public void setOutputFormat(Properties format)(Code)
Specifies an output format for this serializer. It the serializer has already been associated with an output format, it will switch to the new format. This method should not be called while the serializer is in the process of serializing a document.
Parameters:
  format - The output format to use



setOutputStream
public void setOutputStream(OutputStream output)(Code)
Specifies an output stream to which the document should be serialized. This method should not be called while the serializer is in the process of serializing a document.

The encoding specified in the output properties is used, or if no encoding was specified, the default for the selected output method.
Parameters:
  output - The output stream




setTransformer
public void setTransformer(Transformer transformer)(Code)

See Also:   SerializationHandler.setTransformer(Transformer)



setWriter
public void setWriter(Writer writer)(Code)
Specifies a writer to which the document should be serialized. This method should not be called while the serializer is in the process of serializing a document.
Parameters:
  writer - The output writer stream



shouldIndent
protected boolean shouldIndent()(Code)
Tell if, based on space preservation constraints and the doIndent property, if an indent should occur. True if an indent should occur.



skippedEntity
public void skippedEntity(String name) throws org.xml.sax.SAXException(Code)
Receive notification of a skipped entity.
See Also:   org.xml.sax.ContentHandler.skippedEntity
Parameters:
  name - The name of the skipped entity. If it is aparameter entity, the name will begin with '%',and if it is the external DTD subset, it will be the string"[dtd]".
throws:
  org.xml.sax.SAXException - Any SAX exception, possibly wrappinganother exception.



startCDATA
public void startCDATA() throws org.xml.sax.SAXException(Code)
Report the start of a CDATA section.
throws:
  org.xml.sax.SAXException - The application may raise an exception.
See Also:   ToStream.endCDATA



startDTD
public void startDTD(String name, String publicId, String systemId) throws org.xml.sax.SAXException(Code)
Report the start of DTD declarations, if any. Any declarations are assumed to be in the internal subset unless otherwise indicated.
Parameters:
  name - The document type name.
Parameters:
  publicId - The declared public identifier for theexternal DTD subset, or null if none was declared.
Parameters:
  systemId - The declared system identifier for theexternal DTD subset, or null if none was declared.
throws:
  org.xml.sax.SAXException - The application may raise anexception.
See Also:   ToStream.endDTD
See Also:   ToStream.startEntity



startElement
public void startElement(String namespaceURI, String localName, String name, Attributes atts) throws org.xml.sax.SAXException(Code)
Receive notification of the beginning of an element, although this is a SAX method additional namespace or attribute information can occur before or after this call, that is associated with this element.
Parameters:
  namespaceURI - The Namespace URI, or the empty string if theelement has no Namespace URI or if Namespaceprocessing is not being performed.
Parameters:
  localName - The local name (without prefix), or theempty string if Namespace processing is not beingperformed.
Parameters:
  name - The element type name.
Parameters:
  atts - The attributes attached to the element, if any.
throws:
  org.xml.sax.SAXException - Any SAX exception, possiblywrapping another exception.
See Also:   org.xml.sax.ContentHandler.startElement
See Also:   org.xml.sax.ContentHandler.endElement
See Also:   org.xml.sax.AttributeList
throws:
  org.xml.sax.SAXException -



startElement
public void startElement(String elementNamespaceURI, String elementLocalName, String elementName) throws SAXException(Code)
Receive notification of the beginning of an element, additional namespace or attribute information can occur before or after this call, that is associated with this element.
Parameters:
  elementNamespaceURI - The Namespace URI, or the empty string if theelement has no Namespace URI or if Namespaceprocessing is not being performed.
Parameters:
  elementLocalName - The local name (without prefix), or theempty string if Namespace processing is not beingperformed.
Parameters:
  elementName - The element type name.
throws:
  org.xml.sax.SAXException - Any SAX exception, possiblywrapping another exception.
See Also:   org.xml.sax.ContentHandler.startElement
See Also:   org.xml.sax.ContentHandler.endElement
See Also:   org.xml.sax.AttributeList
throws:
  org.xml.sax.SAXException -



startElement
public void startElement(String elementName) throws SAXException(Code)



startEntity
public void startEntity(String name) throws org.xml.sax.SAXException(Code)
Report the beginning of an entity. The start and end of the document entity are not reported. The start and end of the external DTD subset are reported using the pseudo-name "[dtd]". All other events must be properly nested within start/end entity events.
Parameters:
  name - The name of the entity. If it is a parameterentity, the name will begin with '%'.
throws:
  org.xml.sax.SAXException - The application may raise an exception.
See Also:   ToStream.endEntity
See Also:   org.xml.sax.ext.DeclHandler.internalEntityDecl
See Also:   org.xml.sax.ext.DeclHandler.externalEntityDecl



startNonEscaping
public void startNonEscaping() throws org.xml.sax.SAXException(Code)
Starts an un-escaping section. All characters printed within an un- escaping section are printed as is, without escaping special characters into entity references. Only XML and HTML serializers need to support this method.

The contents of the un-escaping section will be delivered through the regular characters event.
throws:
  org.xml.sax.SAXException -




startPrefixMapping
public void startPrefixMapping(String prefix, String uri) throws org.xml.sax.SAXException(Code)
Begin the scope of a prefix-URI Namespace mapping just before another element is about to start. This call will close any open tags so that the prefix mapping will not apply to the current element, but the up comming child.
See Also:   org.xml.sax.ContentHandler.startPrefixMapping
Parameters:
  prefix - The Namespace prefix being declared.
Parameters:
  uri - The Namespace URI the prefix is mapped to.
throws:
  org.xml.sax.SAXException - The client may throwan exception during processing.



startPrefixMapping
public boolean startPrefixMapping(String prefix, String uri, boolean shouldFlush) throws org.xml.sax.SAXException(Code)
Handle a prefix/uri mapping, which is associated with a startElement() that is soon to follow. Need to close any open start tag to make sure than any name space attributes due to this event are associated wih the up comming element, not the current one.
See Also:   ExtendedContentHandler.startPrefixMapping
Parameters:
  prefix - The Namespace prefix being declared.
Parameters:
  uri - The Namespace URI the prefix is mapped to.
Parameters:
  shouldFlush - true if any open tags need to be closed first, thiswill impact which element the mapping applies to (open parent, or its upcomming child) returns true if the call made a change to the current namespace information, false if it did not change anything, e.g. if theprefix/namespace mapping was already in scope from before.
throws:
  org.xml.sax.SAXException - The client may throwan exception during processing.



unparsedEntityDecl
public void unparsedEntityDecl(String name, String pubID, String sysID, String notationName) throws SAXException(Code)
If this method is called, the serializer is used as a DTDHandler, which changes behavior how the serializer handles document entities.
See Also:   org.xml.sax.DTDHandler.unparsedEntityDecl(java.lang.Stringjava.lang.Stringjava.lang.Stringjava.lang.String)



writeAttrString
public void writeAttrString(Writer writer, String string, String encoding) throws IOException(Code)
Returns the specified string after substituting specials, and UTF-16 surrogates for chracter references &#xnn.
Parameters:
  string - String to convert to XML format.
Parameters:
  encoding - CURRENTLY NOT IMPLEMENTED.
throws:
  java.io.IOException -



writeNormalizedChars
void writeNormalizedChars(char ch, int start, int length, boolean isCData, boolean useSystemLineSeparator) throws IOException, org.xml.sax.SAXException(Code)
Normalize the characters, but don't escape.
Parameters:
  ch - The characters from the XML document.
Parameters:
  start - The start position in the array.
Parameters:
  length - The number of characters to read from the array.
Parameters:
  isCData - true if a CDATA block should be built around the characters.
Parameters:
  useSystemLineSeparator - true if the operating systems end-of-line separator should be output rather than a new-line character.
throws:
  IOException -
throws:
  org.xml.sax.SAXException -



writeUTF16Surrogate
protected int writeUTF16Surrogate(char c, char ch, int i, int end) throws IOException(Code)
Once a surrogate has been detected, write out the pair of characters if it is in the encoding, or if there is no encoding, otherwise write out an entity reference of the value of the unicode code point of the character represented by the high/low surrogate pair.

An exception is thrown if there is no low surrogate in the pair, because the array ends unexpectely, or if the low char is there but its value is such that it is not a low surrogate.
Parameters:
  c - the first (high) part of the surrogate, whichmust be confirmed before calling this method.
Parameters:
  ch - Character array.
Parameters:
  i - position Where the surrogate was detected.
Parameters:
  end - The end index of the significant characters. 0 if the pair of characters was written out as-is,the unicode code point of the character represented bythe surrogate pair if an entity reference with that valuewas written out.
throws:
  IOException -
throws:
  org.xml.sax.SAXException - if invalid UTF-16 surrogate detected.




Fields inherited from org.apache.xml.serializer.SerializerBase
protected char[] m_attrBuff(Code)(Java Doc)
protected AttributesImplSerializer m_attributes(Code)(Java Doc)
protected Vector m_cdataSectionElements(Code)(Java Doc)
protected boolean m_cdataTagOpen(Code)(Java Doc)
protected char[] m_charsBuff(Code)(Java Doc)
protected boolean m_doIndent(Code)(Java Doc)
protected ElemContext m_elemContext(Code)(Java Doc)
protected boolean m_inEntityRef(Code)(Java Doc)
protected boolean m_inExternalDTD(Code)(Java Doc)
protected int m_indentAmount(Code)(Java Doc)
protected boolean m_needToCallStartDocument(Code)(Java Doc)
boolean m_needToOutputDocTypeDecl(Code)(Java Doc)
protected NamespaceMappings m_prefixMap(Code)(Java Doc)
protected SourceLocator m_sourceLocator(Code)(Java Doc)
protected boolean m_standaloneWasSpecified(Code)(Java Doc)
protected SerializerTrace m_tracer(Code)(Java Doc)
protected java.io.Writer m_writer(Code)(Java Doc)

Methods inherited from org.apache.xml.serializer.SerializerBase
public void addAttribute(String uri, String localName, String rawName, String type, String value, boolean XSLAttribute) throws SAXException(Code)(Java Doc)
public void addAttribute(String name, String value)(Code)(Java Doc)
public void addAttribute(String uri, String localName, String rawName, String type, String value) throws SAXException(Code)(Java Doc)
public boolean addAttributeAlways(String uri, String localName, String rawName, String type, String value, boolean XSLAttribute)(Code)(Java Doc)
public void addAttributes(Attributes atts) throws SAXException(Code)(Java Doc)
public void addXSLAttribute(String name, String value, String uri)(Code)(Java Doc)
public ContentHandler asContentHandler() throws IOException(Code)(Java Doc)
public DOMSerializer asDOMSerializer() throws IOException(Code)(Java Doc)
public void characters(org.w3c.dom.Node node) throws org.xml.sax.SAXException(Code)(Java Doc)
public void close()(Code)(Java Doc)
public void comment(String data) throws SAXException(Code)(Java Doc)
public void endEntity(String name) throws org.xml.sax.SAXException(Code)(Java Doc)
public void entityReference(String name) throws org.xml.sax.SAXException(Code)(Java Doc)
public void error(SAXParseException exc) throws SAXException(Code)(Java Doc)
public void fatalError(SAXParseException exc) throws SAXException(Code)(Java Doc)
protected void fireCDATAEvent(char[] chars, int start, int length) throws org.xml.sax.SAXException(Code)(Java Doc)
protected void fireCharEvent(char[] chars, int start, int length) throws org.xml.sax.SAXException(Code)(Java Doc)
protected void fireCommentEvent(char[] chars, int start, int length) throws org.xml.sax.SAXException(Code)(Java Doc)
protected void fireEndDoc() throws org.xml.sax.SAXException(Code)(Java Doc)
protected void fireEndElem(String name) throws org.xml.sax.SAXException(Code)(Java Doc)
public void fireEndEntity(String name) throws org.xml.sax.SAXException(Code)(Java Doc)
protected void fireEntityReference(String name) throws org.xml.sax.SAXException(Code)(Java Doc)
protected void fireEscapingEvent(String name, String data) throws org.xml.sax.SAXException(Code)(Java Doc)
protected void fireStartDoc() throws org.xml.sax.SAXException(Code)(Java Doc)
protected void fireStartElem(String elemName) throws org.xml.sax.SAXException(Code)(Java Doc)
protected void fireStartEntity(String name) throws org.xml.sax.SAXException(Code)(Java Doc)
public String getDoctypePublic()(Code)(Java Doc)
public String getDoctypeSystem()(Code)(Java Doc)
public String getEncoding()(Code)(Java Doc)
public boolean getIndent()(Code)(Java Doc)
public int getIndentAmount()(Code)(Java Doc)
protected static String getLocalName(String qname)(Code)(Java Doc)
public String getMediaType()(Code)(Java Doc)
public NamespaceMappings getNamespaceMappings()(Code)(Java Doc)
public String getNamespaceURI(String qname, boolean isElement)(Code)(Java Doc)
public String getNamespaceURIFromPrefix(String prefix)(Code)(Java Doc)
public boolean getOmitXMLDeclaration()(Code)(Java Doc)
public String getPrefix(String namespaceURI)(Code)(Java Doc)
final protected static String getPrefixPart(String qname)(Code)(Java Doc)
public String getStandalone()(Code)(Java Doc)
public Transformer getTransformer()(Code)(Java Doc)
public String getVersion()(Code)(Java Doc)
final boolean inTemporaryOutputState()(Code)(Java Doc)
protected void initCDATA()(Code)(Java Doc)
protected boolean isCdataSection()(Code)(Java Doc)
public void namespaceAfterStartElement(String uri, String prefix) throws SAXException(Code)(Java Doc)
public void notationDecl(String arg0, String arg1, String arg2) throws SAXException(Code)(Java Doc)
protected String patchName(String qname)(Code)(Java Doc)
public boolean reset()(Code)(Java Doc)
public void setDTDEntityExpansion(boolean expand)(Code)(Java Doc)
public void setDoctype(String doctypeSystem, String doctypePublic)(Code)(Java Doc)
public void setDoctypePublic(String doctypePublic)(Code)(Java Doc)
public void setDoctypeSystem(String doctypeSystem)(Code)(Java Doc)
public void setDocumentLocator(Locator locator)(Code)(Java Doc)
public void setEncoding(String m_encoding)(Code)(Java Doc)
public void setIndent(boolean doIndent)(Code)(Java Doc)
public void setIndentAmount(int m_indentAmount)(Code)(Java Doc)
public void setMediaType(String mediaType)(Code)(Java Doc)
public void setNamespaceMappings(NamespaceMappings mappings)(Code)(Java Doc)
public void setOmitXMLDeclaration(boolean b)(Code)(Java Doc)
public void setSourceLocator(SourceLocator locator)(Code)(Java Doc)
public void setStandalone(String standalone)(Code)(Java Doc)
protected void setStandaloneInternal(String standalone)(Code)(Java Doc)
public void setTransformer(Transformer t)(Code)(Java Doc)
public void setVersion(String version)(Code)(Java Doc)
public void startDocument() throws org.xml.sax.SAXException(Code)(Java Doc)
protected void startDocumentInternal() throws org.xml.sax.SAXException(Code)(Java Doc)
public void unparsedEntityDecl(String arg0, String arg1, String arg2, String arg3) throws SAXException(Code)(Java Doc)
public void warning(SAXParseException exc) throws SAXException(Code)(Java Doc)

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.