net.sf.saxon.event
public class StartTagBuffer extends ProxyReceiver implements NamespaceResolver
StartTagBuffer also implements namespace fixup (the process of creating namespace nodes|bindings on behalf of constructed element and attribute nodes). Although this would be done anyway, further down the pipeline, it has to be done early in the case of a validating pipeline, because the namespace bindings must be created before any namespace-sensitive attribute content is validated.
The StartTagBuffer also allows error conditions to be buffered. This is because the XSIAttributeHandler validates attributes such as xsi:type and xsi:nil before attempting to match its parent element against a particle of its containing type. It is possible that the parent element will match a wildcard particle with processContents="skip", in which case an invalid xsi:type or xsi:nil attribute is not an error.
Field Summary | |
---|---|
AttributeCollectionImpl | bufferedAttributes |
int | elementLocationId |
int | elementNameCode |
int | elementProperties |
int | elementTypeCode |
LocationProvider | inputLocationProvider |
Method Summary | |
---|---|
void | attribute(int nameCode, int typeCode, CharSequence value, int locationId, int properties)
Notify an attribute. |
protected void | declareAllNamespaces() |
protected void | declareNamespacesForStartElement() |
void | endDocument()
Notify the end of a document node |
void | endElement()
endElement: Discard the namespaces declared on this element. |
AttributeCollection | getAllAttributes()
Get all the attributes on the current element start tag |
String | getAttribute(int nameCode)
Get the value of the current attribute with a given nameCode |
int | getElementNameCode()
Get the name of the current element |
NodeInfo | getElementNode()
Get an element node representing the element whose start tag this is, as required
for implementing conditional type assignment |
int[] | getLocalNamespaces() |
protected short | getURICode(short prefixCode)
Get the URI code corresponding to a given prefix code, by searching the
in-scope namespaces. |
String | getURIForPrefix(String prefix, boolean useDefault)
Get the namespace URI corresponding to a given prefix. |
boolean | hasAttributes()
Determine if the current element has any attributes |
Iterator | iteratePrefixes()
Get an iterator over all the prefixes declared in this namespace context. |
void | namespace(int namespaceCode, int properties) |
void | setPipelineConfiguration(PipelineConfiguration pipe)
Set the pipeline configuration |
void | startContent()
startContent: Add any namespace undeclarations needed to stop
namespaces being inherited from parent elements |
void | startDocument(int properties)
Start of a document node. |
void | startElement(int nameCode, int typeCode, int locationId, int properties)
startElement |
protected void | undeclareNamespacesForElement() |
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:
Throws: IllegalStateException: attempt to output an attribute when there is no open element start tag
Returns: an AttributeCollection containing all the attributes
Parameters: nameCode the name of the required attribute
Returns: the attribute value, or null if the attribute is not present
Returns: the namepool namecode of the element
Returns: an element node. This contains all the required namespaces and attributes, and has no children; it is untyped, as are the attributes.
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
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
Returns: true if the element has one or more attributes
Parameters: pipe the pipeline configuration