net.sf.swan.xml.output
Class FragmentResult

java.lang.Object
  |
  +--net.sf.swan.xml.output.Result
        |
        +--net.sf.swan.xml.output.ContainerResult
              |
              +--net.sf.swan.xml.output.FragmentResult
Direct Known Subclasses:
DocumentResult

public class FragmentResult
extends ContainerResult

Top-level result that emits its content out to a SAX ContentHandler and optional LexicalHandler. Note that the FragmentResult will not emit startDocument or endDocument events to the ContentHandler. It is up to the application to do so.


Inner classes inherited from class net.sf.swan.xml.output.ContainerResult
ContainerResult.NamespaceBinding
 
Fields inherited from class net.sf.swan.xml.output.ContainerResult
namespacePrefixMap, namespaceUriMap, stopChild
 
Fields inherited from class net.sf.swan.xml.output.Result
END_OUTPUT, NO_OUTPUT, outputState, parent, START_OUTPUT
 
Constructor Summary
FragmentResult(org.xml.sax.ContentHandler handler, org.xml.sax.ext.LexicalHandler lexicalHandler)
           
 
Method Summary
protected  ElementResult element(java.lang.String namespaceUri, java.lang.String localName, java.lang.String qName, org.xml.sax.Attributes atts)
           
 ContainerResult end()
          Output this Result and return it's parent.
 boolean getEmitNamespaceAttributes()
          Indicates whether namespace declarations are emitted as attributes.
protected  void getLocationString(java.lang.StringBuffer buffer)
           
protected  void namespace(java.lang.String prefix, java.lang.String namespaceUri)
           
protected  void output(Result descendant)
           
 void setEmitNamespaceAttributes(boolean emit)
          Sets the option for emitting namespace declarations as attributes.
protected  void startOutput(Result stopChild)
           
 FragmentResult xmlns(java.lang.String prefix, java.lang.String namespaceUri)
          Create a namespace declaration in the current context.
 
Methods inherited from class net.sf.swan.xml.output.ContainerResult
cdata, comment, element, element, element, element, flush, getLocationString, getNamespacePrefix, output, outputChildren, processingInstruction, resolveNamespacePrefix, startOutput, text, verifyAllowChild
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FragmentResult

public FragmentResult(org.xml.sax.ContentHandler handler,
                      org.xml.sax.ext.LexicalHandler lexicalHandler)
Method Detail

end

public ContainerResult end()
                    throws java.io.IOException,
                           org.xml.sax.SAXException
Description copied from class: Result
Output this Result and return it's parent. Note that any preceding accumulated output necessary for preserving well-formedness will also be emitted, so this will have the side effect of emitting the start tags for any ancestor elements, and invoking end() on any complete results that precede this one in document order.
Overrides:
end in class Result

xmlns

public FragmentResult xmlns(java.lang.String prefix,
                            java.lang.String namespaceUri)
                     throws ResultException
Create a namespace declaration in the current context. Any subsequent child elements created by this fragment will include this namespace mapping.
Parameters:
prefix - the namespace prefix
namespaceUri - the namespace URI
Returns:
this same FragmentResult

setEmitNamespaceAttributes

public void setEmitNamespaceAttributes(boolean emit)
Sets the option for emitting namespace declarations as attributes. Namespace declarations will always be provided to the associated ContentHandler via the startPrefixMapping and endPrefixMapping events. If this option is set to true, then namespace declarations are also included in the Attributes provided for elements.

getEmitNamespaceAttributes

public boolean getEmitNamespaceAttributes()
Indicates whether namespace declarations are emitted as attributes.
See Also:
setEmitNamespaceAttributes(boolean)

namespace

protected void namespace(java.lang.String prefix,
                         java.lang.String namespaceUri)
                  throws ResultException
Overrides:
namespace in class ContainerResult

output

protected void output(Result descendant)
               throws java.io.IOException,
                      org.xml.sax.SAXException
Overrides:
output in class ContainerResult

startOutput

protected void startOutput(Result stopChild)
                    throws java.io.IOException,
                           org.xml.sax.SAXException
Overrides:
startOutput in class ContainerResult

element

protected ElementResult element(java.lang.String namespaceUri,
                                java.lang.String localName,
                                java.lang.String qName,
                                org.xml.sax.Attributes atts)
                         throws org.xml.sax.SAXException
Overrides:
element in class ContainerResult

getLocationString

protected void getLocationString(java.lang.StringBuffer buffer)
Overrides:
getLocationString in class ContainerResult