sandygao 2003/01/28 06:00:12
Modified: java/src/org/apache/xerces/impl/dv/xs XSSimpleTypeDecl.java
Log:
"getLexicalPattern" didn't give correct answer for "Name", "NCName",
and "NMTOKEN" derived types.
Revision Changes Path
1.30 +20 -4
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.29
retrieving revision 1.30
diff -u -r1.29 -r1.30
--- XSSimpleTypeDecl.java 21 Jan 2003 16:47:11 -0000 1.29
+++ XSSimpleTypeDecl.java 28 Jan 2003 14:00:11 -0000 1.30
@@ -1800,12 +1800,28 @@
}
public StringList getLexicalPattern() {
- if (fPatternStr == null)
+ if (fPatternType == SPECIAL_PATTERN_NONE && fPatternStr == null)
return null;
// REVISIT: fPattern should be of type StringListImpl
- int size = fPatternStr.size();
- String[] strs = new String[size];
+ int size = fPatternStr == null ? 0 : fPatternStr.size();
+ String[] strs;
+ if (fPatternType == SPECIAL_PATTERN_NMTOKEN) {
+ strs = new String[size+1];
+ strs[size] = "\\c+";
+ }
+ else if (fPatternType == SPECIAL_PATTERN_NAME) {
+ strs = new String[size+1];
+ strs[size] = "\\i\\c*";
+ }
+ else if (fPatternType == SPECIAL_PATTERN_NCNAME) {
+ strs = new String[size+2];
+ strs[size] = "\\i\\c*";
+ strs[size+1] = "[\\i-[:]][\\c-[:]]*";
+ }
+ else {
+ strs = new String[size];
+ }
for (int i = 0; i < size; i++)
strs[i] = (String)fPatternStr.elementAt(i);
return new StringListImpl(strs, size);
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]