You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xerces.apache.org by kn...@apache.org on 2011/09/15 17:44:31 UTC
svn commit: r1171147 - in
/xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl: ./ dv/
dv/xs/ validation/ xpath/regex/ xs/ xs/opti/ xs/traversers/
Author: knoaman
Date: Thu Sep 15 15:44:30 2011
New Revision: 1171147
URL: http://svn.apache.org/viewvc?rev=1171147&view=rev
Log:
New property to control whether to use XML 1.0 vs. XML 1.1 for simple type values (including RegEx changes to \i and \c) [default: xml version of document being processed]
Jira issue 1525 - https://issues.apache.org/jira/browse/XERCESJ-1525
Added:
xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xpath/regex/REConstants.java (with props)
xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xpath/regex/RangeTokenMap.java (with props)
xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xpath/regex/RangeTokenMapFactory.java (with props)
xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xpath/regex/XML11TokenMap.java (with props)
xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xpath/regex/XMLTokenMap.java (with props)
Modified:
xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/Constants.java
xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/ValidationContext.java
xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/EntityDV.java
xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/IDDV.java
xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/IDREFDV.java
xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/QNameDV.java
xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/Schema11DVFactoryImpl.java
xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/XSSimpleTypeDecl.java
xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/validation/ValidationState.java
xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xpath/regex/ParserForXMLSchema.java
xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xpath/regex/REUtil.java
xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xpath/regex/RegularExpression.java
xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/XMLSchemaLoader.java
xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/XMLSchemaValidator.java
xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/opti/SchemaParsingConfig.java
xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/traversers/XSDAttributeTraverser.java
xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/traversers/XSDComplexTypeTraverser.java
xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/traversers/XSDElementTraverser.java
xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/traversers/XSDHandler.java
xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/traversers/XSDSimpleTypeTraverser.java
xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/traversers/XSDocumentInfo.java
Modified: xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/Constants.java
URL: http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/Constants.java?rev=1171147&r1=1171146&r2=1171147&view=diff
==============================================================================
--- xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/Constants.java (original)
+++ xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/Constants.java Thu Sep 15 15:44:30 2011
@@ -442,9 +442,12 @@ public final class Constants {
/** Schema element declaration for the root element in a document ("internal/validation/schema/dv-factory"). */
public static final String SCHEMA_DV_FACTORY_PROPERTY = "internal/validation/schema/dv-factory";
- /** Datatype XML version property ("validation/schema/datatype-xml-version"). */
+ /** XML Schema version property ("validation/schema/version"). */
public static final String XML_SCHEMA_VERSION_PROPERTY ="validation/schema/version";
+ /** Datatype XML version property ("validation/schema/datatype-xml-version"). */
+ public static final String DATATYPE_XML_VERSION_PROPERTY = "validation/schema/datatype-xml-version";
+
// general constants
/** Element PSVI is stored in augmentations using string "ELEMENT_PSVI" */
@@ -577,7 +580,8 @@ public final class Constants {
ROOT_TYPE_DEFINITION_PROPERTY,
ROOT_ELEMENT_DECLARATION_PROPERTY,
SCHEMA_DV_FACTORY_PROPERTY,
- XML_SCHEMA_VERSION_PROPERTY
+ XML_SCHEMA_VERSION_PROPERTY,
+ DATATYPE_XML_VERSION_PROPERTY
};
/** Empty enumeration. */
Modified: xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/ValidationContext.java
URL: http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/ValidationContext.java?rev=1171147&r1=1171146&r2=1171147&view=diff
==============================================================================
--- xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/ValidationContext.java (original)
+++ xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/ValidationContext.java Thu Sep 15 15:44:30 2011
@@ -64,5 +64,8 @@ public interface ValidationContext {
public Locale getLocale();
// TypeValidatorHelper
- public TypeValidatorHelper getTypeValidatorHelper();
+ public TypeValidatorHelper getTypeValidatorHelper();
+
+ // Datatype XML version
+ public short getDatatypeXMLVersion();
}
Modified: xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/EntityDV.java
URL: http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/EntityDV.java?rev=1171147&r1=1171146&r2=1171147&view=diff
==============================================================================
--- xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/EntityDV.java (original)
+++ xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/EntityDV.java Thu Sep 15 15:44:30 2011
@@ -17,8 +17,10 @@
package org.apache.xerces.impl.dv.xs;
+import org.apache.xerces.impl.Constants;
import org.apache.xerces.impl.dv.InvalidDatatypeValueException;
import org.apache.xerces.impl.dv.ValidationContext;
+import org.apache.xerces.util.XML11Char;
import org.apache.xerces.util.XMLChar;
/**
@@ -34,7 +36,9 @@ import org.apache.xerces.util.XMLChar;
public class EntityDV extends TypeValidator {
public Object getActualValue(String content, ValidationContext context) throws InvalidDatatypeValueException {
- if (!XMLChar.isValidNCName(content)) {
+ final boolean valid = (context.getDatatypeXMLVersion() == Constants.XML_VERSION_1_0)
+ ? XMLChar.isValidNCName(content) : XML11Char.isXML11ValidNCName(content);
+ if (!valid) {
throw new InvalidDatatypeValueException("cvc-datatype-valid.1.2.1", new Object[]{content, "NCName"});
}
Modified: xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/IDDV.java
URL: http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/IDDV.java?rev=1171147&r1=1171146&r2=1171147&view=diff
==============================================================================
--- xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/IDDV.java (original)
+++ xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/IDDV.java Thu Sep 15 15:44:30 2011
@@ -17,8 +17,10 @@
package org.apache.xerces.impl.dv.xs;
+import org.apache.xerces.impl.Constants;
import org.apache.xerces.impl.dv.InvalidDatatypeValueException;
import org.apache.xerces.impl.dv.ValidationContext;
+import org.apache.xerces.util.XML11Char;
import org.apache.xerces.util.XMLChar;
/**
@@ -34,7 +36,9 @@ import org.apache.xerces.util.XMLChar;
public class IDDV extends TypeValidator{
public Object getActualValue(String content, ValidationContext context) throws InvalidDatatypeValueException {
- if (!XMLChar.isValidNCName(content)) {
+ final boolean valid = (context.getDatatypeXMLVersion() == Constants.XML_VERSION_1_0)
+ ? XMLChar.isValidNCName(content) : XML11Char.isXML11ValidNCName(content);
+ if (!valid) {
throw new InvalidDatatypeValueException("cvc-datatype-valid.1.2.1", new Object[]{content, "NCName"});
}
return content;
Modified: xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/IDREFDV.java
URL: http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/IDREFDV.java?rev=1171147&r1=1171146&r2=1171147&view=diff
==============================================================================
--- xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/IDREFDV.java (original)
+++ xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/IDREFDV.java Thu Sep 15 15:44:30 2011
@@ -17,8 +17,10 @@
package org.apache.xerces.impl.dv.xs;
+import org.apache.xerces.impl.Constants;
import org.apache.xerces.impl.dv.InvalidDatatypeValueException;
import org.apache.xerces.impl.dv.ValidationContext;
+import org.apache.xerces.util.XML11Char;
import org.apache.xerces.util.XMLChar;
/**
@@ -34,7 +36,9 @@ import org.apache.xerces.util.XMLChar;
public class IDREFDV extends TypeValidator{
public Object getActualValue(String content, ValidationContext context) throws InvalidDatatypeValueException {
- if (!XMLChar.isValidNCName(content)) {
+ final boolean valid = (context.getDatatypeXMLVersion() == Constants.XML_VERSION_1_0)
+ ? XMLChar.isValidNCName(content) : XML11Char.isXML11ValidNCName(content);
+ if (!valid) {
throw new InvalidDatatypeValueException("cvc-datatype-valid.1.2.1", new Object[]{content, "NCName"});
}
return content;
Modified: xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/QNameDV.java
URL: http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/QNameDV.java?rev=1171147&r1=1171146&r2=1171147&view=diff
==============================================================================
--- xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/QNameDV.java (original)
+++ xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/QNameDV.java Thu Sep 15 15:44:30 2011
@@ -17,6 +17,7 @@
package org.apache.xerces.impl.dv.xs;
+import org.apache.xerces.impl.Constants;
import org.apache.xerces.impl.dv.InvalidDatatypeValueException;
import org.apache.xerces.impl.dv.ValidationContext;
import org.apache.xerces.util.XML11Char;
@@ -53,15 +54,15 @@ public class QNameDV extends TypeValidat
localpart = content;
}
- boolean isSchema11 = context.getTypeValidatorHelper().isXMLSchema11();
+ final boolean isXML10 = context.getDatatypeXMLVersion() == Constants.XML_VERSION_1_0;
// both prefix (if any) and localpart must be valid NCName
// if using XSD 1.1, use the XML 1.1 rules of validating the prefix and the local part, else use the XML 1.0 rules
- if (prefix.length() > 0 && ((isSchema11) ? !XML11Char.isXML11ValidNCName(prefix) : !XMLChar.isValidNCName(prefix))) {
+ if (prefix.length() > 0 && ((isXML10) ? !XMLChar.isValidNCName(prefix) : !XML11Char.isXML11ValidNCName(prefix))) {
throw new InvalidDatatypeValueException("cvc-datatype-valid.1.2.1", new Object[]{content, "QName"});
}
- if((isSchema11) ? !XML11Char.isXML11ValidNCName(localpart) : !XMLChar.isValidNCName(localpart)) {
+ if ((isXML10) ? !XMLChar.isValidNCName(localpart) : !XML11Char.isXML11ValidNCName(localpart)) {
throw new InvalidDatatypeValueException("cvc-datatype-valid.1.2.1", new Object[]{content, "QName"});
}
Modified: xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/Schema11DVFactoryImpl.java
URL: http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/Schema11DVFactoryImpl.java?rev=1171147&r1=1171146&r2=1171147&view=diff
==============================================================================
--- xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/Schema11DVFactoryImpl.java (original)
+++ xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/Schema11DVFactoryImpl.java Thu Sep 15 15:44:30 2011
@@ -67,23 +67,24 @@ public class Schema11DVFactoryImpl exten
// as the base type
final XSFacets facets = new XSFacets();
facets.minLength = 1;
+ facets.whiteSpace = XSSimpleType.WS_COLLAPSE;
// add ENTITIES
final XSSimpleTypeDecl entityDV = (XSSimpleTypeDecl)fBuiltInTypes.get(ENTITY);
final XSSimpleTypeDecl entitiesDV = new XSSimpleTypeDecl(ENTITIES, URI_SCHEMAFORSCHEMA, (short)0, entityDV, false, null);
- entitiesDV.applyFacets1(facets, XSSimpleType.FACET_MINLENGTH, (short)0);
+ entitiesDV.applyFacets1(facets, XSSimpleType.FACET_MINLENGTH | XSSimpleType.FACET_WHITESPACE, (short)0);
fBuiltInTypes.put(ENTITIES, entitiesDV);
// add NMTOKENS
final XSSimpleTypeDecl nmtokenDV = (XSSimpleTypeDecl)fBuiltInTypes.get(NMTOKEN);
final XSSimpleTypeDecl nmtokensDV = new XSSimpleTypeDecl(NMTOKENS, URI_SCHEMAFORSCHEMA, (short)0, nmtokenDV, false, null);
- nmtokensDV.applyFacets1(facets, XSSimpleType.FACET_MINLENGTH, (short)0);
+ nmtokensDV.applyFacets1(facets, XSSimpleType.FACET_MINLENGTH | XSSimpleType.FACET_WHITESPACE, (short)0);
fBuiltInTypes.put(NMTOKENS, nmtokensDV);
// add IDREFS
final XSSimpleTypeDecl idrefDV = (XSSimpleTypeDecl)fBuiltInTypes.get(IDREF);
final XSSimpleTypeDecl idrefsDV = new XSSimpleTypeDecl(IDREFS, URI_SCHEMAFORSCHEMA, (short)0, idrefDV, false, null);
- idrefsDV.applyFacets1(facets, XSSimpleType.FACET_MINLENGTH, (short)0);
+ idrefsDV.applyFacets1(facets, XSSimpleType.FACET_MINLENGTH | XSSimpleType.FACET_WHITESPACE, (short)0);
fBuiltInTypes.put(IDREFS, idrefsDV);
// add 2 duration types
Modified: xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/XSSimpleTypeDecl.java
URL: http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/XSSimpleTypeDecl.java?rev=1171147&r1=1171146&r2=1171147&view=diff
==============================================================================
--- xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/XSSimpleTypeDecl.java (original)
+++ xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/XSSimpleTypeDecl.java Thu Sep 15 15:44:30 2011
@@ -244,6 +244,9 @@ public class XSSimpleTypeDecl implements
public TypeValidatorHelper getTypeValidatorHelper() {
return TypeValidatorHelper.getInstance(Constants.SCHEMA_VERSION_1_0);
}
+ public short getDatatypeXMLVersion() {
+ return Constants.XML_VERSION_1_0;
+ }
};
protected static TypeValidator[] getGDVs() {
@@ -887,7 +890,7 @@ public class XSSimpleTypeDecl implements
patternAnnotations = facets.patternAnnotations;
RegularExpression regex = null;
try {
- regex = new RegularExpression(facets.pattern, "X", context.getLocale());
+ regex = new RegularExpression(facets.pattern, "X", context.getLocale(), context.getDatatypeXMLVersion());
} catch (Exception e) {
reportError("InvalidRegex", new Object[]{facets.pattern, e.getLocalizedMessage()});
}
@@ -2044,19 +2047,19 @@ public class XSSimpleTypeDecl implements
if (fPatternType != SPECIAL_PATTERN_NONE) {
boolean seenErr = false;
- boolean isSchema11 = context.getTypeValidatorHelper().isXMLSchema11();
+ final boolean isXML11 = context.getDatatypeXMLVersion() == Constants.XML_VERSION_1_1;
// if using XSD 1.1, use the XML 1.1 rules of validating the NMTOKEN, Name and NCName else use the XML 1.0 rules
if (fPatternType == SPECIAL_PATTERN_NMTOKEN) {
// PATTERN "\\c+"
- seenErr = (isSchema11) ? !XML11Char.isXML11ValidNmtoken(nvalue) : !XMLChar.isValidNmtoken(nvalue);
+ seenErr = (isXML11) ? !XML11Char.isXML11ValidNmtoken(nvalue) : !XMLChar.isValidNmtoken(nvalue);
}
else if (fPatternType == SPECIAL_PATTERN_NAME) {
// PATTERN "\\i\\c*"
- seenErr = (isSchema11) ? !XML11Char.isXML11ValidName(nvalue) : !XMLChar.isValidName(nvalue);
+ seenErr = (isXML11) ? !XML11Char.isXML11ValidName(nvalue) : !XMLChar.isValidName(nvalue);
}
else if (fPatternType == SPECIAL_PATTERN_NCNAME) {
// PATTERN "[\\i-[:]][\\c-[:]]*"
- seenErr = (isSchema11) ? !XML11Char.isXML11ValidNCName(nvalue) : !XMLChar.isValidNCName(nvalue);
+ seenErr = (isXML11) ? !XML11Char.isXML11ValidNCName(nvalue) : !XMLChar.isValidNCName(nvalue);
}
if (seenErr) {
throw new InvalidDatatypeValueException("cvc-datatype-valid.1.2.1",
@@ -3127,6 +3130,10 @@ public class XSSimpleTypeDecl implements
public TypeValidatorHelper getTypeValidatorHelper() {
return TypeValidatorHelper.getInstance(Constants.SCHEMA_VERSION_1_0);
}
+
+ public short getDatatypeXMLVersion() {
+ return Constants.XML_VERSION_1_0;
+ }
};
private boolean fAnonymous = false;
@@ -3203,6 +3210,10 @@ public class XSSimpleTypeDecl implements
public TypeValidatorHelper getTypeValidatorHelper() {
return fExternal.getTypeValidatorHelper();
}
+
+ public short getDatatypeXMLVersion() {
+ return fExternal.getDatatypeXMLVersion();
+ }
}
public void reset(){
@@ -3778,23 +3789,6 @@ public class XSSimpleTypeDecl implements
return isDOMDerivedFrom(typeNamespaceArg, typeNameArg, derivationMethod);
}
- private short convertToPrimitiveKind(short valueType) {
- /** Primitive datatypes. */
- if (valueType <= XSConstants.NOTATION_DT) {
- return valueType;
- }
- /** Types derived from string. */
- if (valueType <= XSConstants.ENTITY_DT) {
- return XSConstants.STRING_DT;
- }
- /** Types derived from decimal. */
- if (valueType <= XSConstants.POSITIVEINTEGER_DT) {
- return XSConstants.DECIMAL_DT;
- }
- /** Other types. */
- return valueType;
- }
-
private void appendEnumString(StringBuffer sb) {
sb.append('[');
for (int i = 0; i < fEnumerationSize; i++) {
Modified: xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/validation/ValidationState.java
URL: http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/validation/ValidationState.java?rev=1171147&r1=1171146&r2=1171147&view=diff
==============================================================================
--- xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/validation/ValidationState.java (original)
+++ xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/validation/ValidationState.java Thu Sep 15 15:44:30 2011
@@ -21,6 +21,7 @@ import java.util.HashMap;
import java.util.Iterator;
import java.util.Locale;
+import org.apache.xerces.impl.Constants;
import org.apache.xerces.impl.dv.ValidationContext;
import org.apache.xerces.impl.dv.xs.TypeValidatorHelper;
import org.apache.xerces.util.SymbolTable;
@@ -56,6 +57,7 @@ public class ValidationState implements
private final static Object fNullValue = new Object();
private TypeValidatorHelper fTypeValidatorHelper = null;
+ private short fXMLVersion = Constants.XML_VERSION_1_0;
//
// public methods
@@ -215,4 +217,13 @@ public class ValidationState implements
public TypeValidatorHelper getTypeValidatorHelper() {
return fTypeValidatorHelper;
}
+
+ // Datatype XML Version
+ public void setDatatypeXMLVersion(short xmlVersion) {
+ fXMLVersion = xmlVersion;
+ }
+
+ public short getDatatypeXMLVersion() {
+ return fXMLVersion;
+ }
}
Modified: xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xpath/regex/ParserForXMLSchema.java
URL: http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xpath/regex/ParserForXMLSchema.java?rev=1171147&r1=1171146&r2=1171147&view=diff
==============================================================================
--- xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xpath/regex/ParserForXMLSchema.java (original)
+++ xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xpath/regex/ParserForXMLSchema.java Thu Sep 15 15:44:30 2011
@@ -17,9 +17,10 @@
package org.apache.xerces.impl.xpath.regex;
-import java.util.Hashtable;
import java.util.Locale;
+import org.apache.xerces.impl.Constants;
+
/**
* A regular expression parser for the XML Schema.
*
@@ -30,12 +31,19 @@ import java.util.Locale;
*/
class ParserForXMLSchema extends RegexParser {
+ private RangeTokenMap xmlMap = null;
+ private short xmlVersion = Constants.XML_VERSION_1_0;
+
public ParserForXMLSchema() {
//this.setLocale(Locale.getDefault());
}
public ParserForXMLSchema(Locale locale) {
super(locale);
}
+ public ParserForXMLSchema(Locale locale, short datatypeXMLVersion) {
+ super(locale);
+ xmlVersion = datatypeXMLVersion;
+ }
Token processCaret() throws ParseException {
this.next();
@@ -313,27 +321,30 @@ class ParserForXMLSchema extends RegexPa
}
Token getTokenForShorthand(int ch) {
+ if (xmlMap == null) {
+ xmlMap = RangeTokenMapFactory.getXMLTokenMap(xmlVersion);
+ }
switch (ch) {
case 'd':
- return ParserForXMLSchema.getRange("xml:isDigit", true);
+ return xmlMap.get("xml:isDigit", true);
case 'D':
- return ParserForXMLSchema.getRange("xml:isDigit", false);
+ return xmlMap.get("xml:isDigit", false);
case 'w':
- return ParserForXMLSchema.getRange("xml:isWord", true);
+ return xmlMap.get("xml:isWord", true);
case 'W':
- return ParserForXMLSchema.getRange("xml:isWord", false);
+ return xmlMap.get("xml:isWord", false);
case 's':
- return ParserForXMLSchema.getRange("xml:isSpace", true);
+ return xmlMap.get("xml:isSpace", true);
case 'S':
- return ParserForXMLSchema.getRange("xml:isSpace", false);
+ return xmlMap.get("xml:isSpace", false);
case 'c':
- return ParserForXMLSchema.getRange("xml:isNameChar", true);
+ return xmlMap.get("xml:isNameChar", true);
case 'C':
- return ParserForXMLSchema.getRange("xml:isNameChar", false);
+ return xmlMap.get("xml:isNameChar", false);
case 'i':
- return ParserForXMLSchema.getRange("xml:isInitialNameChar", true);
+ return xmlMap.get("xml:isInitialNameChar", true);
case 'I':
- return ParserForXMLSchema.getRange("xml:isInitialNameChar", false);
+ return xmlMap.get("xml:isInitialNameChar", false);
default:
throw new RuntimeException("Internal Error: shorthands: \\u"+Integer.toString(ch, 16));
}
@@ -365,145 +376,4 @@ class ParserForXMLSchema extends RegexPa
}
return c;
}
-
- static private Hashtable ranges = null;
- static private Hashtable ranges2 = null;
- static synchronized protected RangeToken getRange(String name, boolean positive) {
- if (ranges == null) {
- ranges = new Hashtable();
- ranges2 = new Hashtable();
-
- Token tok = Token.createRange();
- setupRange(tok, SPACES);
- ranges.put("xml:isSpace", tok);
- ranges2.put("xml:isSpace", Token.complementRanges(tok));
-
- tok = Token.createRange();
-// setupRange(tok, DIGITS);
- setupRange(tok, DIGITS_INTS);
- ranges.put("xml:isDigit", tok);
- ranges2.put("xml:isDigit", Token.complementRanges(tok));
-
- tok = Token.createRange();
- setupRange(tok, LETTERS);
- tok.mergeRanges((Token)ranges.get("xml:isDigit"));
- ranges.put("xml:isWord", tok);
- ranges2.put("xml:isWord", Token.complementRanges(tok));
-
- tok = Token.createRange();
- setupRange(tok, NAMECHARS);
- ranges.put("xml:isNameChar", tok);
- ranges2.put("xml:isNameChar", Token.complementRanges(tok));
-
- tok = Token.createRange();
- setupRange(tok, LETTERS);
- tok.addRange('_', '_');
- tok.addRange(':', ':');
- ranges.put("xml:isInitialNameChar", tok);
- ranges2.put("xml:isInitialNameChar", Token.complementRanges(tok));
- }
- RangeToken tok = positive ? (RangeToken)ranges.get(name)
- : (RangeToken)ranges2.get(name);
- return tok;
- }
-
- static void setupRange(Token range, String src) {
- int len = src.length();
- for (int i = 0; i < len; i += 2)
- range.addRange(src.charAt(i), src.charAt(i+1));
- }
-
- static void setupRange(Token range, int[] src) {
- int len = src.length;
- for (int i = 0; i < len; i += 2)
- range.addRange(src[i], src[i+1]);
- }
-
- private static final String SPACES = "\t\n\r\r ";
- private static final String NAMECHARS =
- "\u002d\u002e\u0030\u003a\u0041\u005a\u005f\u005f\u0061\u007a\u00b7\u00b7\u00c0\u00d6"
- +"\u00d8\u00f6\u00f8\u0131\u0134\u013e\u0141\u0148\u014a\u017e\u0180\u01c3\u01cd\u01f0"
- +"\u01f4\u01f5\u01fa\u0217\u0250\u02a8\u02bb\u02c1\u02d0\u02d1\u0300\u0345\u0360\u0361"
- +"\u0386\u038a\u038c\u038c\u038e\u03a1\u03a3\u03ce\u03d0\u03d6\u03da\u03da\u03dc\u03dc"
- +"\u03de\u03de\u03e0\u03e0\u03e2\u03f3\u0401\u040c\u040e\u044f\u0451\u045c\u045e\u0481"
- +"\u0483\u0486\u0490\u04c4\u04c7\u04c8\u04cb\u04cc\u04d0\u04eb\u04ee\u04f5\u04f8\u04f9"
- +"\u0531\u0556\u0559\u0559\u0561\u0586\u0591\u05a1\u05a3\u05b9\u05bb\u05bd\u05bf\u05bf"
- +"\u05c1\u05c2\u05c4\u05c4\u05d0\u05ea\u05f0\u05f2\u0621\u063a\u0640\u0652\u0660\u0669"
- +"\u0670\u06b7\u06ba\u06be\u06c0\u06ce\u06d0\u06d3\u06d5\u06e8\u06ea\u06ed\u06f0\u06f9"
- +"\u0901\u0903\u0905\u0939\u093c\u094d\u0951\u0954\u0958\u0963\u0966\u096f\u0981\u0983"
- +"\u0985\u098c\u098f\u0990\u0993\u09a8\u09aa\u09b0\u09b2\u09b2\u09b6\u09b9\u09bc\u09bc"
- +"\u09be\u09c4\u09c7\u09c8\u09cb\u09cd\u09d7\u09d7\u09dc\u09dd\u09df\u09e3\u09e6\u09f1"
- +"\u0a02\u0a02\u0a05\u0a0a\u0a0f\u0a10\u0a13\u0a28\u0a2a\u0a30\u0a32\u0a33\u0a35\u0a36"
- +"\u0a38\u0a39\u0a3c\u0a3c\u0a3e\u0a42\u0a47\u0a48\u0a4b\u0a4d\u0a59\u0a5c\u0a5e\u0a5e"
- +"\u0a66\u0a74\u0a81\u0a83\u0a85\u0a8b\u0a8d\u0a8d\u0a8f\u0a91\u0a93\u0aa8\u0aaa\u0ab0"
- +"\u0ab2\u0ab3\u0ab5\u0ab9\u0abc\u0ac5\u0ac7\u0ac9\u0acb\u0acd\u0ae0\u0ae0\u0ae6\u0aef"
- +"\u0b01\u0b03\u0b05\u0b0c\u0b0f\u0b10\u0b13\u0b28\u0b2a\u0b30\u0b32\u0b33\u0b36\u0b39"
- +"\u0b3c\u0b43\u0b47\u0b48\u0b4b\u0b4d\u0b56\u0b57\u0b5c\u0b5d\u0b5f\u0b61\u0b66\u0b6f"
- +"\u0b82\u0b83\u0b85\u0b8a\u0b8e\u0b90\u0b92\u0b95\u0b99\u0b9a\u0b9c\u0b9c\u0b9e\u0b9f"
- +"\u0ba3\u0ba4\u0ba8\u0baa\u0bae\u0bb5\u0bb7\u0bb9\u0bbe\u0bc2\u0bc6\u0bc8\u0bca\u0bcd"
- +"\u0bd7\u0bd7\u0be7\u0bef\u0c01\u0c03\u0c05\u0c0c\u0c0e\u0c10\u0c12\u0c28\u0c2a\u0c33"
- +"\u0c35\u0c39\u0c3e\u0c44\u0c46\u0c48\u0c4a\u0c4d\u0c55\u0c56\u0c60\u0c61\u0c66\u0c6f"
- +"\u0c82\u0c83\u0c85\u0c8c\u0c8e\u0c90\u0c92\u0ca8\u0caa\u0cb3\u0cb5\u0cb9\u0cbe\u0cc4"
- +"\u0cc6\u0cc8\u0cca\u0ccd\u0cd5\u0cd6\u0cde\u0cde\u0ce0\u0ce1\u0ce6\u0cef\u0d02\u0d03"
- +"\u0d05\u0d0c\u0d0e\u0d10\u0d12\u0d28\u0d2a\u0d39\u0d3e\u0d43\u0d46\u0d48\u0d4a\u0d4d"
- +"\u0d57\u0d57\u0d60\u0d61\u0d66\u0d6f\u0e01\u0e2e\u0e30\u0e3a\u0e40\u0e4e\u0e50\u0e59"
- +"\u0e81\u0e82\u0e84\u0e84\u0e87\u0e88\u0e8a\u0e8a\u0e8d\u0e8d\u0e94\u0e97\u0e99\u0e9f"
- +"\u0ea1\u0ea3\u0ea5\u0ea5\u0ea7\u0ea7\u0eaa\u0eab\u0ead\u0eae\u0eb0\u0eb9\u0ebb\u0ebd"
- +"\u0ec0\u0ec4\u0ec6\u0ec6\u0ec8\u0ecd\u0ed0\u0ed9\u0f18\u0f19\u0f20\u0f29\u0f35\u0f35"
- +"\u0f37\u0f37\u0f39\u0f39\u0f3e\u0f47\u0f49\u0f69\u0f71\u0f84\u0f86\u0f8b\u0f90\u0f95"
- +"\u0f97\u0f97\u0f99\u0fad\u0fb1\u0fb7\u0fb9\u0fb9\u10a0\u10c5\u10d0\u10f6\u1100\u1100"
- +"\u1102\u1103\u1105\u1107\u1109\u1109\u110b\u110c\u110e\u1112\u113c\u113c\u113e\u113e"
- +"\u1140\u1140\u114c\u114c\u114e\u114e\u1150\u1150\u1154\u1155\u1159\u1159\u115f\u1161"
- +"\u1163\u1163\u1165\u1165\u1167\u1167\u1169\u1169\u116d\u116e\u1172\u1173\u1175\u1175"
- +"\u119e\u119e\u11a8\u11a8\u11ab\u11ab\u11ae\u11af\u11b7\u11b8\u11ba\u11ba\u11bc\u11c2"
- +"\u11eb\u11eb\u11f0\u11f0\u11f9\u11f9\u1e00\u1e9b\u1ea0\u1ef9\u1f00\u1f15\u1f18\u1f1d"
- +"\u1f20\u1f45\u1f48\u1f4d\u1f50\u1f57\u1f59\u1f59\u1f5b\u1f5b\u1f5d\u1f5d\u1f5f\u1f7d"
- +"\u1f80\u1fb4\u1fb6\u1fbc\u1fbe\u1fbe\u1fc2\u1fc4\u1fc6\u1fcc\u1fd0\u1fd3\u1fd6\u1fdb"
- +"\u1fe0\u1fec\u1ff2\u1ff4\u1ff6\u1ffc\u20d0\u20dc\u20e1\u20e1\u2126\u2126\u212a\u212b"
- +"\u212e\u212e\u2180\u2182\u3005\u3005\u3007\u3007\u3021\u302f\u3031\u3035\u3041\u3094"
- +"\u3099\u309a\u309d\u309e\u30a1\u30fa\u30fc\u30fe\u3105\u312c\u4e00\u9fa5\uac00\ud7a3"
- +"";
- private static final String LETTERS =
- "\u0041\u005a\u0061\u007a\u00c0\u00d6\u00d8\u00f6\u00f8\u0131\u0134\u013e\u0141\u0148"
- +"\u014a\u017e\u0180\u01c3\u01cd\u01f0\u01f4\u01f5\u01fa\u0217\u0250\u02a8\u02bb\u02c1"
- +"\u0386\u0386\u0388\u038a\u038c\u038c\u038e\u03a1\u03a3\u03ce\u03d0\u03d6\u03da\u03da"
- +"\u03dc\u03dc\u03de\u03de\u03e0\u03e0\u03e2\u03f3\u0401\u040c\u040e\u044f\u0451\u045c"
- +"\u045e\u0481\u0490\u04c4\u04c7\u04c8\u04cb\u04cc\u04d0\u04eb\u04ee\u04f5\u04f8\u04f9"
- +"\u0531\u0556\u0559\u0559\u0561\u0586\u05d0\u05ea\u05f0\u05f2\u0621\u063a\u0641\u064a"
- +"\u0671\u06b7\u06ba\u06be\u06c0\u06ce\u06d0\u06d3\u06d5\u06d5\u06e5\u06e6\u0905\u0939"
- +"\u093d\u093d\u0958\u0961\u0985\u098c\u098f\u0990\u0993\u09a8\u09aa\u09b0\u09b2\u09b2"
- +"\u09b6\u09b9\u09dc\u09dd\u09df\u09e1\u09f0\u09f1\u0a05\u0a0a\u0a0f\u0a10\u0a13\u0a28"
- +"\u0a2a\u0a30\u0a32\u0a33\u0a35\u0a36\u0a38\u0a39\u0a59\u0a5c\u0a5e\u0a5e\u0a72\u0a74"
- +"\u0a85\u0a8b\u0a8d\u0a8d\u0a8f\u0a91\u0a93\u0aa8\u0aaa\u0ab0\u0ab2\u0ab3\u0ab5\u0ab9"
- +"\u0abd\u0abd\u0ae0\u0ae0\u0b05\u0b0c\u0b0f\u0b10\u0b13\u0b28\u0b2a\u0b30\u0b32\u0b33"
- +"\u0b36\u0b39\u0b3d\u0b3d\u0b5c\u0b5d\u0b5f\u0b61\u0b85\u0b8a\u0b8e\u0b90\u0b92\u0b95"
- +"\u0b99\u0b9a\u0b9c\u0b9c\u0b9e\u0b9f\u0ba3\u0ba4\u0ba8\u0baa\u0bae\u0bb5\u0bb7\u0bb9"
- +"\u0c05\u0c0c\u0c0e\u0c10\u0c12\u0c28\u0c2a\u0c33\u0c35\u0c39\u0c60\u0c61\u0c85\u0c8c"
- +"\u0c8e\u0c90\u0c92\u0ca8\u0caa\u0cb3\u0cb5\u0cb9\u0cde\u0cde\u0ce0\u0ce1\u0d05\u0d0c"
- +"\u0d0e\u0d10\u0d12\u0d28\u0d2a\u0d39\u0d60\u0d61\u0e01\u0e2e\u0e30\u0e30\u0e32\u0e33"
- +"\u0e40\u0e45\u0e81\u0e82\u0e84\u0e84\u0e87\u0e88\u0e8a\u0e8a\u0e8d\u0e8d\u0e94\u0e97"
- +"\u0e99\u0e9f\u0ea1\u0ea3\u0ea5\u0ea5\u0ea7\u0ea7\u0eaa\u0eab\u0ead\u0eae\u0eb0\u0eb0"
- +"\u0eb2\u0eb3\u0ebd\u0ebd\u0ec0\u0ec4\u0f40\u0f47\u0f49\u0f69\u10a0\u10c5\u10d0\u10f6"
- +"\u1100\u1100\u1102\u1103\u1105\u1107\u1109\u1109\u110b\u110c\u110e\u1112\u113c\u113c"
- +"\u113e\u113e\u1140\u1140\u114c\u114c\u114e\u114e\u1150\u1150\u1154\u1155\u1159\u1159"
- +"\u115f\u1161\u1163\u1163\u1165\u1165\u1167\u1167\u1169\u1169\u116d\u116e\u1172\u1173"
- +"\u1175\u1175\u119e\u119e\u11a8\u11a8\u11ab\u11ab\u11ae\u11af\u11b7\u11b8\u11ba\u11ba"
- +"\u11bc\u11c2\u11eb\u11eb\u11f0\u11f0\u11f9\u11f9\u1e00\u1e9b\u1ea0\u1ef9\u1f00\u1f15"
- +"\u1f18\u1f1d\u1f20\u1f45\u1f48\u1f4d\u1f50\u1f57\u1f59\u1f59\u1f5b\u1f5b\u1f5d\u1f5d"
- +"\u1f5f\u1f7d\u1f80\u1fb4\u1fb6\u1fbc\u1fbe\u1fbe\u1fc2\u1fc4\u1fc6\u1fcc\u1fd0\u1fd3"
- +"\u1fd6\u1fdb\u1fe0\u1fec\u1ff2\u1ff4\u1ff6\u1ffc\u2126\u2126\u212a\u212b\u212e\u212e"
- +"\u2180\u2182\u3007\u3007\u3021\u3029\u3041\u3094\u30a1\u30fa\u3105\u312c\u4e00\u9fa5"
- +"\uac00\ud7a3";
- private static final String DIGITS =
- "\u0030\u0039\u0660\u0669\u06F0\u06F9\u0966\u096F\u09E6\u09EF\u0A66\u0A6F\u0AE6\u0AEF"
- +"\u0B66\u0B6F\u0BE7\u0BEF\u0C66\u0C6F\u0CE6\u0CEF\u0D66\u0D6F\u0E50\u0E59\u0ED0\u0ED9"
- +"\u0F20\u0F29";
- private static final int[] DIGITS_INTS = {
- 0x0030, 0x0039, 0x0660, 0x0669, 0x06F0, 0x06F9, 0x0966, 0x096F,
- 0x09E6, 0x09EF, 0x0A66, 0x0A6F, 0x0AE6, 0x0AEF, 0x0B66, 0x0B6F,
- 0x0BE7, 0x0BEF, 0x0C66, 0x0C6F, 0x0CE6, 0x0CEF, 0x0D66, 0x0D6F,
- 0x0E50, 0x0E59, 0x0ED0, 0x0ED9, 0x0F20, 0x0F29, 0x1040, 0x1049,
- 0x1369, 0x1371, 0x17E0, 0x17E9, 0x1810, 0x1819, 0xFF10, 0xFF19,
- 0x1D7CE, 0x1D7FF
- };
}
Added: xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xpath/regex/REConstants.java
URL: http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xpath/regex/REConstants.java?rev=1171147&view=auto
==============================================================================
--- xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xpath/regex/REConstants.java (added)
+++ xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xpath/regex/REConstants.java Thu Sep 15 15:44:30 2011
@@ -0,0 +1,129 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.xerces.impl.xpath.regex;
+
+/**
+ * @version $Id$
+ */
+final class REConstants {
+
+ private REConstants() {
+ }
+
+ static final String SPACES = "\t\n\r\r ";
+
+ static final String NAMECHARS =
+ "\u002d\u002e\u0030\u003a\u0041\u005a\u005f\u005f\u0061\u007a\u00b7\u00b7\u00c0\u00d6"
+ +"\u00d8\u00f6\u00f8\u0131\u0134\u013e\u0141\u0148\u014a\u017e\u0180\u01c3\u01cd\u01f0"
+ +"\u01f4\u01f5\u01fa\u0217\u0250\u02a8\u02bb\u02c1\u02d0\u02d1\u0300\u0345\u0360\u0361"
+ +"\u0386\u038a\u038c\u038c\u038e\u03a1\u03a3\u03ce\u03d0\u03d6\u03da\u03da\u03dc\u03dc"
+ +"\u03de\u03de\u03e0\u03e0\u03e2\u03f3\u0401\u040c\u040e\u044f\u0451\u045c\u045e\u0481"
+ +"\u0483\u0486\u0490\u04c4\u04c7\u04c8\u04cb\u04cc\u04d0\u04eb\u04ee\u04f5\u04f8\u04f9"
+ +"\u0531\u0556\u0559\u0559\u0561\u0586\u0591\u05a1\u05a3\u05b9\u05bb\u05bd\u05bf\u05bf"
+ +"\u05c1\u05c2\u05c4\u05c4\u05d0\u05ea\u05f0\u05f2\u0621\u063a\u0640\u0652\u0660\u0669"
+ +"\u0670\u06b7\u06ba\u06be\u06c0\u06ce\u06d0\u06d3\u06d5\u06e8\u06ea\u06ed\u06f0\u06f9"
+ +"\u0901\u0903\u0905\u0939\u093c\u094d\u0951\u0954\u0958\u0963\u0966\u096f\u0981\u0983"
+ +"\u0985\u098c\u098f\u0990\u0993\u09a8\u09aa\u09b0\u09b2\u09b2\u09b6\u09b9\u09bc\u09bc"
+ +"\u09be\u09c4\u09c7\u09c8\u09cb\u09cd\u09d7\u09d7\u09dc\u09dd\u09df\u09e3\u09e6\u09f1"
+ +"\u0a02\u0a02\u0a05\u0a0a\u0a0f\u0a10\u0a13\u0a28\u0a2a\u0a30\u0a32\u0a33\u0a35\u0a36"
+ +"\u0a38\u0a39\u0a3c\u0a3c\u0a3e\u0a42\u0a47\u0a48\u0a4b\u0a4d\u0a59\u0a5c\u0a5e\u0a5e"
+ +"\u0a66\u0a74\u0a81\u0a83\u0a85\u0a8b\u0a8d\u0a8d\u0a8f\u0a91\u0a93\u0aa8\u0aaa\u0ab0"
+ +"\u0ab2\u0ab3\u0ab5\u0ab9\u0abc\u0ac5\u0ac7\u0ac9\u0acb\u0acd\u0ae0\u0ae0\u0ae6\u0aef"
+ +"\u0b01\u0b03\u0b05\u0b0c\u0b0f\u0b10\u0b13\u0b28\u0b2a\u0b30\u0b32\u0b33\u0b36\u0b39"
+ +"\u0b3c\u0b43\u0b47\u0b48\u0b4b\u0b4d\u0b56\u0b57\u0b5c\u0b5d\u0b5f\u0b61\u0b66\u0b6f"
+ +"\u0b82\u0b83\u0b85\u0b8a\u0b8e\u0b90\u0b92\u0b95\u0b99\u0b9a\u0b9c\u0b9c\u0b9e\u0b9f"
+ +"\u0ba3\u0ba4\u0ba8\u0baa\u0bae\u0bb5\u0bb7\u0bb9\u0bbe\u0bc2\u0bc6\u0bc8\u0bca\u0bcd"
+ +"\u0bd7\u0bd7\u0be7\u0bef\u0c01\u0c03\u0c05\u0c0c\u0c0e\u0c10\u0c12\u0c28\u0c2a\u0c33"
+ +"\u0c35\u0c39\u0c3e\u0c44\u0c46\u0c48\u0c4a\u0c4d\u0c55\u0c56\u0c60\u0c61\u0c66\u0c6f"
+ +"\u0c82\u0c83\u0c85\u0c8c\u0c8e\u0c90\u0c92\u0ca8\u0caa\u0cb3\u0cb5\u0cb9\u0cbe\u0cc4"
+ +"\u0cc6\u0cc8\u0cca\u0ccd\u0cd5\u0cd6\u0cde\u0cde\u0ce0\u0ce1\u0ce6\u0cef\u0d02\u0d03"
+ +"\u0d05\u0d0c\u0d0e\u0d10\u0d12\u0d28\u0d2a\u0d39\u0d3e\u0d43\u0d46\u0d48\u0d4a\u0d4d"
+ +"\u0d57\u0d57\u0d60\u0d61\u0d66\u0d6f\u0e01\u0e2e\u0e30\u0e3a\u0e40\u0e4e\u0e50\u0e59"
+ +"\u0e81\u0e82\u0e84\u0e84\u0e87\u0e88\u0e8a\u0e8a\u0e8d\u0e8d\u0e94\u0e97\u0e99\u0e9f"
+ +"\u0ea1\u0ea3\u0ea5\u0ea5\u0ea7\u0ea7\u0eaa\u0eab\u0ead\u0eae\u0eb0\u0eb9\u0ebb\u0ebd"
+ +"\u0ec0\u0ec4\u0ec6\u0ec6\u0ec8\u0ecd\u0ed0\u0ed9\u0f18\u0f19\u0f20\u0f29\u0f35\u0f35"
+ +"\u0f37\u0f37\u0f39\u0f39\u0f3e\u0f47\u0f49\u0f69\u0f71\u0f84\u0f86\u0f8b\u0f90\u0f95"
+ +"\u0f97\u0f97\u0f99\u0fad\u0fb1\u0fb7\u0fb9\u0fb9\u10a0\u10c5\u10d0\u10f6\u1100\u1100"
+ +"\u1102\u1103\u1105\u1107\u1109\u1109\u110b\u110c\u110e\u1112\u113c\u113c\u113e\u113e"
+ +"\u1140\u1140\u114c\u114c\u114e\u114e\u1150\u1150\u1154\u1155\u1159\u1159\u115f\u1161"
+ +"\u1163\u1163\u1165\u1165\u1167\u1167\u1169\u1169\u116d\u116e\u1172\u1173\u1175\u1175"
+ +"\u119e\u119e\u11a8\u11a8\u11ab\u11ab\u11ae\u11af\u11b7\u11b8\u11ba\u11ba\u11bc\u11c2"
+ +"\u11eb\u11eb\u11f0\u11f0\u11f9\u11f9\u1e00\u1e9b\u1ea0\u1ef9\u1f00\u1f15\u1f18\u1f1d"
+ +"\u1f20\u1f45\u1f48\u1f4d\u1f50\u1f57\u1f59\u1f59\u1f5b\u1f5b\u1f5d\u1f5d\u1f5f\u1f7d"
+ +"\u1f80\u1fb4\u1fb6\u1fbc\u1fbe\u1fbe\u1fc2\u1fc4\u1fc6\u1fcc\u1fd0\u1fd3\u1fd6\u1fdb"
+ +"\u1fe0\u1fec\u1ff2\u1ff4\u1ff6\u1ffc\u20d0\u20dc\u20e1\u20e1\u2126\u2126\u212a\u212b"
+ +"\u212e\u212e\u2180\u2182\u3005\u3005\u3007\u3007\u3021\u302f\u3031\u3035\u3041\u3094"
+ +"\u3099\u309a\u309d\u309e\u30a1\u30fa\u30fc\u30fe\u3105\u312c\u4e00\u9fa5\uac00\ud7a3"
+ +"";
+
+ static final String LETTERS =
+ "\u0041\u005a\u0061\u007a\u00c0\u00d6\u00d8\u00f6\u00f8\u0131\u0134\u013e\u0141\u0148"
+ +"\u014a\u017e\u0180\u01c3\u01cd\u01f0\u01f4\u01f5\u01fa\u0217\u0250\u02a8\u02bb\u02c1"
+ +"\u0386\u0386\u0388\u038a\u038c\u038c\u038e\u03a1\u03a3\u03ce\u03d0\u03d6\u03da\u03da"
+ +"\u03dc\u03dc\u03de\u03de\u03e0\u03e0\u03e2\u03f3\u0401\u040c\u040e\u044f\u0451\u045c"
+ +"\u045e\u0481\u0490\u04c4\u04c7\u04c8\u04cb\u04cc\u04d0\u04eb\u04ee\u04f5\u04f8\u04f9"
+ +"\u0531\u0556\u0559\u0559\u0561\u0586\u05d0\u05ea\u05f0\u05f2\u0621\u063a\u0641\u064a"
+ +"\u0671\u06b7\u06ba\u06be\u06c0\u06ce\u06d0\u06d3\u06d5\u06d5\u06e5\u06e6\u0905\u0939"
+ +"\u093d\u093d\u0958\u0961\u0985\u098c\u098f\u0990\u0993\u09a8\u09aa\u09b0\u09b2\u09b2"
+ +"\u09b6\u09b9\u09dc\u09dd\u09df\u09e1\u09f0\u09f1\u0a05\u0a0a\u0a0f\u0a10\u0a13\u0a28"
+ +"\u0a2a\u0a30\u0a32\u0a33\u0a35\u0a36\u0a38\u0a39\u0a59\u0a5c\u0a5e\u0a5e\u0a72\u0a74"
+ +"\u0a85\u0a8b\u0a8d\u0a8d\u0a8f\u0a91\u0a93\u0aa8\u0aaa\u0ab0\u0ab2\u0ab3\u0ab5\u0ab9"
+ +"\u0abd\u0abd\u0ae0\u0ae0\u0b05\u0b0c\u0b0f\u0b10\u0b13\u0b28\u0b2a\u0b30\u0b32\u0b33"
+ +"\u0b36\u0b39\u0b3d\u0b3d\u0b5c\u0b5d\u0b5f\u0b61\u0b85\u0b8a\u0b8e\u0b90\u0b92\u0b95"
+ +"\u0b99\u0b9a\u0b9c\u0b9c\u0b9e\u0b9f\u0ba3\u0ba4\u0ba8\u0baa\u0bae\u0bb5\u0bb7\u0bb9"
+ +"\u0c05\u0c0c\u0c0e\u0c10\u0c12\u0c28\u0c2a\u0c33\u0c35\u0c39\u0c60\u0c61\u0c85\u0c8c"
+ +"\u0c8e\u0c90\u0c92\u0ca8\u0caa\u0cb3\u0cb5\u0cb9\u0cde\u0cde\u0ce0\u0ce1\u0d05\u0d0c"
+ +"\u0d0e\u0d10\u0d12\u0d28\u0d2a\u0d39\u0d60\u0d61\u0e01\u0e2e\u0e30\u0e30\u0e32\u0e33"
+ +"\u0e40\u0e45\u0e81\u0e82\u0e84\u0e84\u0e87\u0e88\u0e8a\u0e8a\u0e8d\u0e8d\u0e94\u0e97"
+ +"\u0e99\u0e9f\u0ea1\u0ea3\u0ea5\u0ea5\u0ea7\u0ea7\u0eaa\u0eab\u0ead\u0eae\u0eb0\u0eb0"
+ +"\u0eb2\u0eb3\u0ebd\u0ebd\u0ec0\u0ec4\u0f40\u0f47\u0f49\u0f69\u10a0\u10c5\u10d0\u10f6"
+ +"\u1100\u1100\u1102\u1103\u1105\u1107\u1109\u1109\u110b\u110c\u110e\u1112\u113c\u113c"
+ +"\u113e\u113e\u1140\u1140\u114c\u114c\u114e\u114e\u1150\u1150\u1154\u1155\u1159\u1159"
+ +"\u115f\u1161\u1163\u1163\u1165\u1165\u1167\u1167\u1169\u1169\u116d\u116e\u1172\u1173"
+ +"\u1175\u1175\u119e\u119e\u11a8\u11a8\u11ab\u11ab\u11ae\u11af\u11b7\u11b8\u11ba\u11ba"
+ +"\u11bc\u11c2\u11eb\u11eb\u11f0\u11f0\u11f9\u11f9\u1e00\u1e9b\u1ea0\u1ef9\u1f00\u1f15"
+ +"\u1f18\u1f1d\u1f20\u1f45\u1f48\u1f4d\u1f50\u1f57\u1f59\u1f59\u1f5b\u1f5b\u1f5d\u1f5d"
+ +"\u1f5f\u1f7d\u1f80\u1fb4\u1fb6\u1fbc\u1fbe\u1fbe\u1fc2\u1fc4\u1fc6\u1fcc\u1fd0\u1fd3"
+ +"\u1fd6\u1fdb\u1fe0\u1fec\u1ff2\u1ff4\u1ff6\u1ffc\u2126\u2126\u212a\u212b\u212e\u212e"
+ +"\u2180\u2182\u3007\u3007\u3021\u3029\u3041\u3094\u30a1\u30fa\u3105\u312c\u4e00\u9fa5"
+ +"\uac00\ud7a3";
+
+ static final int[] DIGITS_INTS = {
+ 0x0030, 0x0039, 0x0660, 0x0669, 0x06F0, 0x06F9, 0x0966, 0x096F,
+ 0x09E6, 0x09EF, 0x0A66, 0x0A6F, 0x0AE6, 0x0AEF, 0x0B66, 0x0B6F,
+ 0x0BE7, 0x0BEF, 0x0C66, 0x0C6F, 0x0CE6, 0x0CEF, 0x0D66, 0x0D6F,
+ 0x0E50, 0x0E59, 0x0ED0, 0x0ED9, 0x0F20, 0x0F29, 0x1040, 0x1049,
+ 0x1369, 0x1371, 0x17E0, 0x17E9, 0x1810, 0x1819, 0xFF10, 0xFF19,
+ 0x1D7CE, 0x1D7FF
+ };
+
+ static final int[] NAMESTARTCHARS11_INTS = {
+ 0x003A, 0x003A, 0x0041, 0x005A, 0x005F, 0x005F, 0x0061, 0x007A,
+ 0x00C0, 0x00D6, 0x00D8, 0x00F6, 0x00F8, 0x02FF, 0x0370, 0x037D,
+ 0x037F, 0x1FFF, 0x200C, 0x200D, 0x2070, 0x218F, 0x2C00, 0x2FEF,
+ 0x3001, 0xD7FF, 0xF900, 0xFDCF, 0xFDF0, 0xFFFD, 0x10000, 0xEFFFF
+ };
+
+ static final int[] NAMECHARS11_INTS = {
+ 0x002D, 0x002D, 0x002E, 0x002E, 0x0030, 0x0039, 0x003A, 0x003A,
+ 0x0041, 0x005A, 0x005F, 0x005F, 0x0061, 0x007A, 0x00B7, 0x00B7,
+ 0x00C0, 0x00D6, 0x00D8, 0x00F6, 0x00F8, 0x037D, 0x037F, 0x1FFF,
+ 0x200C, 0x200D, 0x203F, 0x2040, 0x2070, 0x218F, 0x2C00, 0x2FEF,
+ 0x3001, 0xD7FF, 0xF900, 0xFDCF, 0xFDF0, 0xFFFD, 0x10000, 0xEFFFF
+ };
+}
Propchange: xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xpath/regex/REConstants.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xpath/regex/REConstants.java
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Modified: xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xpath/regex/REUtil.java
URL: http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xpath/regex/REUtil.java?rev=1171147&r1=1171146&r2=1171147&view=diff
==============================================================================
--- xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xpath/regex/REUtil.java (original)
+++ xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xpath/regex/REUtil.java Thu Sep 15 15:44:30 2011
@@ -360,4 +360,16 @@ public final class REUtil {
}
System.out.println();
}
+
+ static void setupRange(Token range, String src) {
+ int len = src.length();
+ for (int i = 0; i < len; i += 2)
+ range.addRange(src.charAt(i), src.charAt(i+1));
+ }
+
+ static void setupRange(Token range, int[] src) {
+ int len = src.length;
+ for (int i = 0; i < len; i += 2)
+ range.addRange(src[i], src[i+1]);
+ }
}
Added: xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xpath/regex/RangeTokenMap.java
URL: http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xpath/regex/RangeTokenMap.java?rev=1171147&view=auto
==============================================================================
--- xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xpath/regex/RangeTokenMap.java (added)
+++ xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xpath/regex/RangeTokenMap.java Thu Sep 15 15:44:30 2011
@@ -0,0 +1,27 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.xerces.impl.xpath.regex;
+
+/**
+ * @version $Id$
+ */
+interface RangeTokenMap {
+
+ public RangeToken get(String name, boolean positive);
+
+}
Propchange: xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xpath/regex/RangeTokenMap.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xpath/regex/RangeTokenMap.java
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Added: xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xpath/regex/RangeTokenMapFactory.java
URL: http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xpath/regex/RangeTokenMapFactory.java?rev=1171147&view=auto
==============================================================================
--- xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xpath/regex/RangeTokenMapFactory.java (added)
+++ xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xpath/regex/RangeTokenMapFactory.java Thu Sep 15 15:44:30 2011
@@ -0,0 +1,44 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.xerces.impl.xpath.regex;
+
+import org.apache.xerces.impl.Constants;
+
+/**
+ * @version $Id$
+ */
+public final class RangeTokenMapFactory {
+
+ private static RangeTokenMap xmlMap = null;
+ private static RangeTokenMap xml11Map = null;
+
+ static synchronized RangeTokenMap getXMLTokenMap(short xmlVersion) {
+ if (xmlVersion == Constants.XML_VERSION_1_0) {
+ if (xmlMap == null) {
+ xmlMap = XMLTokenMap.instance();
+ }
+
+ return xmlMap;
+ }
+
+ if (xml11Map == null) {
+ xml11Map = XML11TokenMap.instance();
+ }
+ return xml11Map;
+ }
+}
Propchange: xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xpath/regex/RangeTokenMapFactory.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xpath/regex/RangeTokenMapFactory.java
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Modified: xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xpath/regex/RegularExpression.java
URL: http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xpath/regex/RegularExpression.java?rev=1171147&r1=1171146&r2=1171147&view=diff
==============================================================================
--- xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xpath/regex/RegularExpression.java (original)
+++ xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xpath/regex/RegularExpression.java Thu Sep 15 15:44:30 2011
@@ -21,6 +21,7 @@ import java.text.CharacterIterator;
import java.util.Locale;
import java.util.Stack;
+import org.apache.xerces.impl.Constants;
import org.apache.xerces.util.IntStack;
/**
@@ -2263,6 +2264,10 @@ public class RegularExpression implement
this.setPattern(regex, options, locale);
}
+ public RegularExpression(String regex, String options, Locale locale, short datatypeXMLVersion) {
+ this.setPattern(regex, options, locale, datatypeXMLVersion);
+ }
+
RegularExpression(String regex, Token tok, int parens, boolean hasBackReferences, int options) {
this.regex = regex;
this.tokentree = tok;
@@ -2279,14 +2284,14 @@ public class RegularExpression implement
}
public void setPattern(String newPattern, Locale locale) throws ParseException {
- this.setPattern(newPattern, this.options, locale);
+ this.setPattern(newPattern, this.options, locale, Constants.XML_VERSION_1_0);
}
- private void setPattern(String newPattern, int options, Locale locale) throws ParseException {
+ private void setPattern(String newPattern, int options, Locale locale, short datatypeXMLVersion) throws ParseException {
this.regex = newPattern;
this.options = options;
RegexParser rp = RegularExpression.isSet(this.options, RegularExpression.XMLSCHEMA_MODE)
- ? new ParserForXMLSchema(locale) : new RegexParser(locale);
+ ? new ParserForXMLSchema(locale, datatypeXMLVersion) : new RegexParser(locale);
this.tokentree = rp.parse(this.regex, this.options);
this.nofparen = rp.parennumber;
this.hasBackReferences = rp.hasBackReferences;
@@ -2302,7 +2307,11 @@ public class RegularExpression implement
}
public void setPattern(String newPattern, String options, Locale locale) throws ParseException {
- this.setPattern(newPattern, REUtil.parseOptions(options), locale);
+ this.setPattern(newPattern, REUtil.parseOptions(options), locale, Constants.XML_VERSION_1_0);
+ }
+
+ public void setPattern(String newPattern, String options, Locale locale, short datatypeXMLVersion) throws ParseException {
+ this.setPattern(newPattern, REUtil.parseOptions(options), locale, datatypeXMLVersion);
}
/**
Added: xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xpath/regex/XML11TokenMap.java
URL: http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xpath/regex/XML11TokenMap.java?rev=1171147&view=auto
==============================================================================
--- xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xpath/regex/XML11TokenMap.java (added)
+++ xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xpath/regex/XML11TokenMap.java Thu Sep 15 15:44:30 2011
@@ -0,0 +1,75 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.xerces.impl.xpath.regex;
+
+import java.util.HashMap;
+
+/**
+ * @version $Id$
+ */
+final class XML11TokenMap implements RangeTokenMap {
+
+ private HashMap ranges;
+ private HashMap ranges2;
+
+ private XML11TokenMap() {
+ createRanges();
+ }
+
+ static RangeTokenMap instance() {
+ return new XML11TokenMap();
+ }
+
+ private void createRanges() {
+ ranges = new HashMap();
+ ranges2 = new HashMap();
+
+ Token tok = Token.createRange();
+ REUtil.setupRange(tok, REConstants.SPACES);
+ ranges.put("xml:isSpace", tok);
+ ranges2.put("xml:isSpace", Token.complementRanges(tok));
+
+ tok = Token.createRange();
+ REUtil.setupRange(tok, REConstants.DIGITS_INTS);
+ ranges.put("xml:isDigit", tok);
+ ranges2.put("xml:isDigit", Token.complementRanges(tok));
+
+ tok = Token.createRange();
+ REUtil.setupRange(tok, REConstants.LETTERS);
+ tok.mergeRanges((Token)ranges.get("xml:isDigit"));
+ ranges.put("xml:isWord", tok);
+ ranges2.put("xml:isWord", Token.complementRanges(tok));
+
+ tok = Token.createRange();
+ REUtil.setupRange(tok, REConstants.NAMECHARS11_INTS);
+ ranges.put("xml:isNameChar", tok);
+ ranges2.put("xml:isNameChar", Token.complementRanges(tok));
+
+ tok = Token.createRange();
+ REUtil.setupRange(tok, REConstants.NAMESTARTCHARS11_INTS);
+ ranges.put("xml:isInitialNameChar", tok);
+ ranges2.put("xml:isInitialNameChar", Token.complementRanges(tok));
+ }
+
+ public RangeToken get(String name, boolean positive) {
+ return (positive ? (RangeToken)ranges.get(name)
+ : (RangeToken)ranges2.get(name));
+ }
+
+
+}
Propchange: xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xpath/regex/XML11TokenMap.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xpath/regex/XML11TokenMap.java
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Added: xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xpath/regex/XMLTokenMap.java
URL: http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xpath/regex/XMLTokenMap.java?rev=1171147&view=auto
==============================================================================
--- xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xpath/regex/XMLTokenMap.java (added)
+++ xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xpath/regex/XMLTokenMap.java Thu Sep 15 15:44:30 2011
@@ -0,0 +1,77 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.xerces.impl.xpath.regex;
+
+import java.util.HashMap;
+
+/**
+ * @version $Id$
+ */
+final class XMLTokenMap implements RangeTokenMap {
+
+ private HashMap ranges;
+ private HashMap ranges2;
+
+ private XMLTokenMap() {
+ createRanges();
+ }
+
+ static RangeTokenMap instance() {
+ return new XMLTokenMap();
+ }
+
+ private void createRanges() {
+ ranges = new HashMap();
+ ranges2 = new HashMap();
+
+ Token tok = Token.createRange();
+ REUtil.setupRange(tok, REConstants.SPACES);
+ ranges.put("xml:isSpace", tok);
+ ranges2.put("xml:isSpace", Token.complementRanges(tok));
+
+ tok = Token.createRange();
+ REUtil.setupRange(tok, REConstants.DIGITS_INTS);
+ ranges.put("xml:isDigit", tok);
+ ranges2.put("xml:isDigit", Token.complementRanges(tok));
+
+ tok = Token.createRange();
+ REUtil.setupRange(tok, REConstants.LETTERS);
+ tok.mergeRanges((Token)ranges.get("xml:isDigit"));
+ ranges.put("xml:isWord", tok);
+ ranges2.put("xml:isWord", Token.complementRanges(tok));
+
+ tok = Token.createRange();
+ REUtil.setupRange(tok, REConstants.NAMECHARS);
+ ranges.put("xml:isNameChar", tok);
+ ranges2.put("xml:isNameChar", Token.complementRanges(tok));
+
+ tok = Token.createRange();
+ REUtil.setupRange(tok, REConstants.LETTERS);
+ tok.addRange('_', '_');
+ tok.addRange(':', ':');
+ ranges.put("xml:isInitialNameChar", tok);
+ ranges2.put("xml:isInitialNameChar", Token.complementRanges(tok));
+ }
+
+ public RangeToken get(String name, boolean positive) {
+ return (positive ? (RangeToken)ranges.get(name)
+ : (RangeToken)ranges2.get(name));
+ }
+
+
+}
Propchange: xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xpath/regex/XMLTokenMap.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xpath/regex/XMLTokenMap.java
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Modified: xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/XMLSchemaLoader.java
URL: http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/XMLSchemaLoader.java?rev=1171147&r1=1171146&r2=1171147&view=diff
==============================================================================
--- xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/XMLSchemaLoader.java (original)
+++ xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/XMLSchemaLoader.java Thu Sep 15 15:44:30 2011
@@ -217,6 +217,9 @@ XSLoader, DOMConfiguration {
protected static final String XML_SCHEMA_VERSION =
Constants.XERCES_PROPERTY_PREFIX + Constants.XML_SCHEMA_VERSION_PROPERTY;
+ protected static final String DATATYPE_XML_VERSION =
+ Constants.XERCES_PROPERTY_PREFIX + Constants.DATATYPE_XML_VERSION_PROPERTY;
+
// recognized properties
private static final String [] RECOGNIZED_PROPERTIES = {
ENTITY_MANAGER,
@@ -231,7 +234,8 @@ XSLoader, DOMConfiguration {
SECURITY_MANAGER,
LOCALE,
SCHEMA_DV_FACTORY,
- XML_SCHEMA_VERSION
+ XML_SCHEMA_VERSION,
+ DATATYPE_XML_VERSION
};
private static final String EXTENDED_SCHEMA_FACTORY_CLASS = "org.apache.xerces.impl.dv.xs.ExtendedSchemaDVFactoryImpl";
@@ -520,7 +524,7 @@ XSLoader, DOMConfiguration {
/**
* Sets the XML Schema Version
*/
- void setSchemaVersion(String version) {
+ private void setSchemaVersion(String version) {
if (version.equals(Constants.W3C_XML_SCHEMA10_NS_URI)) {
fSchemaVersion = Constants.SCHEMA_VERSION_1_0;
fXSConstraints = XSConstraints.XS_1_0_CONSTRAINTS;
Modified: xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/XMLSchemaValidator.java
URL: http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/XMLSchemaValidator.java?rev=1171147&r1=1171146&r2=1171147&view=diff
==============================================================================
--- xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/XMLSchemaValidator.java (original)
+++ xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/XMLSchemaValidator.java Thu Sep 15 15:44:30 2011
@@ -272,6 +272,10 @@ public class XMLSchemaValidator
protected static final String XML_SCHEMA_VERSION =
Constants.XERCES_PROPERTY_PREFIX + Constants.XML_SCHEMA_VERSION_PROPERTY;
+ /** Property identifier: datatype xml version. */
+ protected static final String DATATYPE_XML_VERSION =
+ Constants.XERCES_PROPERTY_PREFIX + Constants.DATATYPE_XML_VERSION_PROPERTY;
+
// recognized features and properties
/** Recognized features. */
@@ -344,11 +348,12 @@ public class XMLSchemaValidator
ROOT_ELEMENT_DECL,
SCHEMA_DV_FACTORY,
XML_SCHEMA_VERSION,
+ DATATYPE_XML_VERSION
};
/** Property defaults. */
private static final Object[] PROPERTY_DEFAULTS =
- { null, null, null, null, null, null, null, null, null, null, null, null};
+ { null, null, null, null, null, null, null, null, null, null, null, null, null};
// this is the number of valuestores of each kind
// we expect an element to have. It's almost
@@ -415,6 +420,8 @@ public class XMLSchemaValidator
private ArrayList fXSITypeErrors = new ArrayList(4);
private IDContext fIDContext = null;
+
+ private String fDatatypeXMLVersion = null;
/**
* A wrapper of the standard error reporter. We'll store all schema errors
@@ -648,8 +655,7 @@ public class XMLSchemaValidator
}
}
else if (propertyId.equals(XML_SCHEMA_VERSION)) {
- // TODO: do we use fSchemaLoader.setProperty
- fSchemaLoader.setSchemaVersion((String)value);
+ fSchemaLoader.setProperty(XML_SCHEMA_VERSION, value);
fSchemaVersion = fSchemaLoader.getSchemaVersion();
fXSConstraints = fSchemaLoader.getXSConstraints();
if (fSchemaVersion == Constants.SCHEMA_VERSION_1_1) {
@@ -660,6 +666,7 @@ public class XMLSchemaValidator
}
else {
fValidationState.setIDContext(null);
+ fValidationState.setDatatypeXMLVersion(Constants.XML_VERSION_1_0);
}
}
} // setProperty(String,Object)
@@ -791,6 +798,12 @@ public class XMLSchemaValidator
fDocumentHandler.xmlDecl(version, encoding, standalone, augs);
}
+ if (fSchemaVersion == Constants.SCHEMA_VERSION_1_1) {
+ if (fDatatypeXMLVersion == null) {
+ fValidationState.setDatatypeXMLVersion("1.0".equals(version)
+ ? Constants.XML_VERSION_1_0 : Constants.XML_VERSION_1_1);
+ }
+ }
} // xmlDecl(String,String,String)
/**
@@ -1416,7 +1429,6 @@ public class XMLSchemaValidator
*/
public void reset(XMLComponentManager componentManager) throws XMLConfigurationException {
-
fIdConstraint = false;
//reset XSDDescription
fLocationPairs.clear();
@@ -1650,6 +1662,26 @@ public class XMLSchemaValidator
fExternalNoNamespaceSchema = null;
}
+ // get datatype xml version
+ if (fSchemaVersion == Constants.SCHEMA_VERSION_1_1) {
+ try {
+ final Object xmlVer = componentManager.getProperty(DATATYPE_XML_VERSION);
+ if (xmlVer instanceof String) {
+ fDatatypeXMLVersion = (String) xmlVer;
+ if ("1.1".equals(xmlVer)) {
+ fValidationState.setDatatypeXMLVersion(Constants.XML_VERSION_1_1);
+ }
+ else {
+ fValidationState.setDatatypeXMLVersion(Constants.XML_VERSION_1_0);
+ }
+ }
+ }
+ catch (XMLConfigurationException e) {
+ fDatatypeXMLVersion = null;
+ fValidationState.setDatatypeXMLVersion(Constants.XML_VERSION_1_0);
+ }
+ }
+
// store the external schema locations. they are set when reset is called,
// so any other schemaLocation declaration for the same namespace will be
// effectively ignored. becuase we choose to take first location hint
Modified: xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/opti/SchemaParsingConfig.java
URL: http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/opti/SchemaParsingConfig.java?rev=1171147&r1=1171146&r2=1171147&view=diff
==============================================================================
--- xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/opti/SchemaParsingConfig.java (original)
+++ xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/opti/SchemaParsingConfig.java Thu Sep 15 15:44:30 2011
@@ -154,6 +154,9 @@ public class SchemaParsingConfig extends
protected static final String LOCALE =
Constants.XERCES_PROPERTY_PREFIX + Constants.LOCALE_PROPERTY;
+ protected static final String DATATYPE_XML_VERSION =
+ Constants.XERCES_PROPERTY_PREFIX + Constants.DATATYPE_XML_VERSION_PROPERTY;
+
// debugging
@@ -323,7 +326,8 @@ public class SchemaParsingConfig extends
DATATYPE_VALIDATOR_FACTORY,
VALIDATION_MANAGER,
GENERATE_SYNTHETIC_ANNOTATIONS,
- LOCALE
+ LOCALE,
+ DATATYPE_XML_VERSION
};
addRecognizedProperties(recognizedProperties);
@@ -724,7 +728,10 @@ public class SchemaParsingConfig extends
/** Configures the XML 1.0 pipeline. */
protected void configurePipeline() {
-
+
+ // set datatype XML version to 1.0
+ setProperty(DATATYPE_XML_VERSION, "1.0");
+
if (fCurrentDVFactory != fDatatypeValidatorFactory) {
fCurrentDVFactory = fDatatypeValidatorFactory;
// use XML 1.0 datatype library
@@ -760,7 +767,10 @@ public class SchemaParsingConfig extends
/** Configures the XML 1.1 pipeline. */
protected void configureXML11Pipeline() {
-
+
+ // set datatype XML version to 1.1
+ setProperty(DATATYPE_XML_VERSION, "1.1");
+
if (fCurrentDVFactory != fXML11DatatypeFactory) {
fCurrentDVFactory = fXML11DatatypeFactory;
// use XML 1.1 datatype library
@@ -790,8 +800,7 @@ public class SchemaParsingConfig extends
fXML11DTDScanner.setDTDContentModelHandler(fDTDContentModelHandler);
if (fDTDContentModelHandler != null) {
fDTDContentModelHandler.setDTDContentModelSource(fXML11DTDScanner);
- }
-
+ }
} // configureXML11Pipeline()
// features and properties
Modified: xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/traversers/XSDAttributeTraverser.java
URL: http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/traversers/XSDAttributeTraverser.java?rev=1171147&r1=1171146&r2=1171147&view=diff
==============================================================================
--- xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/traversers/XSDAttributeTraverser.java (original)
+++ xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/traversers/XSDAttributeTraverser.java Thu Sep 15 15:44:30 2011
@@ -182,6 +182,7 @@ class XSDAttributeTraverser extends XSDA
if (defaultAtt != null && attrUse != null) {
// 2 if there is a {value constraint}, the canonical lexical representation of its value must be valid with respect to the {type definition} as defined in String Valid (3.14.4).
fValidationState.setNamespaceSupport(schemaDoc.fNamespaceSupport);
+ fValidationState.setDatatypeXMLVersion(schemaDoc.fDatatypeXMLVersion);
try {
checkDefaultValid(attrUse);
}
@@ -452,6 +453,7 @@ class XSDAttributeTraverser extends XSDA
// 2 if there is a {value constraint}, the canonical lexical representation of its value must be valid with respect to the {type definition} as defined in String Valid (3.14.4).
if (attDefault != null) {
fValidationState.setNamespaceSupport(schemaDoc.fNamespaceSupport);
+ fValidationState.setDatatypeXMLVersion(schemaDoc.fDatatypeXMLVersion);
try {
checkDefaultValid(attribute);
}
Modified: xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/traversers/XSDComplexTypeTraverser.java
URL: http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/traversers/XSDComplexTypeTraverser.java?rev=1171147&r1=1171146&r2=1171147&view=diff
==============================================================================
--- xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/traversers/XSDComplexTypeTraverser.java (original)
+++ xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/traversers/XSDComplexTypeTraverser.java Thu Sep 15 15:44:30 2011
@@ -764,6 +764,7 @@ class XSDComplexTypeTraverser extends X
fXSSimpleType = fSchemaHandler.fDVFactory.createTypeRestriction(name,schemaDoc.fTargetNamespace,(short)0,baseValidator,null);
try{
fValidationState.setNamespaceSupport(schemaDoc.fNamespaceSupport);
+ fValidationState.setDatatypeXMLVersion(schemaDoc.fDatatypeXMLVersion);
fXSSimpleType.applyFacets(facetData, presentFacets, fixedFacets, fValidationState);
}catch(InvalidDatatypeFacetException ex){
reportSchemaError(ex.getKey(), ex.getArgs(), simpleContent);
Modified: xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/traversers/XSDElementTraverser.java
URL: http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/traversers/XSDElementTraverser.java?rev=1171147&r1=1171146&r2=1171147&view=diff
==============================================================================
--- xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/traversers/XSDElementTraverser.java (original)
+++ xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/traversers/XSDElementTraverser.java Thu Sep 15 15:44:30 2011
@@ -551,6 +551,7 @@ class XSDElementTraverser extends XSDAbs
// 2 If there is a {value constraint}, the canonical lexical representation of its value must be valid with respect to the {type definition} as defined in Element Default Valid (Immediate) (3.3.6).
if (element.fDefault != null) {
fValidationState.setNamespaceSupport(schemaDoc.fNamespaceSupport);
+ fValidationState.setDatatypeXMLVersion(schemaDoc.fDatatypeXMLVersion);
if (fSchemaHandler.fXSConstraints.ElementDefaultValidImmediate(element.fType, element.fDefault.normalizedValue, fValidationState, element.fDefault) == null) {
reportSchemaError ("e-props-correct.2", new Object[]{nameAtt, element.fDefault.normalizedValue}, elmDecl);
element.fDefault = null;
Modified: xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/traversers/XSDHandler.java
URL: http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/traversers/XSDHandler.java?rev=1171147&r1=1171146&r2=1171147&view=diff
==============================================================================
--- xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/traversers/XSDHandler.java (original)
+++ xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/traversers/XSDHandler.java Thu Sep 15 15:44:30 2011
@@ -224,6 +224,10 @@ public class XSDHandler {
/** Property identifier: locale. */
protected static final String LOCALE =
Constants.XERCES_PROPERTY_PREFIX + Constants.LOCALE_PROPERTY;
+
+ /** Property identifier: datatype xml version. */
+ protected static final String DATATYPE_XML_VERSION =
+ Constants.XERCES_PROPERTY_PREFIX + Constants.DATATYPE_XML_VERSION_PROPERTY;
protected static final boolean DEBUG_NODE_POOL = false;
@@ -369,6 +373,9 @@ public class XSDHandler {
// this is useful to resolve a uri relative to the referring document
private Hashtable fDoc2SystemId = new Hashtable();
+ //
+ private Hashtable fDoc2DatatypeXMLVersion = null;
+
// the primary XSDocumentInfo we were called to parse
private XSDocumentInfo fRoot = null;
@@ -461,6 +468,9 @@ public class XSDHandler {
// TypeValidatorHelper
TypeValidatorHelper fTypeValidatorHelper;
+ // Datatype XML version
+ String fDatatypeXMLVersion;
+
// these data members are needed for the deferred traversal
// of local elements.
@@ -856,11 +866,19 @@ public class XSDHandler {
if (schemaRoot == null) return null;
String callerTNS = desc.getTargetNamespace();
short referType = desc.getContextType();
-
+
XSDocumentInfo currSchemaInfo = null;
try {
// note that attributes are freed at end of traverseSchemas()
- currSchemaInfo = new XSDocumentInfo(schemaRoot, fAttributeChecker, fSymbolTable, fTypeValidatorHelper);
+ short datatypeXMLVersion = Constants.XML_VERSION_1_0;
+ if (fSchemaVersion == Constants.SCHEMA_VERSION_1_1) {
+ final Object xmlVer = (fDatatypeXMLVersion == null)
+ ? fDoc2DatatypeXMLVersion.get(schemaRoot) : fDatatypeXMLVersion;
+ datatypeXMLVersion = "1.1".equals(xmlVer)
+ ? Constants.XML_VERSION_1_1 : Constants.XML_VERSION_1_0;
+ }
+ currSchemaInfo = new XSDocumentInfo(schemaRoot, fAttributeChecker,
+ fSymbolTable, fTypeValidatorHelper, datatypeXMLVersion);
} catch (XMLSchemaException se) {
reportSchemaError(ELE_ERROR_CODES[referType],
new Object[]{locationHint},
@@ -2405,7 +2423,9 @@ public class XSDHandler {
fSchemaParser.parse(schemaSource);
Document schemaDocument = fSchemaParser.getDocument();
schemaElement = schemaDocument != null ? DOMUtil.getRoot(schemaDocument) : null;
- return getSchemaDocument0(key, schemaId, schemaElement);
+ return getSchemaDocument0(key, schemaId, schemaElement,
+ fSchemaVersion == Constants.SCHEMA_VERSION_1_1
+ ? fSchemaParser.getProperty(DATATYPE_XML_VERSION) : null);
}
else {
hasInput = false;
@@ -2512,7 +2532,9 @@ public class XSDHandler {
Document schemaDocument = fXSContentHandler.getDocument();
schemaElement = schemaDocument != null ? DOMUtil.getRoot(schemaDocument) : null;
- return getSchemaDocument0(key, schemaId, schemaElement);
+ return getSchemaDocument0(key, schemaId, schemaElement,
+ fSchemaVersion == Constants.SCHEMA_VERSION_1_1
+ ? fSchemaParser.getProperty(DATATYPE_XML_VERSION) : null);
}
else {
hasInput = false;
@@ -2583,7 +2605,7 @@ public class XSDHandler {
}
schemaElement = schemaRootElement;
- return getSchemaDocument0(key, schemaId, schemaElement);
+ return getSchemaDocument0(key, schemaId, schemaElement, null);
}
else {
hasInput = false;
@@ -2660,7 +2682,9 @@ public class XSDHandler {
}
Document schemaDocument = fStAXSchemaParser.getDocument();
schemaElement = schemaDocument != null ? DOMUtil.getRoot(schemaDocument) : null;
- return getSchemaDocument0(key, schemaId, schemaElement);
+ return getSchemaDocument0(key, schemaId, schemaElement,
+ fSchemaVersion == Constants.SCHEMA_VERSION_1_1
+ ? fSchemaParser.getProperty(DATATYPE_XML_VERSION) : null);
}
catch (XMLStreamException e) {
Throwable t = e.getNestedException();
@@ -2683,7 +2707,7 @@ public class XSDHandler {
* Code shared between the various getSchemaDocument() methods which
* stores mapping information for the document.
*/
- private Element getSchemaDocument0(XSDKey key, String schemaId, Element schemaElement) {
+ private Element getSchemaDocument0(XSDKey key, String schemaId, Element schemaElement, Object datatypeXMLVersion) {
// now we need to store the mapping information from system id
// to the document. also from the document to the system id.
if (schemaElement != null) {
@@ -2693,6 +2717,9 @@ public class XSDHandler {
if (schemaId != null) {
fDoc2SystemId.put(schemaElement, schemaId);
}
+ if (datatypeXMLVersion != null) {
+ fDoc2DatatypeXMLVersion.put(schemaElement, datatypeXMLVersion);
+ }
fLastSchemaWasDuplicate = false;
}
else {
@@ -3660,6 +3687,9 @@ public class XSDHandler {
void prepareForParse() {
fTraversed.clear();
fDoc2SystemId.clear();
+ if (fDoc2DatatypeXMLVersion != null) {
+ fDoc2DatatypeXMLVersion.clear();
+ }
fHiddenNodes.clear();
fLastSchemaWasDuplicate = false;
}
@@ -3875,7 +3905,22 @@ public class XSDHandler {
}
} catch (XMLConfigurationException e) {
}
-
+
+ if (fSchemaVersion == Constants.SCHEMA_VERSION_1_1) {
+ try {
+ final Object xmlVer = componentManager.getProperty(DATATYPE_XML_VERSION);
+ if (xmlVer instanceof String) {
+ fDatatypeXMLVersion = (String) xmlVer;
+ }
+ else {
+ fDatatypeXMLVersion = null;
+ }
+ }
+ catch (XMLConfigurationException e) {
+ fDatatypeXMLVersion = null;
+ }
+ }
+
fTypeValidatorHelper = TypeValidatorHelper.getInstance(fSchemaVersion);
} // reset(XMLComponentManager)
@@ -4615,10 +4660,13 @@ public class XSDHandler {
if (fOverrideHandler == null) {
fOverrideHandler = new OverrideTransformationManager(this, new DOMOverrideImpl(this));
}
+ if (fDoc2DatatypeXMLVersion == null) {
+ fDoc2DatatypeXMLVersion = new Hashtable();
+ }
}
fSchemaParser.setSupportedVersion(fSupportedVersion);
}
-
+
public String getDocumentURI() {
return fSchemaParser.getDocument().getDocumentURI();
}
Modified: xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/traversers/XSDSimpleTypeTraverser.java
URL: http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/traversers/XSDSimpleTypeTraverser.java?rev=1171147&r1=1171146&r2=1171147&view=diff
==============================================================================
--- xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/traversers/XSDSimpleTypeTraverser.java (original)
+++ xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/traversers/XSDSimpleTypeTraverser.java Thu Sep 15 15:44:30 2011
@@ -437,6 +437,7 @@ class XSDSimpleTypeTraverser extends XSD
try {
fValidationState.setNamespaceSupport(schemaDoc.fNamespaceSupport);
+ fValidationState.setDatatypeXMLVersion(schemaDoc.fDatatypeXMLVersion);
newDecl.applyFacets(fi.facetdata, fi.fPresentFacets, fi.fFixedFacets, fValidationState);
} catch (InvalidDatatypeFacetException ex) {
reportSchemaError(ex.getKey(), ex.getArgs(), child);
Modified: xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/traversers/XSDocumentInfo.java
URL: http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/traversers/XSDocumentInfo.java?rev=1171147&r1=1171146&r2=1171147&view=diff
==============================================================================
--- xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/traversers/XSDocumentInfo.java (original)
+++ xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/traversers/XSDocumentInfo.java Thu Sep 15 15:44:30 2011
@@ -99,10 +99,15 @@ class XSDocumentInfo {
// defaultOpenContent
XSOpenContentDecl fDefaultOpenContent = null;
+
+ // dataype xml version
+ short fDatatypeXMLVersion;
// note that the caller must ensure to call returnSchemaAttrs()
// to avoid memory leaks!
- XSDocumentInfo (Element schemaRoot, XSAttributeChecker attrChecker, SymbolTable symbolTable, TypeValidatorHelper typeValidatorHelper)
+ XSDocumentInfo (Element schemaRoot, XSAttributeChecker attrChecker,
+ SymbolTable symbolTable, TypeValidatorHelper typeValidatorHelper,
+ short datatypeXMLVersion)
throws XMLSchemaException {
fSchemaElement = schemaRoot;
@@ -112,6 +117,7 @@ class XSDocumentInfo {
fSymbolTable = symbolTable;
fAttrChecker = attrChecker;
+ fDatatypeXMLVersion = datatypeXMLVersion;
if (schemaRoot != null) {
Element root = schemaRoot;
@@ -120,6 +126,7 @@ class XSDocumentInfo {
fValidationContext.setNamespaceSupport(fNamespaceSupport);
fValidationContext.setSymbolTable(symbolTable);
fValidationContext.setTypeValidatorHelper(typeValidatorHelper);
+ fValidationContext.setDatatypeXMLVersion(datatypeXMLVersion);
// get the target namespace
fTargetNamespace = attrChecker.checkTargetNamespace(root, this);
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@xerces.apache.org
For additional commands, e-mail: commits-help@xerces.apache.org