org.millscript.millscript.render
Class XML10Renderer

java.lang.Object
  extended by org.millscript.millscript.render.AbstractRenderer
      extended by org.millscript.millscript.render.XML10Renderer
All Implemented Interfaces:
Renderer
Direct Known Subclasses:
XSLTRenderer

public class XML10Renderer
extends AbstractRenderer

This class implements MillScripts XML renderer. It renders to the XML 1.0 specification, but may not always render valid XML 1.0.

The renderers ability to render valid XML depends on the input it's provided, e.g. supported tags. The main issue with the renderer is that database content can contain XML tags, as a result we cannot automatically encode "<" characters that occur in string content. When we can parse database content into strings, XmlElement, etc, our ability to render valid documents will greatly improve.


Field Summary
 
Fields inherited from class org.millscript.millscript.render.AbstractRenderer
availableEntities, config, outputCharset, outputEncoder, outputVFile, outputWriter
 
Constructor Summary
XML10Renderer(Configuration conf, org.millscript.commons.vfs.VFile file)
          Constructs a new XML renderer, to render to the specified virtual file using the given confguration.
 
Method Summary
 void append(char ch)
          Appends the specified character, allowing the character to be escaped as appropriate for this renderer.
 void appendEscapeFor(char ch)
          Appends the escape sequence for the specified character.
 void appendNoEscape(char ch)
          Appends the specified character, without using an escape sequence.
 java.lang.String getUniquePrefix(org.millscript.commons.xml.api.Name tagName)
          Returns a new unique prefix based on the specified elements.
 void renderCDATA(CDATA c)
          Renders the specified CDATA object using this renderer.
 void renderDocumentFooter()
          Renders the required document footer for this renderer.
 void renderDocumentHeader()
          Renders the required document header for this renderer.
 void renderObject(java.lang.Object o)
          Renders the specified object using this renderer.
 void renderXMLElement(XmlElement x)
          Renders the specified XML element using this renderer.
 void renderXMLElementAttributeValue(org.millscript.commons.xml.api.Name name, java.lang.String value)
           
 
Methods inherited from class org.millscript.millscript.render.AbstractRenderer
append, appendNoEscape, canEncode, render, renderAsDocument, renderAsFragment, renderXMLComment
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

XML10Renderer

public XML10Renderer(Configuration conf,
                     org.millscript.commons.vfs.VFile file)
Constructs a new XML renderer, to render to the specified virtual file using the given confguration.

Parameters:
conf - the configuration to get rendering parameters from
file - the virtual output file
Method Detail

append

public final void append(char ch)
                  throws java.io.IOException
Description copied from interface: Renderer
Appends the specified character, allowing the character to be escaped as appropriate for this renderer.

Parameters:
ch - the character to append, allowing it to be escaped
Throws:
java.io.IOException - thrown if an IO problem occurs
See Also:
Renderer.append(char)

appendEscapeFor

public final void appendEscapeFor(char ch)
                           throws java.io.IOException
Description copied from interface: Renderer
Appends the escape sequence for the specified character.

Parameters:
ch - the character to append an escape sequence for
Throws:
java.io.IOException - thrown if an IO problem occurs
See Also:
Renderer.appendEscapeFor(char)

appendNoEscape

public final void appendNoEscape(char ch)
                          throws java.io.IOException
Description copied from interface: Renderer
Appends the specified character, without using an escape sequence. This method will raise an alert if the character cannot be appended without an escape sequence.

Parameters:
ch - the character to append, without using an escape sequence.
Throws:
java.io.IOException - thrown if an IO problem occurs
See Also:
Renderer.appendNoEscape(char)

renderCDATA

public final void renderCDATA(CDATA c)
                       throws java.io.IOException
Description copied from interface: Renderer
Renders the specified CDATA object using this renderer.

Specified by:
renderCDATA in interface Renderer
Overrides:
renderCDATA in class AbstractRenderer
Parameters:
c - the CDATA object to render
Throws:
java.io.IOException - thrown if an IO problem occurs
See Also:
Renderer.renderCDATA(org.millscript.millscript.datatypes.CDATA)

renderDocumentFooter

public final void renderDocumentFooter()
                                throws java.io.IOException
Description copied from interface: Renderer
Renders the required document footer for this renderer.

Throws:
java.io.IOException - thrown if an IO problem occurs
See Also:
Renderer.renderDocumentFooter()

renderDocumentHeader

public final void renderDocumentHeader()
                                throws java.io.IOException
Description copied from interface: Renderer
Renders the required document header for this renderer.

Throws:
java.io.IOException - thrown if an IO problem occurs
See Also:
Renderer.renderDocumentHeader()

renderObject

public final void renderObject(java.lang.Object o)
                        throws java.io.IOException
Description copied from interface: Renderer
Renders the specified object using this renderer.

Parameters:
o - the object to render
Throws:
java.io.IOException - thrown if an IO problem occurs
See Also:
Renderer.renderObject(java.lang.Object)

renderXMLElement

public final void renderXMLElement(XmlElement x)
                            throws java.io.IOException
Description copied from interface: Renderer
Renders the specified XML element using this renderer.

Parameters:
x - the XML element to render
Throws:
java.io.IOException - thrown if an IO problem occurs
See Also:
Renderer.renderXMLElement(org.millscript.millscript.datatypes.XmlElement)

renderXMLElementAttributeValue

public void renderXMLElementAttributeValue(org.millscript.commons.xml.api.Name name,
                                           java.lang.String value)
                                    throws java.io.IOException
Throws:
java.io.IOException

getUniquePrefix

public java.lang.String getUniquePrefix(org.millscript.commons.xml.api.Name tagName)
Returns a new unique prefix based on the specified elements. This method should only be used in situations where the elements namespace is not declared, but the prefix is in use. By definition when this method returns a new namepsace will have been declared and an xmlns attribute must be written.

Parameters:
tagName - the element to declare a new unique prefix/namespace for
Returns:
the unique prefix for the specified elements prefix/namespace


Copyright © 2001-2007 Open World Ltd. All Rights Reserved.