|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object net.sf.saxon.event.SequenceReceiver net.sf.saxon.event.ComplexContentOutputter
public final class ComplexContentOutputter
This class is used for generating complex content, that is, the content of an element or document node. It enforces the rules on the order of events within complex content (attributes and namespaces must come first), and it implements part of the namespace fixup rules, in particular, it ensures that there is a namespace node for the namespace used in the element name and in each attribute name.
The same ComplexContentOutputter may be used for generating an entire XML document; it is not necessary to create a new outputter for each element node.
Field Summary |
---|
Fields inherited from class net.sf.saxon.event.SequenceReceiver |
---|
pipelineConfiguration, previousAtomic, systemId |
Fields inherited from interface javax.xml.transform.Result |
---|
PI_DISABLE_OUTPUT_ESCAPING, PI_ENABLE_OUTPUT_ESCAPING |
Constructor Summary | |
---|---|
ComplexContentOutputter(PipelineConfiguration pipe)
Create a ComplexContentOutputter |
Method Summary | |
---|---|
void |
append(Item item,
int locationId,
int copyNamespaces)
Append an arbitrary item (node or atomic value) to the output |
void |
attribute(NodeName attName,
SimpleType typeCode,
CharSequence value,
int locationId,
int properties)
Output an attribute value. |
void |
characters(CharSequence s,
int locationId,
int properties)
Produce text content output. |
void |
close()
Close the output |
void |
comment(CharSequence comment,
int locationId,
int properties)
Write a comment |
boolean |
contentHasBeenWritten()
Test whether any content has been written to this ComplexContentOutputter |
void |
endDocument()
Notify the end of a document node |
void |
endElement()
Output an element end tag. |
void |
namespace(NamespaceBinding nsBinding,
int properties)
Output a namespace declaration. |
void |
open()
Start the output process |
void |
processingInstruction(String target,
CharSequence data,
int locationId,
int properties)
Write a processing instruction |
void |
setHostLanguage(int language)
Set the host language |
void |
setPipelineConfiguration(PipelineConfiguration pipe)
Set the pipeline configuration |
void |
setReceiver(Receiver receiver)
Set the receiver (to handle the next stage in the pipeline) directly |
void |
startContent()
Flush out a pending start tag |
void |
startDocument(int properties)
Start of a document node. |
void |
startElement(NodeName elemName,
SchemaType typeCode,
int locationId,
int properties)
Output an element start tag. |
boolean |
usesTypeAnnotations()
Ask whether this Receiver (or the downstream pipeline) makes any use of the type annotations supplied on element and attribute events |
Methods inherited from class net.sf.saxon.event.SequenceReceiver |
---|
append, getConfiguration, getNamePool, getPipelineConfiguration, getSystemId, setSystemId, setUnparsedEntity |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ComplexContentOutputter(PipelineConfiguration pipe)
pipe
- the pipeline configurationMethod Detail |
---|
public void setPipelineConfiguration(PipelineConfiguration pipe)
Receiver
setPipelineConfiguration
in interface Receiver
setPipelineConfiguration
in class SequenceReceiver
pipe
- the pipeline configurationpublic void setHostLanguage(int language)
language
- the host language, for example Configuration.XQUERY
public void setReceiver(Receiver receiver)
receiver
- the receiver to handle the next stage in the pipelinepublic boolean contentHasBeenWritten()
public void open() throws XPathException
open
in interface Receiver
open
in class SequenceReceiver
XPathException
- if an error occurspublic void startDocument(int properties) throws XPathException
properties
- bit-significant integer indicating properties of the document node.
The definitions of the bits are in class ReceiverOptions
XPathException
- if an error occurspublic void endDocument() throws XPathException
XPathException
- if an error occurspublic void characters(CharSequence s, int locationId, int properties) throws XPathException
s
- The String to be outputlocationId
- an integer which can be interpreted using a LocationProvider
to return information such as line number and system ID. If no location information is available,
the value zero is supplied.properties
- Bit significant value. The following bits are defined:
XPathException
- for any failurepublic void startElement(NodeName elemName, SchemaType typeCode, int locationId, int properties) throws XPathException
elemName
- The element nametypeCode
- the type annotation of the element.locationId
- an integer which can be interpreted using a LocationProvider
to return
information such as line number and system ID. If no location information is available,
the value zero is supplied.properties
- bit-significant properties of the element node. If there are no revelant
properties, zero is supplied. The definitions of the bits are in class ReceiverOptions
XPathException
- if an error occurspublic void namespace(NamespaceBinding nsBinding, int properties) throws XPathException
nsBinding
- The namespace bindingproperties
- The most important property is REJECT_DUPLICATES. If this property is set, the
namespace declaration will be rejected if it conflicts with a previous declaration of the same
prefix. If the property is not set, the namespace declaration will be ignored if it conflicts
with a previous declaration. This reflects the fact that when copying a tree, namespaces for child
elements are emitted before the namespaces of their parent element. Unfortunately this conflicts
with the XSLT rule for complex content construction, where the recovery action in the event of
conflicts is to take the namespace that comes last. XSLT therefore doesn't recover from this error:
XPathException
- if there is no start tag to write to (created using writeStartTag),
or if character content has been written since the start tag was written.public void attribute(NodeName attName, SimpleType typeCode, CharSequence value, int locationId, int properties) throws XPathException
attName
- The name of the attributevalue
- The value of the attributeproperties
- Bit fields containing properties of the attribute to be writtentypeCode
- The type of the attribute, as held in the name pool. The additional bit
NodeInfo.IS_DTD_TYPE may be set to indicate a DTD-derived type.locationId
- an integer which can be interpreted using a LocationProvider
to return
information such as line number and system ID. If no location information is available,
the value zero is supplied.
XPathException
- if there is no start tag to write to (created using writeStartTag),
or if character content has been written since the start tag was written.public void endElement() throws XPathException
XPathException
- if an error occurspublic void comment(CharSequence comment, int locationId, int properties) throws XPathException
comment
- The content of the commentlocationId
- an integer which can be interpreted using a LocationProvider
to return
information such as line number and system ID. If no location information is available,
the value zero is supplied.properties
- Additional information about the comment.
XPathException
- if an error occurspublic void processingInstruction(String target, CharSequence data, int locationId, int properties) throws XPathException
target
- The PI name. This must be a legal name (it will not be checked).data
- The data portion of the processing instructionlocationId
- an integer which can be interpreted using a LocationProvider
to return
information such as line number and system ID. If no location information is available,
the value zero is supplied.properties
- Additional information about the PI.
XPathException
- if an error occurspublic void append(Item item, int locationId, int copyNamespaces) throws XPathException
append
in class SequenceReceiver
item
- the item to be appendedlocationId
- the location of the calling instruction, for diagnosticscopyNamespaces
- if the item is an element node, this indicates whether its namespaces
need to be copied. Values are NodeInfo.ALL_NAMESPACES
,
NodeInfo.LOCAL_NAMESPACES
, NodeInfo.NO_NAMESPACES
XPathException
- if the operation failspublic void close() throws XPathException
XPathException
- if an error occurspublic void startContent() throws XPathException
XPathException
- if an error occurspublic boolean usesTypeAnnotations()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |