|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.ctc.wstx.sr.AttributeCollector
com.ctc.wstx.sr.NsAttributeCollector
public final class NsAttributeCollector
Attribute collector class used in namespace-aware parsing mode.
Some notes about low-level raw hashing map implementation. Hash area is divided into two sections: first (of size 2^N) is somewhat usual set of indexes to actual attribute names (values in these slots are 'entry + 1', since 0 means 'empty'). There is just one int entry per name; actual name comparison is done using secondary tables that contain (interned) name components. Secondary area will be used for spills, and it is initially sized to have N/8 entries; and since there are 2 ints per entry, size will actually be N/4, following right after the primary hash area.
Note: only public for testing purposes
Field Summary | |
---|---|
protected static int |
ATTR_URI_BUF_SIZE
Initial size for attribute NS URI buffer |
protected static java.lang.String |
DEFAULT_NS_URI
Default URI that root element has, if none is explicitly defined. |
Fields inherited from class com.ctc.wstx.sr.AttributeCollector |
---|
EXP_ATTR_COUNT, LONG_ATTR_LIST_LEN, mAttrCount, mAttrHashSize, mAttrMap, mAttrNames, mAttrSpillEnd, mAttrValues, mNonDefCount, mValueBuffer, mXmlIdAttrIndex, XMLID_IX_DISABLED, XMLID_IX_NONE |
Constructor Summary | |
---|---|
NsAttributeCollector(ReaderConfig cfg)
|
Method Summary | |
---|---|
int |
addDefaultAttribute(java.lang.String localName,
java.lang.String uri,
java.lang.String prefix,
java.lang.String value)
Method called by validator to insert an attribute that has a default value and wasn't yet included in collector's attribute set. |
ElemAttrs |
buildAttrOb()
Method needed by event creating code, to build a non-transient attribute container, to use with XMLEvent objects (specifically implementation of StartElement event). |
int |
findIndex(java.lang.String nsURI,
java.lang.String localName)
|
TextBuilder |
getAttrBuilder(java.lang.String attrPrefix,
java.lang.String attrLocalName)
Method called to get TextBuilder instance, into which value String should be built, when starting to read attribute value. |
protected java.lang.String[] |
getAttrURIs()
Note: only called by InputElementStack |
TextBuilder |
getDefaultNsBuilder()
|
java.lang.String |
getLocalName(int index)
|
TextBuilder |
getNsBuilder(java.lang.String prefix)
|
int |
getNsCount()
|
java.lang.String |
getNsPrefix(int index)
|
protected java.lang.String[] |
getNsPrefixes()
Note: only called by InputElementStack |
java.lang.String |
getNsURI(int index)
|
TextBuilder |
getNsURIs()
Note: only called by InputElementStack |
java.lang.String |
getPrefix(int index)
|
javax.xml.namespace.QName |
getQName(int index)
Note: caller must check validity of the index prior to calling this method. |
java.lang.String |
getURI(int index)
|
java.lang.String |
getValue(java.lang.String nsURI,
java.lang.String localName)
|
boolean |
hasDefaultNs()
|
void |
reset()
Method called to allow reusing of collector, usually right before starting collecting attributes for a new start tag. |
int |
resolveNamespaces(InputProblemReporter rep,
StringVector ns)
Method called to resolve namespace URIs from attribute prefixes. |
void |
writeAttribute(int index,
XmlWriter xw)
Method that basically serializes the specified (read-in) attribute using Writers provided |
Methods inherited from class com.ctc.wstx.sr.AttributeCollector |
---|
allocBuffers, getAttrBuilder, getCount, getNameList, getSpecifiedCount, getValue, getXmlIdAttrIndex, isSpecified, resize, setNormalizedValue, throwDupAttr, throwIndex |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected static final java.lang.String DEFAULT_NS_URI
protected static final int ATTR_URI_BUF_SIZE
Constructor Detail |
---|
public NsAttributeCollector(ReaderConfig cfg)
Method Detail |
---|
public void reset()
Note: public only so that it can be called by unit tests.
reset
in class AttributeCollector
public int resolveNamespaces(InputProblemReporter rep, StringVector ns) throws WstxException
Note: public only so that it can be called by unit tests.
rep
- Reporter to use for reporting well-formedness problemsns
- Namespace prefix/URI mappings active for this element
WstxException
public int getNsCount()
getNsCount
in class AttributeCollector
public boolean hasDefaultNs()
public java.lang.String getNsPrefix(int index)
getNsPrefix
in class AttributeCollector
public java.lang.String getNsURI(int index)
getNsURI
in class AttributeCollector
public java.lang.String getPrefix(int index)
getPrefix
in class AttributeCollector
public java.lang.String getLocalName(int index)
getLocalName
in class AttributeCollector
public java.lang.String getURI(int index)
getURI
in class AttributeCollector
public javax.xml.namespace.QName getQName(int index)
getQName
in class AttributeCollector
public java.lang.String getValue(java.lang.String nsURI, java.lang.String localName)
getValue
in class AttributeCollector
public int findIndex(java.lang.String nsURI, java.lang.String localName)
public TextBuilder getDefaultNsBuilder()
getDefaultNsBuilder
in class AttributeCollector
public TextBuilder getNsBuilder(java.lang.String prefix)
getNsBuilder
in class AttributeCollector
public TextBuilder getAttrBuilder(java.lang.String attrPrefix, java.lang.String attrLocalName)
Note: It is assumed that all Strings have been canonicalized via default symbol table
getAttrBuilder
in class AttributeCollector
attrPrefix
- canonicalized attribute prefixattrLocalName
- canonicalized local name of attributeprotected java.lang.String[] getNsPrefixes()
Note: only called by InputElementStack
public TextBuilder getNsURIs()
Note: only called by InputElementStack
protected java.lang.String[] getAttrURIs()
Note: only called by InputElementStack
public ElemAttrs buildAttrOb()
buildAttrOb
in class AttributeCollector
public int addDefaultAttribute(java.lang.String localName, java.lang.String uri, java.lang.String prefix, java.lang.String value)
public void writeAttribute(int index, XmlWriter xw) throws java.io.IOException, javax.xml.stream.XMLStreamException
writeAttribute
in class AttributeCollector
java.io.IOException
javax.xml.stream.XMLStreamException
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |