net.sf.swan.xml.output
Class ContainerResult
java.lang.Object
|
+--net.sf.swan.xml.output.Result
|
+--net.sf.swan.xml.output.ContainerResult
- Direct Known Subclasses:
- ElementResult, FragmentResult
- public abstract class ContainerResult
- extends Result
A Result
that may contain other Results
as children. Each of the factory methods appends any newly created
result to the end of the list of children.
Method Summary |
ContainerResult |
cdata(java.lang.String text)
Create CDATA output as child content of this result. |
ContainerResult |
comment(java.lang.String text)
Create a comment as child content of this result. |
ElementResult |
element(java.lang.String qName)
Create an ElementResult that will be output
as a child of this result. |
ElementResult |
element(java.lang.String qName,
org.xml.sax.Attributes atts)
Create an ElementResult that will be output
as a child of this result. |
ElementResult |
element(java.lang.String namespaceUri,
java.lang.String localName)
Create an ElementResult that will be output
as a child of this result. |
ElementResult |
element(java.lang.String namespaceUri,
java.lang.String localName,
org.xml.sax.Attributes atts)
Create an ElementResult that will be output
as a child of this result. |
protected ElementResult |
element(java.lang.String namespaceUri,
java.lang.String localName,
java.lang.String qName,
org.xml.sax.Attributes atts)
|
ContainerResult |
flush()
Outputs accumulated results, but does not end
this ContainerResult . |
java.lang.String |
getLocationString()
Provides an identifying string for the result node. |
protected abstract void |
getLocationString(java.lang.StringBuffer buffer)
|
protected java.lang.String |
getNamespacePrefix(java.lang.String namespaceURI,
boolean forAttribute)
|
protected void |
namespace(java.lang.String prefix,
java.lang.String namespaceUri)
|
protected void |
output(org.xml.sax.ContentHandler handler,
org.xml.sax.ext.LexicalHandler lexicalHandler,
boolean emitNamespaceAttrs)
|
protected void |
output(Result descendant)
|
protected void |
outputChildren(org.xml.sax.ContentHandler handler,
org.xml.sax.ext.LexicalHandler lexicalHandler,
boolean emitNamespaceAttrs)
|
ContainerResult |
processingInstruction(java.lang.String target,
java.lang.String data)
Create a processing instruction as child content of this result. |
protected java.lang.String |
resolveNamespacePrefix(java.lang.String prefix)
|
protected void |
startOutput(org.xml.sax.ContentHandler handler,
org.xml.sax.ext.LexicalHandler lexicalHandler,
boolean emitNamespaceAttrs)
|
protected void |
startOutput(Result stopChild)
|
ContainerResult |
text(java.lang.String text)
Create text output as child content of this result. |
protected void |
verifyAllowChild()
|
Methods inherited from class net.sf.swan.xml.output.Result |
end |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
namespaceUriMap
protected java.util.HashMap namespaceUriMap
namespacePrefixMap
protected java.util.HashMap namespacePrefixMap
stopChild
protected Result stopChild
ContainerResult
protected ContainerResult(ContainerResult parent)
element
public ElementResult element(java.lang.String qName)
throws org.xml.sax.SAXException
- Create an
ElementResult
that will be output
as a child of this result. Any namespace mappings
in scope will be used to resolve any namespace prefix
in the qualified name of the element.
- Parameters:
qName
- the qualified name of the new element- Returns:
- the newly created
ElementResult
element
public ElementResult element(java.lang.String qName,
org.xml.sax.Attributes atts)
throws org.xml.sax.SAXException
- Create an
ElementResult
that will be output
as a child of this result. Any namespace mappings
in scope will be used to resolve any namespace prefix
in the qualified name of the element.
- Parameters:
qName
- the qualified name of the new elementatts
- the initial attributes of the element, or null
- Returns:
- the newly created
ElementResult
element
public ElementResult element(java.lang.String namespaceUri,
java.lang.String localName)
throws org.xml.sax.SAXException
- Create an
ElementResult
that will be output
as a child of this result. If a non-empty namespace URI
is provided, any namespace mappings in scope will be used
to identify a prefix to use for the element's qualified name.
- Parameters:
namespaceUri
- the namespace URI of the elementlocalName
- the local name of the element- Returns:
- the newly created
ElementResult
element
public ElementResult element(java.lang.String namespaceUri,
java.lang.String localName,
org.xml.sax.Attributes atts)
throws org.xml.sax.SAXException
- Create an
ElementResult
that will be output
as a child of this result. If a non-empty namespace URI
is provided, any namespace mappings in scope will be used
to identify a prefix to use for the element's qualified name.
- Parameters:
namespaceUri
- the namespace URI of the elementlocalName
- the local name of the elementatts
- the initial attributes of the element, or null
- Returns:
- the newly created
ElementResult
text
public ContainerResult text(java.lang.String text)
throws org.xml.sax.SAXException
- Create text output as child content of this result.
- Returns:
- this
ContainerResult
cdata
public ContainerResult cdata(java.lang.String text)
throws org.xml.sax.SAXException
- Create CDATA output as child content of this result.
Depending upon the underlying SAX handlers receiving
events, the result tree may end up just
receiving a text result.
- Returns:
- this
ContainerResult
comment
public ContainerResult comment(java.lang.String text)
throws org.xml.sax.SAXException
- Create a comment as child content of this result.
Depending upon the underlying SAX handlers receiving
events, the comment may not be output.
- Returns:
- this
ContainerResult
processingInstruction
public ContainerResult processingInstruction(java.lang.String target,
java.lang.String data)
throws org.xml.sax.SAXException
- Create a processing instruction as child content of this result.
- Returns:
- this
ContainerResult
flush
public ContainerResult flush()
throws java.io.IOException,
org.xml.sax.SAXException
- Outputs accumulated results, but does not end
this
ContainerResult
. Additional children
may still be appended after this.
getLocationString
public java.lang.String getLocationString()
- Description copied from class:
Result
- Provides an identifying string for the result node.
- Overrides:
getLocationString
in class Result
resolveNamespacePrefix
protected java.lang.String resolveNamespacePrefix(java.lang.String prefix)
throws UnresolvableNamespaceException
getNamespacePrefix
protected java.lang.String getNamespacePrefix(java.lang.String namespaceURI,
boolean forAttribute)
throws UnresolvableNamespaceException
namespace
protected void namespace(java.lang.String prefix,
java.lang.String namespaceUri)
throws ResultException
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
output
protected void output(Result descendant)
throws java.io.IOException,
org.xml.sax.SAXException
startOutput
protected void startOutput(Result stopChild)
throws java.io.IOException,
org.xml.sax.SAXException
output
protected void output(org.xml.sax.ContentHandler handler,
org.xml.sax.ext.LexicalHandler lexicalHandler,
boolean emitNamespaceAttrs)
throws java.io.IOException,
org.xml.sax.SAXException
- Overrides:
output
in class Result
startOutput
protected void startOutput(org.xml.sax.ContentHandler handler,
org.xml.sax.ext.LexicalHandler lexicalHandler,
boolean emitNamespaceAttrs)
throws java.io.IOException,
org.xml.sax.SAXException
- Overrides:
startOutput
in class Result
outputChildren
protected void outputChildren(org.xml.sax.ContentHandler handler,
org.xml.sax.ext.LexicalHandler lexicalHandler,
boolean emitNamespaceAttrs)
throws java.io.IOException,
org.xml.sax.SAXException
verifyAllowChild
protected void verifyAllowChild()
throws org.xml.sax.SAXException
getLocationString
protected abstract void getLocationString(java.lang.StringBuffer buffer)