ankitp 2004/12/14 12:45:20
Modified: java/src/org/apache/xerces/impl/dv/xs XSSimpleTypeDecl.java
Log:
provide access to item type info (for LIST and LISTOFUNION types) for
enumeration values.
Revision Changes Path
1.63 +37 -2
xml-xerces/java/src/org/apache/xerces/impl/dv/xs/XSSimpleTypeDecl.java
Index: XSSimpleTypeDecl.java
===================================================================
RCS file:
/home/cvs/xml-xerces/java/src/org/apache/xerces/impl/dv/xs/XSSimpleTypeDecl.java,v
retrieving revision 1.62
retrieving revision 1.63
diff -u -r1.62 -r1.63
--- XSSimpleTypeDecl.java 9 Dec 2004 02:40:00 -0000 1.62
+++ XSSimpleTypeDecl.java 14 Dec 2004 20:45:20 -0000 1.63
@@ -245,7 +245,9 @@
private Vector fPatternStr;
private Vector fEnumeration;
private short[] fEnumerationType;
- private ShortList fEnumerationTypeList;
+ private ShortList[] fEnumerationItemType; // used in case
fenumerationType value is LIST or LISTOFUNION
+ private ShortList fEnumerationTypeList;
+ private ObjectList fEnumerationItemTypeList;
private StringList fLexicalPattern;
private StringList fLexicalEnumeration;
private ObjectList fActualEnumeration;
@@ -793,6 +795,7 @@
fEnumeration = new Vector();
Vector enumVals = facets.enumeration;
fEnumerationType = new short[enumVals.size()];
+ fEnumerationItemType = new ShortList[enumVals.size()];
Vector enumNSDecls = facets.enumNSDecls;
ValidationContextImpl ctx = new
ValidationContextImpl(context);
enumerationAnnotations = facets.enumAnnotations;
@@ -804,6 +807,7 @@
// check 4.3.5.c0 must:
enumeration values from the value space of base
fEnumeration.addElement(info.actualValue);
fEnumerationType[i] =
info.actualValueType;
+ fEnumerationItemType[i] = info.itemValueTypes;
} catch (InvalidDatatypeValueException
ide) {
reportError("enumeration-valid-restriction", new
Object[]{enumVals.elementAt(i), this.getBaseType().getName()});
}
@@ -2110,6 +2114,37 @@
}
return fActualEnumeration;
}
+
+ /**
+ * A list of enumeration type values (as a list of ShortList objects) if
it exists, otherwise returns
+ * null
+ */
+ public ObjectList getEnumerationItemTypeList() {
+ if (fEnumerationItemTypeList == null) {
+ if(fEnumerationItemType == null)
+ return null;
+ fEnumerationItemTypeList = new ObjectList () {
+ public int getLength() {
+ return (fEnumerationItemType != null) ?
fEnumerationItemType.length : 0;
+ }
+ public boolean contains(Object item) {
+ if(fEnumerationItemType == null || !(item instanceof
ShortList))
+ return false;
+ for(int i = 0;i < fEnumerationItemType.length; i++)
+ if(fEnumerationItemType[i] == item)
+ return true;
+ return false;
+ }
+ public Object item(int index) {
+ if (index < 0 || index >= getLength()) {
+ return null;
+ }
+ return fEnumerationItemType[index];
+ }
+ };
+ }
+ return fEnumerationItemTypeList;
+ }
public ShortList getEnumerationTypeList() {
if (fEnumerationTypeList == null) {
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]