org.ceryle.xtm
Class XtmSerializer

java.lang.Object
  extended by org.ceryle.xtm.XtmSerializer
All Implemented Interfaces:
Constants

public class XtmSerializer
extends Object
implements Constants

A serialization processor to convert an XTM Document object to XTM syntax. Writes an XtmNode object to an output stream or file.

Since:
JDK1.3
Version:
$Id: XtmSerializer.java,v 3.5 2007-06-15 12:10:36 altheim Exp $
Author:
Murray Altheim
See Also:
Constants

Field Summary
protected  boolean cleanCommentWS
           
static String DEFAULT_ENCODING
          Default XML Encoding
static String DTD_directory
          A String containing the default path to a local directory containing DTDs.
static boolean includeDOCTYPE
          When true, include the DOCTYPE declaration for XTM.
 String systemId
          Default system identifier for DOCTYPE declaration.
static String XMLNS_xlink
          A String containing the XML Namespace URI for XLink.
 
Fields inherited from interface org.ceryle.util.Constants
Amp, AMP, Apos, APOS, APP_NAME, APP_VERSION_NAME, APP_VERSION_NUMBER, AT, BANG, BAR, BIT_dev, BIT_http, BIT_ignoreCom, BIT_merge, BIT_none, BIT_noPreload, BIT_simple, BIT_ui, BIT_unused1, BIT_unused2, BIT_unused3, BIT_validating, BIT_verbose, BIT_xcatalog, BIT_xlink, BIT_xmlnsAware, BIT_xsd, BROKB, BSlash, BSLASH, CERYLE_CREDITS_FILE, CERYLE_DATA_DIR, CERYLE_HIST_FILE, CERYLE_LICENSE_FILE, CERYLE_PREF_FILE, CERYLE_PROP, CERYLE_PROP_BASE, CERYLE_PROP_FILE, CERYLE_RSRC_DIR, CERYLE_THANKS_FILE, CFLEX, Colon, COLON, Comma, COMMA, CR, CRet, Dash, DASH, DEFAULT_DIRECTORY, DEVELOPER, DOLR, Dot, DOT, EIGHT, Ellip, EOF, EqQuot, EQUAL, Equals, False, FALSE, FileProt, Filesep, FileURL, Five, FIVE, FONTSIZES, Four, FOUR, FSchar, GCOL_PROP, GRAPH_PROP, GRAVE, GT, Hash, HASH, HOME_DIRECTORY, HOME_DIRECTORY_PATH, HOME_DIRECTORY_URL, HTML, HttpProt, HttpURL, INDENT, INDENT_0, INDENT_1, INDENT_10, INDENT_2, INDENT_3, INDENT_4, INDENT_5, INDENT_6, INDENT_7, INDENT_8, INDENT_9, INIT, LCURL, LCurly, LF, LFS, Localhost, LPAR, LParen, LS, LSBrkt, LSBrkt2, LSQB, LT, MT, NBSP, NEL, NINE, NL, NL20x, NLchar, No, Null, NULL, NULL_STATE, NumParams, One, ONE, Pathsep, Percent, PERO, PLUS, Prcnt, PS, QMark, QMARK, Quot, QUOT, RCURL, RCurly, RESOURCE_BUNDLE, RPAR, RParen, RSBrkt, RSBrkt2, RSQB, Semi, SEMI, SEVEN, SIX, Slash, SLASH, SP, SPACE, Stago, Star, STAR, Tab, TAB, Tee, Three, THREE, Tilde, TILDE, TM_PROP, True, TRUE, Two, TWO, Under, UNDER, URI, URL, VBar, WIKI_PROP, XNodePfx, XNodeURL, XtmExt, Yes, Zero, ZERO
 
Constructor Summary
XtmSerializer()
          Default constructor.
 
Method Summary
protected  String normalize(String s)
          Normalizes the given string.
 String status()
          Returns a status message String indicating the number of topics and associations in this XtmDocument.
protected  void write(XtmNode node, int nest)
          Recursively writes the specified Node.
 void write(XtmNode node, String sysid, String encoding)
          Writes the specified XtmNode (generally an XtmDocument) to the system identifier provided, using the encoding provided (default if null).
 void write(XtmNode node, Writer writer)
          Writes the specified XtmNode (generally an XtmDocument, though this is not required) with the Writer provided, using the default encoding.
protected  void writeAssociationNode(XtmNode node, int nest)
          Writes an XtmAssociation Node.
protected  void writeBaseNameNode(XtmNode node, int nest)
          Writes an XtmBaseName Node.
protected  void writeCommentNode(XtmNode node, int nest)
          Writes an XtmComment Node.
protected  void writeDocumentNode(XtmNode node, int nest)
          Writes an XtmDocument Node.
protected  void writeMemberNode(XtmNode node, int nest)
          Writes an XtmMember Node.
protected  void writeOccurrenceNode(XtmNode node, int nest)
          Writes an XtmOccurrence Node.
protected  void writeParametersNode(XtmNode node, int nest)
          Writes an XtmParameters Node.
protected  void writeProcessingInstructions(XtmNode node, int nest)
          Writes any processing instructions contained within the provided node.
protected  void writeResourceDataNode(XtmNode node, int nest)
          Writes an XtmResourceData Node.
protected  void writeScopeNode(XtmNode node, int nest)
          Writes an XtmScope Node.
protected  void writeTopicMapNode(XtmNode node, int nest)
          Writes an XtmTopicMap Node.
protected  void writeTopicNode(XtmNode node, int nest)
          Writes an XtmTopic Node.
protected  void writeVariantNode(XtmNode node, int nest)
          Writes an XtmVariant Node.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

XMLNS_xlink

public static final String XMLNS_xlink
A String containing the XML Namespace URI for XLink.

See Also:
Constant Field Values

DEFAULT_ENCODING

public static final String DEFAULT_ENCODING
Default XML Encoding

See Also:
Constant Field Values

DTD_directory

public static String DTD_directory
A String containing the default path to a local directory containing DTDs.


includeDOCTYPE

public static boolean includeDOCTYPE
When true, include the DOCTYPE declaration for XTM.


systemId

public String systemId
Default system identifier for DOCTYPE declaration.


cleanCommentWS

protected boolean cleanCommentWS
Constructor Detail

XtmSerializer

public XtmSerializer()
Default constructor.

Method Detail

write

public void write(XtmNode node,
                  Writer writer)
           throws XtmException
Writes the specified XtmNode (generally an XtmDocument, though this is not required) with the Writer provided, using the default encoding.

Throws:
XtmException

write

public void write(XtmNode node,
                  String sysid,
                  String encoding)
           throws XtmException
Writes the specified XtmNode (generally an XtmDocument) to the system identifier provided, using the encoding provided (default if null). If the system identifier sysid is null, this will write to stdout.

Throws:
XtmException

write

protected void write(XtmNode node,
                     int nest)
              throws IOException,
                     XtmException
Recursively writes the specified Node.

Throws:
IOException
XtmException

writeDocumentNode

protected void writeDocumentNode(XtmNode node,
                                 int nest)
                          throws IOException,
                                 XtmException
Writes an XtmDocument Node.

Throws:
IOException
XtmException

writeCommentNode

protected void writeCommentNode(XtmNode node,
                                int nest)
                         throws IOException,
                                XtmException
Writes an XtmComment Node.

Throws:
IOException
XtmException

writeTopicMapNode

protected void writeTopicMapNode(XtmNode node,
                                 int nest)
                          throws IOException,
                                 XtmException
Writes an XtmTopicMap Node.

Throws:
IOException
XtmException

writeProcessingInstructions

protected void writeProcessingInstructions(XtmNode node,
                                           int nest)
                                    throws IOException,
                                           XtmException
Writes any processing instructions contained within the provided node.

Throws:
IOException
XtmException

writeTopicNode

protected void writeTopicNode(XtmNode node,
                              int nest)
                       throws IOException,
                              XtmException
Writes an XtmTopic Node.

Throws:
IOException
XtmException

writeAssociationNode

protected void writeAssociationNode(XtmNode node,
                                    int nest)
                             throws IOException,
                                    XtmException
Writes an XtmAssociation Node.

Throws:
IOException
XtmException

writeMemberNode

protected void writeMemberNode(XtmNode node,
                               int nest)
                        throws IOException,
                               XtmException
Writes an XtmMember Node.

Throws:
IOException
XtmException

writeBaseNameNode

protected void writeBaseNameNode(XtmNode node,
                                 int nest)
                          throws IOException,
                                 XtmException
Writes an XtmBaseName Node.

Throws:
IOException
XtmException

writeOccurrenceNode

protected void writeOccurrenceNode(XtmNode node,
                                   int nest)
                            throws IOException,
                                   XtmException
Writes an XtmOccurrence Node.

Throws:
IOException
XtmException

writeResourceDataNode

protected void writeResourceDataNode(XtmNode node,
                                     int nest)
                              throws IOException,
                                     XtmException
Writes an XtmResourceData Node.

Throws:
IOException
XtmException

writeScopeNode

protected void writeScopeNode(XtmNode node,
                              int nest)
                       throws IOException,
                              XtmException
Writes an XtmScope Node.

Throws:
IOException
XtmException

writeVariantNode

protected void writeVariantNode(XtmNode node,
                                int nest)
                         throws IOException,
                                XtmException
Writes an XtmVariant Node.

Throws:
IOException
XtmException

writeParametersNode

protected void writeParametersNode(XtmNode node,
                                   int nest)
                            throws IOException,
                                   XtmException
Writes an XtmParameters Node.

Throws:
IOException
XtmException

status

public String status()
Returns a status message String indicating the number of topics and associations in this XtmDocument.


normalize

protected String normalize(String s)
Normalizes the given string.



The Ceryle Project. Copyright ©2001-2007 Murray Altheim, All Rights Reserved. See LICENSE included with distribution.