|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.novell.xsl.parser.AttrDef
Helper class for StylesheetParser
.
An instance of AttrDef
defines an attribute. An array of these objects is used to
describe attributes for XSLT elements.
Parse methods for XSLT elements use AttrDef.parseAttributes()
to perform
attribute parsing.
Field Summary | |
static int |
AVT_EXPR
Attribute is an attribute-value-template. |
static int |
CHAR
Attribute is a single character. |
static int |
ENUM
Attribute is one of a set of allowed values. |
static int |
EXPR
Attribute is an arbitrary XPath Expression. |
static int |
MODE
Attribute is a Mode name. |
static int |
NAME
Attribute is a XML Name (a valid XML 1.0) name. |
static int |
OPTIONAL
Specifies attribute is optional. |
static int |
PATTERN
Attribute is a Pattern. |
static int |
PRIORITY
Attribute is a Priority. |
static int |
QNAME
Attribute is an XML QName (a valid XML Namespaces name). |
static int |
REQUIRED
Specifies attribute is required. |
static int |
SELECT_EXPR
Attribute is an expression returning a node-set. |
static int |
STRING
Attribute is an arbitrary String. |
static int |
TOP_EXPR
Attribute is a top-level expression that can't contain variable references. |
static int |
TOP_PATTERN
Attribute is a top-level Pattern. |
Constructor Summary | |
AttrDef(String name,
int optOrReq,
int defaultValue,
String[] legalValues)
Construct an AttrDef for attributes of type ENUM . |
|
AttrDef(String name,
int optOrReq,
Object defaultValue,
int type)
Construct an AttrDef for any attribute type other than ENUM . |
Method Summary | |
boolean |
isRequired()
Return true if the attribute represented by this object is
required. |
static Object[] |
parseAttributes(StylesheetParser stylesheetParser,
Element element,
AttrDef[] desc)
Parses the attributes of the passed element according to the specified array of AttrDef objects.
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final int OPTIONAL
public static final int REQUIRED
public static final int AVT_EXPR
com.novell.xml.xpath.Expression
.
public static final int ENUM
java.lang.Integer
.
public static final int TOP_PATTERN
com.novell.xsl.pattern.Pattern
.
public static final int PATTERN
com.novell.xsl.pattern.Pattern
.
public static final int MODE
com.novell.xsl.process.Mode
.
public static final int NAME
java.lang.String
.
public static final int QNAME
com.novell.xml.util.ExpandedQName
.
public static final int PRIORITY
com.novell.xsl.process.Priority
.
public static final int SELECT_EXPR
com.novell.xml.xpath.Expression
.
public static final int STRING
java.lang.String
.
public static final int TOP_EXPR
com.novell.xml.xpath.Expression
.
public static final int EXPR
com.novell.xml.xpath.Expression
.
public static final int CHAR
java.lang.Character
.
Constructor Detail |
public AttrDef(String name, int optOrReq, Object defaultValue, int type)
ENUM
.
name
- The name of the attribute (NOT a prefixed name).optOrReq
- AttrDef.OPTIONAL
or AttrDef.REQUIRED
.defaultValue
- The Object
to return as the default value if the attribute
doesn't appear on an element instance. This may be null
.type
- The type of the attribute (AttrDef.AVT_EXPR, AttrDef.STRING, etc.)public AttrDef(String name, int optOrReq, int defaultValue, String[] legalValues)
ENUM
.
name
- The name of the attribute (NOT a prefixed name).optOrReq
- AttrDef.OPTIONAL
or AttrDef.REQUIRED
.defaultValue
- The index of the default value if the attribute
doesn't appear on an element instance. This may be null
.legalValues
- Array of String
objects that define the allowed values for
the attribute. The returned Integer
object will correspond to the index of
the actual value in this array.Method Detail |
public boolean isRequired()
true
if the attribute represented by this object is
required.
true
if attribute is required.public static Object[] parseAttributes(StylesheetParser stylesheetParser, Element element, AttrDef[] desc) throws XSLTParserException
AttrDef
objects.
Namespace declarations ("xmlns:prefix") are be ignored.
Namespace-qualified attributes are ignored (including xml:space and xml:lang).
Each attribute is parsed according to type and the resulting Object
is placed in
the returned Object
array at the index corresponding to the AttrDef
object in the
passed desc
array. See the type definitions for the actual object type (AttrDef.AVT_EXPR, AttrDef.ENUM,
etc.).
Errors are reported via the StylesheetParser
if an attribute appears that is not described in the passed
AttrDef
array (other than those that are ignored, see above), if an attribute has an invalid value, or
if a REQUIRED
attribute is missing. If an error occurs on an attribute, the resulting entry in the returned
Object
array will be null
.
If an OPTIONAL
attribute definition doesn't include a default value, then the attribute entry
in the returned Object
array will be null
.
stylesheetParser
- The stylesheet parser object that is used for parsing the XSLT document containing element
.element
- The element from the XSLT document whose attributes are to be parsed.desc
- An array describing the element's attributes.
XSLTParserException
- If the StylesheetParser error handler throws this exception when an
error is reported.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |