com.ctc.wstx.dtd
Class DefaultAttrValue

java.lang.Object
  extended by com.ctc.wstx.dtd.DefaultAttrValue

public final class DefaultAttrValue
extends java.lang.Object

Simple container class used to contain information about the default value for an attribute. Although for most use cases a simple String would suffice, there are cases where additional information is needed (especially status of 'broken' default values, which only need to be reported should the default value be needed).


Field Summary
static int DEF_DEFAULT
           
static int DEF_FIXED
           
static int DEF_IMPLIED
           
static int DEF_REQUIRED
           
 
Method Summary
 void addUndeclaredGE(java.lang.String name, javax.xml.stream.Location loc)
           
 void addUndeclaredPE(java.lang.String name, javax.xml.stream.Location loc)
           
static DefaultAttrValue constructFixed()
           
static DefaultAttrValue constructImplied()
           
static DefaultAttrValue constructOptional()
           
static DefaultAttrValue constructRequired()
           
 java.lang.String getValue()
           
 java.lang.String getValueIfOk()
           
 boolean hasDefaultValue()
           
 boolean hasUndeclaredEntities()
           
 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.
 void reportUndeclared(ValidationContext ctxt)
           
 void setValue(java.lang.String v)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEF_DEFAULT

public static final int DEF_DEFAULT
See Also:
Constant Field Values

DEF_IMPLIED

public static final int DEF_IMPLIED
See Also:
Constant Field Values

DEF_REQUIRED

public static final int DEF_REQUIRED
See Also:
Constant Field Values

DEF_FIXED

public static final int DEF_FIXED
See Also:
Constant Field Values
Method Detail

constructImplied

public static DefaultAttrValue constructImplied()

constructRequired

public static DefaultAttrValue constructRequired()

constructFixed

public static DefaultAttrValue constructFixed()

constructOptional

public static DefaultAttrValue constructOptional()

setValue

public void setValue(java.lang.String v)

addUndeclaredPE

public void addUndeclaredPE(java.lang.String name,
                            javax.xml.stream.Location loc)

addUndeclaredGE

public void addUndeclaredGE(java.lang.String name,
                            javax.xml.stream.Location loc)

reportUndeclared

public void reportUndeclared(ValidationContext ctxt)
                      throws XMLValidationException
Throws:
XMLValidationException

hasUndeclaredEntities

public boolean hasUndeclaredEntities()

getValue

public java.lang.String getValue()

getValueIfOk

public java.lang.String getValueIfOk()
Returns:
Expanded default value String, if there were no problems (no undeclared entities), or null to indicate there were problems. In latter case, caller is to figure out exact type of the problem and report this appropriately to the application.

isRequired

public boolean isRequired()

isFixed

public boolean isFixed()

hasDefaultValue

public boolean hasDefaultValue()

isSpecial

public 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. In both cases missing the attribute has specific consequences, either exception or addition of a default value.