|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.novell.xsl.result.SerializerImpl com.novell.xsl.result.XMLSerializer
Class to output the XSLT result tree as
a sequence of bytes representing the
result tree as serialized XML
This implements the
Field Summary | |
protected List |
attributeNames
|
protected List |
attributeValues
|
protected boolean |
cdataOutput
|
protected boolean |
children
|
protected NamespaceStack |
currentNamespaces
|
protected int |
elementCount
|
protected String |
elementName
|
protected boolean |
forceDTD
|
protected int |
indentLevel
|
protected int |
nodeType
|
protected boolean |
noEscape
|
protected boolean |
startTagOpen
|
protected Stack |
stateStack
|
protected static int |
XML_SPACE_DEFAULT
|
protected static int |
XML_SPACE_PRESERVE
|
protected int |
xmlSpace
|
protected static Integer |
xmlSpaceDefault
|
protected static Integer |
xmlSpacePreserve
|
Fields inherited from class com.novell.xsl.result.SerializerImpl |
actualEncoding, options, stream, writer |
Constructor Summary | |
XMLSerializer()
Construct a default XML serializer |
|
XMLSerializer(OutputStream stream)
Construct an XML serializer that will output to the passed stream |
Method Summary | |
void |
attribute(String name,
String value)
Receive notification of an attribute. |
void |
characters(String data)
Receive notification of character data. |
protected void |
closeStartTag()
Close any open element start tag |
void |
comment(String value)
Receive notification of a comment. |
protected void |
doIndent(int level)
Indent up to indent level This is provided so HTMLSerializer can override it |
void |
endDocument()
Receive notification of the end of a document. |
void |
endElement(String name)
Receive notification of the end of an element. |
protected ExpandedQName |
getExpandedName(String qName,
boolean isAttribute)
Get the expanded name for a node QName using the currently in-scope namespace nodes. |
protected void |
initState()
Initialize the state at the start of a document |
protected void |
injectWhitespace(int nodeType,
int lastNodeType)
Optionally inject whitespace into the output to "pretty print" the serialized XML |
void |
namespace(String name,
NamespaceName value)
Receive notification of a namespace node. |
void |
noTextEscaping(boolean noEscape)
Tell Serializer to do no text escaping |
protected void |
outputXMLAttribute(ExpandedQName name,
String value)
Serialize an XML attribute name |
protected void |
popState()
Restore the last element state |
void |
processingInstruction(String target,
String value)
Receive notification of a processing instruction. |
protected void |
pushState()
Save the current element state |
void |
startDocument()
Receive notification of the beginning of a document. |
void |
startElement(String name,
String namespaceURI)
Receive notification of the beginning of an element. |
protected boolean |
useCdataOutput(String name)
Return whether or not CDATA section output should be used for text children of the passed element name |
protected void |
writeDTD(String name)
Write a DTD declaration. |
Methods inherited from class com.novell.xsl.result.SerializerImpl |
getOptions, getStream, initWriter, setOptions, setStream |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface com.novell.xsl.result.Serializer |
getOptions, getStream, setOptions, setStream |
Field Detail |
protected int elementCount
protected boolean startTagOpen
protected boolean noEscape
protected boolean forceDTD
protected int indentLevel
protected int nodeType
protected List attributeNames
protected List attributeValues
protected boolean children
protected String elementName
protected NamespaceStack currentNamespaces
protected boolean cdataOutput
protected Stack stateStack
protected static final int XML_SPACE_DEFAULT
protected static final int XML_SPACE_PRESERVE
protected static final Integer xmlSpaceDefault
protected static final Integer xmlSpacePreserve
protected int xmlSpace
Constructor Detail |
public XMLSerializer()
public XMLSerializer(OutputStream stream)
Method Detail |
public void startDocument() throws ResultException
startDocument
in interface ResultHandler
ResultException
- if an implementation-dependent error occurspublic void endDocument() throws ResultException
endDocument
in interface ResultHandler
ResultException
- if an implementation-dependent error occurspublic void startElement(String name, String namespaceURI) throws IllegalNameException, IllegalNodeException, ResultException
startElement
in interface ResultHandler
name
- the element's namenamespaceURI
- the element's namespace uri
IllegalNameException
- if the specified element name is illegal
IllegalNodeException
- if the current node cannot contain elements
ResultException
- if an implementation-dependent error occurspublic void endElement(String name) throws ResultException
endElement
in interface ResultHandler
ResultException
- if an implementation-dependent error occurspublic void attribute(String name, String value) throws AttributeAfterChildException, IllegalNameException, IllegalNodeException, ResultException
attribute
in interface ResultHandler
name
- the attribute's namevalue
- the attribute's value
AttributeAfterChildException
- if the current node is an element with children
(attributes cannot be added to an element after children
have been added to it)
IllegalNameException
- if the specified attribute name is illegal
IllegalNodeException
- if the current node is not an element
ResultException
- if an implementation-dependent error occurspublic void characters(String data) throws IllegalNodeException, ResultException
characters
in interface ResultHandler
data
- the character data
IllegalNodeException
- if the current node cannot contain character data
ResultException
- if an implementation-dependent error occurspublic void processingInstruction(String target, String value) throws IllegalNameException, IllegalNodeException, ResultException
processingInstruction
in interface ResultHandler
target
- the processing instruction's targetvalue
- the processing instruction's value, or null
if there is no value
IllegalNameException
- if the specified target name is illegal
IllegalNodeException
- if the current node cannot contain processing
instructions
ResultException
- if an implementation-dependent error occurspublic void comment(String value) throws IllegalNodeException, ResultException
comment
in interface ResultHandler
value
- the comment's value
IllegalNodeException
- if the current node cannot contain comments
ResultException
- if an implementation-dependent error occurspublic void namespace(String name, NamespaceName value) throws IllegalNodeException, ResultException
namespace
in interface ResultHandler
name
- the namespace prefixvalue
- the namespace name (URI)
IllegalNodeException
- if the current node cannot contain namespaces
ResultException
- if an implementation-dependent error occurspublic void noTextEscaping(boolean noEscape)
noTextEscaping
in interface Serializer
noTextEscaping
in class SerializerImpl
noEscape
- True if no escaping should
be performed, false if escaping should be
performedprotected void writeDTD(String name) throws IOException
name
- The name for the DTD
IOException
protected void closeStartTag() throws IOException, ResultException
IOException
ResultException
protected void injectWhitespace(int nodeType, int lastNodeType) throws IOException
nodeType
- The type of the current node (the node before
which whitespace will be injected.lastNodeType
- The type of the node that preceded the
current node.
IOException
protected void doIndent(int level) throws IOException
level
- Number of tabs to output
IOException
protected boolean useCdataOutput(String name) throws IllegalNameException
name
- The element name to check
IllegalNameException
protected void initState()
protected void pushState()
protected void popState()
protected ExpandedQName getExpandedName(String qName, boolean isAttribute) throws IllegalNameException
qName
- The QName to expandisAttribute
- True if the name is for an attribute node
IllegalNameException
protected void outputXMLAttribute(ExpandedQName name, String value) throws IOException
name
- The expanded name of the attribute.value
- The value of the attribute
IOException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |