public final class InputElementStack extends Object implements org.codehaus.stax2.AttributeInfo, NamespaceContext, org.codehaus.stax2.validation.ValidationContext
This class also implements NamespaceContext, since it has all
the information necessary, so parser can just return element stack
instance as necesary.
| Modifier and Type | Field and Description |
|---|---|
protected AttributeCollector |
mAttrCollector |
protected ReaderConfig |
mConfig |
protected com.ctc.wstx.sr.Element |
mCurrElement
Currently open element, if any; null outside root element.
|
protected int |
mDepth |
protected com.ctc.wstx.sr.Element |
mFreeElement |
protected int |
mIdAttrIndex
Index of the attribute with type of ID, if known (most likely
due to Xml:id support); -1 if not available, or no ID attribute
for current element.
|
protected String |
mLastLocalName |
protected QName |
mLastName |
protected BaseNsContext |
mLastNsContext
Last potentially shareable NamespaceContext created by
this stack.
|
protected String |
mLastNsURI |
protected String |
mLastPrefix |
protected boolean |
mMayHaveNsDefaults |
protected StringVector |
mNamespaces
Vector that contains all currently active namespaces; one String for
prefix, another for matching URI.
|
protected boolean |
mNsAware |
protected NsDefaultProvider |
mNsDefaultProvider
Object that will need to be consulted about namespace bindings,
since it has some knowledge about default namespace declarations
(has default attribute value expansion).
|
protected InputProblemReporter |
mReporter |
protected long |
mTotalElements |
protected org.codehaus.stax2.validation.XMLValidator |
mValidator
Optional validator object that will get called if set,
and that can validate xml content.
|
| Modifier | Constructor and Description |
|---|---|
protected |
InputElementStack(ReaderConfig cfg,
boolean nsAware) |
| Modifier and Type | Method and Description |
|---|---|
int |
addDefaultAttribute(String localName,
String uri,
String prefix,
String value)
Method called by actual validator instances when attributes with
default values have no explicit values for the element; if so,
default value needs to be added as if it was parsed from the
element.
|
void |
addNsBinding(String prefix,
String uri)
Callback method called by the namespace default provider.
|
protected org.codehaus.stax2.validation.XMLValidator |
addValidator(org.codehaus.stax2.validation.XMLValidator vld) |
protected void |
connectReporter(InputProblemReporter rep) |
BaseNsContext |
createNonTransientNsContext(Location loc)
Method called to construct a non-transient NamespaceContext instance;
generally needed when creating events to return from event-based
iterators.
|
int |
findAttributeIndex(String nsURI,
String localName) |
AttributeCollector |
getAttrCollector()
Method called by
BasicStreamReader, to retrieve the
attribute collector it needs for some direct access. |
int |
getAttributeCount() |
String |
getAttributeLocalName(int index) |
String |
getAttributeNamespace(int index) |
String |
getAttributePrefix(int index) |
String |
getAttributeType(int index) |
String |
getAttributeValue(int index) |
String |
getAttributeValue(String nsURI,
String localName) |
String |
getBaseUri() |
QName |
getCurrentElementName() |
int |
getCurrentNsCount() |
String |
getDefaultNsURI() |
int |
getDepth() |
int |
getIdAttributeIndex()
Default implementation just indicates it does not know of such
attributes; this because that requires DTD information that only
some implementations have.
|
String |
getLocalName() |
String |
getLocalNsPrefix(int index) |
String |
getLocalNsURI(int index) |
String |
getNamespaceURI(String prefix) |
int |
getNotationAttributeIndex()
Default implementation just indicates it does not know of such
attributes; this because that requires DTD information that only
some implementations have.
|
String |
getNsURI() |
String |
getPrefix() |
String |
getPrefix(String nsURI) |
Iterator<String> |
getPrefixes(String nsURI) |
String |
getTopElementDesc() |
int |
getTotalNsCount() |
Location |
getValidationLocation() |
String |
getXmlVersion() |
boolean |
isEmpty() |
boolean |
isNamespaceAware() |
boolean |
isNotationDeclared(String name) |
boolean |
isPrefixLocallyDeclared(String internedPrefix) |
boolean |
isUnparsedEntityDeclared(String name) |
boolean |
matches(String prefix,
String localName) |
boolean |
pop()
Method called by the stream reader to remove the topmost (start)
element from the stack;
called when an end element is encountered during parsing.
|
void |
push(String prefix,
String localName)
Method called by the stream reader to add new (start) element
into the stack in namespace-aware mode; called when a start element
is encountered during parsing, but only in ns-aware mode.
|
protected boolean |
reallyValidating()
This is a method called by the reader to ensure that we have at
least one 'real' validator.
|
void |
reportProblem(org.codehaus.stax2.validation.XMLValidationProblem problem) |
int |
resolveAndValidateElement()
Method called to resolve element and attribute namespaces (in
namespace-aware mode), and do optional validation using pluggable
validator object.
|
protected void |
setAutomaticDTDValidator(org.codehaus.stax2.validation.XMLValidator validator,
NsDefaultProvider nsDefs)
Method called to connect the automatically handled DTD validator
(one detected from DOCTYPE, loaded and completely handled by
the stream reader without application calling validation methods).
|
org.codehaus.stax2.validation.XMLValidator |
stopValidatingAgainst(org.codehaus.stax2.validation.XMLValidationSchema schema) |
org.codehaus.stax2.validation.XMLValidator |
stopValidatingAgainst(org.codehaus.stax2.validation.XMLValidator validator) |
org.codehaus.stax2.validation.XMLValidator |
validateAgainst(org.codehaus.stax2.validation.XMLValidationSchema schema) |
int |
validateEndElement()
Method called after parsing (but before returning) end element,
to allow for pluggable validators to verify correctness of
the content model for the closing element.
|
void |
validateText(String contents,
boolean lastTextSegment) |
void |
validateText(TextBuffer tb,
boolean lastTextSegment) |
protected final boolean mNsAware
protected final AttributeCollector mAttrCollector
protected final ReaderConfig mConfig
protected InputProblemReporter mReporter
protected NsDefaultProvider mNsDefaultProvider
protected int mDepth
protected long mTotalElements
protected final StringVector mNamespaces
protected com.ctc.wstx.sr.Element mCurrElement
protected boolean mMayHaveNsDefaults
protected org.codehaus.stax2.validation.XMLValidator mValidator
protected int mIdAttrIndex
protected String mLastLocalName
protected String mLastPrefix
protected String mLastNsURI
protected QName mLastName
protected BaseNsContext mLastNsContext
protected com.ctc.wstx.sr.Element mFreeElement
protected InputElementStack(ReaderConfig cfg, boolean nsAware)
protected void connectReporter(InputProblemReporter rep)
protected org.codehaus.stax2.validation.XMLValidator addValidator(org.codehaus.stax2.validation.XMLValidator vld)
protected void setAutomaticDTDValidator(org.codehaus.stax2.validation.XMLValidator validator,
NsDefaultProvider nsDefs)
public org.codehaus.stax2.validation.XMLValidator validateAgainst(org.codehaus.stax2.validation.XMLValidationSchema schema)
throws XMLStreamException
XMLStreamExceptionpublic org.codehaus.stax2.validation.XMLValidator stopValidatingAgainst(org.codehaus.stax2.validation.XMLValidationSchema schema)
throws XMLStreamException
XMLStreamExceptionpublic org.codehaus.stax2.validation.XMLValidator stopValidatingAgainst(org.codehaus.stax2.validation.XMLValidator validator)
throws XMLStreamException
XMLStreamExceptionprotected boolean reallyValidating()
DTDValidatorBase or returns true for
reallyValidating.
!!! TODO: remove need for this method (and method itself) with Woodstox 4.0, by adding necessary support in Stax2 XMLValidator interface.
public final AttributeCollector getAttrCollector()
BasicStreamReader, to retrieve the
attribute collector it needs for some direct access.public BaseNsContext createNonTransientNsContext(Location loc)
public final void push(String prefix, String localName) throws XMLStreamException
XMLStreamExceptionpublic final boolean pop()
throws XMLStreamException
XMLStreamExceptionpublic int resolveAndValidateElement()
throws XMLStreamException
XMLStreamExceptionpublic int validateEndElement()
throws XMLStreamException
XMLStreamExceptionpublic final int getAttributeCount()
getAttributeCount in interface org.codehaus.stax2.AttributeInfogetAttributeCount in interface org.codehaus.stax2.validation.ValidationContextpublic final int findAttributeIndex(String nsURI, String localName)
findAttributeIndex in interface org.codehaus.stax2.AttributeInfofindAttributeIndex in interface org.codehaus.stax2.validation.ValidationContextpublic final int getIdAttributeIndex()
getIdAttributeIndex in interface org.codehaus.stax2.AttributeInfopublic final int getNotationAttributeIndex()
getNotationAttributeIndex in interface org.codehaus.stax2.AttributeInfopublic final String getNamespaceURI(String prefix)
getNamespaceURI in interface NamespaceContextgetNamespaceURI in interface org.codehaus.stax2.validation.ValidationContextpublic final String getPrefix(String nsURI)
getPrefix in interface NamespaceContextpublic final Iterator<String> getPrefixes(String nsURI)
getPrefixes in interface NamespaceContextpublic final String getXmlVersion()
getXmlVersion in interface org.codehaus.stax2.validation.ValidationContextpublic String getAttributeLocalName(int index)
getAttributeLocalName in interface org.codehaus.stax2.validation.ValidationContextpublic String getAttributeNamespace(int index)
getAttributeNamespace in interface org.codehaus.stax2.validation.ValidationContextpublic String getAttributePrefix(int index)
getAttributePrefix in interface org.codehaus.stax2.validation.ValidationContextpublic String getAttributeValue(int index)
getAttributeValue in interface org.codehaus.stax2.validation.ValidationContextpublic String getAttributeValue(String nsURI, String localName)
getAttributeValue in interface org.codehaus.stax2.validation.ValidationContextpublic boolean isNotationDeclared(String name)
isNotationDeclared in interface org.codehaus.stax2.validation.ValidationContextpublic boolean isUnparsedEntityDeclared(String name)
isUnparsedEntityDeclared in interface org.codehaus.stax2.validation.ValidationContextpublic String getBaseUri()
getBaseUri in interface org.codehaus.stax2.validation.ValidationContextpublic final QName getCurrentElementName()
getCurrentElementName in interface org.codehaus.stax2.validation.ValidationContextpublic Location getValidationLocation()
getValidationLocation in interface org.codehaus.stax2.validation.ValidationContextpublic void reportProblem(org.codehaus.stax2.validation.XMLValidationProblem problem)
throws XMLStreamException
reportProblem in interface org.codehaus.stax2.validation.ValidationContextXMLStreamExceptionpublic int addDefaultAttribute(String localName, String uri, String prefix, String value) throws XMLStreamException
addDefaultAttribute in interface org.codehaus.stax2.validation.ValidationContextXMLStreamExceptionpublic boolean isPrefixLocallyDeclared(String internedPrefix)
public void addNsBinding(String prefix, String uri)
public final void validateText(TextBuffer tb, boolean lastTextSegment) throws XMLStreamException
XMLStreamExceptionpublic final void validateText(String contents, boolean lastTextSegment) throws XMLStreamException
XMLStreamExceptionpublic final boolean isNamespaceAware()
public final boolean isEmpty()
public final int getDepth()
public final String getDefaultNsURI()
public final String getNsURI()
public final String getPrefix()
public final String getLocalName()
public final String getTopElementDesc()
public final int getTotalNsCount()
public final int getCurrentNsCount()
public final String getLocalNsPrefix(int index)
public final String getLocalNsURI(int index)
public final String getAttributeType(int index)
getAttributeType in interface org.codehaus.stax2.validation.ValidationContextCopyright © 2024 FasterXML. All rights reserved.