public abstract class DTDAttribute
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
(package private) static char |
CHAR_SPACE |
protected boolean |
mCfgNsAware |
protected boolean |
mCfgXml11 |
protected DefaultAttrValue |
mDefValue |
protected PrefixedName |
mName |
protected int |
mSpecialIndex
Index number amongst "special" attributes (required ones, attributes
that have default values), if attribute is one: -1 if not.
|
(package private) static java.lang.String[] |
sTypes
Array that has String constants matching above mentioned
value types
|
static int |
TYPE_CDATA |
static int |
TYPE_ENTITIES |
static int |
TYPE_ENTITY |
static int |
TYPE_ENUMERATED |
static int |
TYPE_ID |
static int |
TYPE_IDREF |
static int |
TYPE_IDREFS |
static int |
TYPE_NMTOKEN |
static int |
TYPE_NMTOKENS |
static int |
TYPE_NOTATION |
Constructor and Description |
---|
DTDAttribute(PrefixedName name,
DefaultAttrValue defValue,
int specIndex,
boolean nsAware,
boolean xml11) |
Modifier and Type | Method and Description |
---|---|
protected void |
checkEntity(InputProblemReporter rep,
java.lang.String id,
EntityDecl ent) |
abstract DTDAttribute |
cloneWith(int specIndex) |
protected EntityDecl |
findEntityDecl(DTDValidatorBase v,
char[] ch,
int start,
int len) |
java.lang.String |
getDefaultValue(org.codehaus.stax2.validation.ValidationContext ctxt,
org.codehaus.stax2.validation.XMLValidator dtd) |
PrefixedName |
getName() |
int |
getSpecialIndex() |
int |
getValueType()
Returns the value type of this attribute as an enumerated int
to match type (CDATA, ...)
|
java.lang.String |
getValueTypeString() |
boolean |
hasDefaultValue() |
boolean |
isFixed() |
boolean |
isRequired() |
boolean |
isSpecial()
Method used by the element to figure out if attribute needs "special"
checking; basically if it's required, and/or has a default value.
|
boolean |
needsValidation() |
java.lang.String |
normalize(DTDValidatorBase v,
char[] cbuf,
int start,
int end)
Method called when no validation is to be done, but value is still
to be normalized as much as it can.
|
void |
normalizeDefault()
Method called to do initial normalization of the default attribute
value, without trying to verify its validity.
|
protected java.lang.String |
reportInvalidChar(DTDValidatorBase v,
char c,
java.lang.String msg) |
protected java.lang.String |
reportValidationProblem(DTDValidatorBase v,
java.lang.String msg) |
protected java.lang.String |
reportValidationProblem(InputProblemReporter rep,
java.lang.String msg)
Method called during parsing of DTD schema, to report a problem.
|
java.lang.String |
toString() |
boolean |
typeIsId() |
boolean |
typeIsNotation() |
abstract java.lang.String |
validate(DTDValidatorBase v,
char[] cbuf,
int start,
int end,
boolean normalize) |
java.lang.String |
validate(DTDValidatorBase v,
java.lang.String value,
boolean normalize)
Note: the default implementation is not optimized, as it does
a potentially unnecessary copy of the contents.
|
abstract void |
validateDefault(InputProblemReporter rep,
boolean normalize)
Method called by the
DTDValidator
to ask attribute to verify that the default it has (if any) is
valid for such type. |
protected java.lang.String |
validateDefaultName(InputProblemReporter rep,
boolean normalize) |
protected java.lang.String |
validateDefaultNames(InputProblemReporter rep,
boolean normalize) |
protected java.lang.String |
validateDefaultNmToken(InputProblemReporter rep,
boolean normalize) |
java.lang.String |
validateEnumValue(char[] cbuf,
int start,
int end,
boolean normalize,
WordResolver res)
Method called by validation/normalization code for enumeration-valued
attributes, to trim
specified attribute value (full normalization not needed -- called
for values that CAN NOT have spaces inside; such values can not
be legal), and then check whether it is included
in set of words (tokens) passed in.
|
static final char CHAR_SPACE
public static final int TYPE_CDATA
public static final int TYPE_ENUMERATED
public static final int TYPE_ID
public static final int TYPE_IDREF
public static final int TYPE_IDREFS
public static final int TYPE_ENTITY
public static final int TYPE_ENTITIES
public static final int TYPE_NOTATION
public static final int TYPE_NMTOKEN
public static final int TYPE_NMTOKENS
static final java.lang.String[] sTypes
protected final PrefixedName mName
protected final int mSpecialIndex
protected final DefaultAttrValue mDefValue
protected final boolean mCfgNsAware
protected final boolean mCfgXml11
public DTDAttribute(PrefixedName name, DefaultAttrValue defValue, int specIndex, boolean nsAware, boolean xml11)
public abstract DTDAttribute cloneWith(int specIndex)
public final PrefixedName getName()
public final java.lang.String toString()
toString
in class java.lang.Object
public final java.lang.String getDefaultValue(org.codehaus.stax2.validation.ValidationContext ctxt, org.codehaus.stax2.validation.XMLValidator dtd) throws javax.xml.stream.XMLStreamException
javax.xml.stream.XMLStreamException
public final int getSpecialIndex()
public final boolean needsValidation()
public final boolean isFixed()
public final boolean isRequired()
public final boolean isSpecial()
public final boolean hasDefaultValue()
public int getValueType()
Note:
public java.lang.String getValueTypeString()
public boolean typeIsId()
public boolean typeIsNotation()
public abstract java.lang.String validate(DTDValidatorBase v, char[] cbuf, int start, int end, boolean normalize) throws javax.xml.stream.XMLStreamException
javax.xml.stream.XMLStreamException
public java.lang.String validate(DTDValidatorBase v, java.lang.String value, boolean normalize) throws javax.xml.stream.XMLStreamException
Note: the default implementation is not optimized, as it does a potentially unnecessary copy of the contents. It is expected that this method is seldom called (Woodstox never directly calls it; it only gets called for chained validators when one validator normalizes the value, and then following validators are passed a String, not char array)
javax.xml.stream.XMLStreamException
public abstract void validateDefault(InputProblemReporter rep, boolean normalize) throws javax.xml.stream.XMLStreamException
DTDValidator
to ask attribute to verify that the default it has (if any) is
valid for such type.javax.xml.stream.XMLStreamException
public java.lang.String normalize(DTDValidatorBase v, char[] cbuf, int start, int end)
The only exception is that CDATA will not do any normalization. But for now, let's implement basic functionality that CDTA instance will override
v
- Validator that invoked normalizationpublic void normalizeDefault()
protected java.lang.String validateDefaultName(InputProblemReporter rep, boolean normalize) throws javax.xml.stream.XMLStreamException
javax.xml.stream.XMLStreamException
protected java.lang.String validateDefaultNames(InputProblemReporter rep, boolean normalize) throws javax.xml.stream.XMLStreamException
javax.xml.stream.XMLStreamException
protected java.lang.String validateDefaultNmToken(InputProblemReporter rep, boolean normalize) throws javax.xml.stream.XMLStreamException
javax.xml.stream.XMLStreamException
public java.lang.String validateEnumValue(char[] cbuf, int start, int end, boolean normalize, WordResolver res)
protected EntityDecl findEntityDecl(DTDValidatorBase v, char[] ch, int start, int len) throws javax.xml.stream.XMLStreamException
javax.xml.stream.XMLStreamException
protected void checkEntity(InputProblemReporter rep, java.lang.String id, EntityDecl ent) throws javax.xml.stream.XMLStreamException
javax.xml.stream.XMLStreamException
protected java.lang.String reportInvalidChar(DTDValidatorBase v, char c, java.lang.String msg) throws javax.xml.stream.XMLStreamException
javax.xml.stream.XMLStreamException
protected java.lang.String reportValidationProblem(DTDValidatorBase v, java.lang.String msg) throws javax.xml.stream.XMLStreamException
javax.xml.stream.XMLStreamException
protected java.lang.String reportValidationProblem(InputProblemReporter rep, java.lang.String msg) throws javax.xml.stream.XMLStreamException
javax.xml.stream.XMLStreamException