net.sf.saxon.event

Class StartTagBuffer

public class StartTagBuffer extends ProxyReceiver implements NamespaceResolver

StartTagBuffer is a ProxyReceiver that buffers attributes and namespace events within a start tag. It maintains details of the namespace context, and a full set of attribute information, on behalf of other filters that need access to namespace information or need to process attributes in arbitrary order.
Field Summary
AttributeCollectionImplbufferedAttributes
intelementLocationId
intelementNameCode
intelementProperties
intelementTypeCode
Method Summary
voidattribute(int nameCode, int typeCode, CharSequence value, int locationId, int properties)
Notify an attribute.
protected voiddeclareAllNamespaces()
protected voiddeclareNamespacesForStartElement()
voidendElement()
endElement: Discard the namespaces declared on this element.
StringgetAttribute(int nameCode)
Get the value of the current attribute with a given nameCode
intgetElementNameCode()
Get the name of the current element
protected shortgetURICode(short prefixCode)
Get the URI code corresponding to a given prefix code, by searching the in-scope namespaces.
StringgetURIForPrefix(String prefix, boolean useDefault)
Get the namespace URI corresponding to a given prefix.
booleanhasAttributes()
Determine if the current element has any attributes
IteratoriteratePrefixes()
Get an iterator over all the prefixes declared in this namespace context.
voidnamespace(int namespaceCode, int properties)
voidsetPipelineConfiguration(PipelineConfiguration config)
voidstartContent()
startContent: Add any namespace undeclarations needed to stop namespaces being inherited from parent elements
voidstartElement(int nameCode, int typeCode, int locationId, int properties)
startElement
protected voidundeclareNamespacesForElement()

Field Detail

bufferedAttributes

AttributeCollectionImpl bufferedAttributes

elementLocationId

int elementLocationId

elementNameCode

int elementNameCode

elementProperties

int elementProperties

elementTypeCode

int elementTypeCode

Method Detail

attribute

public void attribute(int nameCode, int typeCode, CharSequence value, int locationId, int properties)
Notify an attribute. Attributes are notified after the startElement event, and before any children. Namespaces and attributes may be intermingled.

Parameters: nameCode The name of the attribute, as held in the name pool typeCode The type of the attribute, as held in the name pool properties Bit significant value. The following bits are defined:

DISABLE_ESCAPING
Disable escaping for this attribute
NO_SPECIAL_CHARACTERS
Attribute value contains no special characters

Throws: IllegalStateException: attempt to output an attribute when there is no open element start tag

declareAllNamespaces

protected void declareAllNamespaces()

declareNamespacesForStartElement

protected void declareNamespacesForStartElement()

endElement

public void endElement()
endElement: Discard the namespaces declared on this element.

getAttribute

public String getAttribute(int nameCode)
Get the value of the current attribute with a given nameCode

Returns: the attribute value, or null if the attribute is not present

getElementNameCode

public int getElementNameCode()
Get the name of the current element

getURICode

protected short getURICode(short prefixCode)
Get the URI code corresponding to a given prefix code, by searching the in-scope namespaces. This is a service provided to subclasses.

Parameters: prefixCode the 16-bit prefix code required

Returns: the 16-bit URI code, or -1 if the prefix is not bound to any namespace

getURIForPrefix

public String getURIForPrefix(String prefix, boolean useDefault)
Get the namespace URI corresponding to a given prefix. Return null if the prefix is not in scope.

Parameters: prefix the namespace prefix useDefault true if the default namespace is to be used when the prefix is ""

Returns: the uri for the namespace, or null if the prefix is not in scope

hasAttributes

public boolean hasAttributes()
Determine if the current element has any attributes

iteratePrefixes

public Iterator iteratePrefixes()
Get an iterator over all the prefixes declared in this namespace context. This will include the default namespace (prefix="") and the XML namespace where appropriate

namespace

public void namespace(int namespaceCode, int properties)

setPipelineConfiguration

public void setPipelineConfiguration(PipelineConfiguration config)

startContent

public void startContent()
startContent: Add any namespace undeclarations needed to stop namespaces being inherited from parent elements

startElement

public void startElement(int nameCode, int typeCode, int locationId, int properties)
startElement

undeclareNamespacesForElement

protected void undeclareNamespacesForElement()