You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xerces.apache.org by mu...@apache.org on 2010/07/24 17:46:10 UTC
svn commit: r978885 - in
/xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces: impl/
impl/dv/ impl/xs/ impl/xs/opti/ util/
Author: mukulg
Date: Sat Jul 24 15:46:09 2010
New Revision: 978885
URL: http://svn.apache.org/viewvc?rev=978885&view=rev
Log:
committing implementation of vc:typeAvailable, vc:typeUnavailable, vc:facetAvailable & vc:facetUnavailable attributes (JIRA issue, XERCESJ-1460)
Added:
xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/opti/SchemaVersioningHelper.java
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/XSSimpleType.java
xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/SchemaSymbols.java
xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/opti/SchemaDOMParser.java
xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/util/NamespaceSupport.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=978885&r1=978884&r2=978885&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 Sat Jul 24 15:46:09 2010
@@ -485,6 +485,12 @@ public final class Constants {
public final static short SCHEMA_VERSION_1_0_EXTENDED = 2;
public final static short SCHEMA_VERSION_1_1 = 4;
+ // Constants to support XML Schema 1.1 conditional inclusion functionality
+ public final static short IS_TYPE = 0;
+ public final static short IS_FACET = 1;
+ public final static short TYPE_AND_FACET_AVAILABILITY = 2;
+ public final static short TYPE_AND_FACET_UNAVAILABILITY = 3;
+
// private
/** SAX features. */
Modified: xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/XSSimpleType.java
URL: http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/XSSimpleType.java?rev=978885&r1=978884&r2=978885&view=diff
==============================================================================
--- xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/XSSimpleType.java (original)
+++ xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/XSSimpleType.java Sat Jul 24 15:46:09 2010
@@ -60,7 +60,7 @@ public interface XSSimpleType extends XS
public static final short ET_PROHIBITED = 2;
/**
- * Constant defined for the primitive built-in simple tpyes.
+ * Constant defined for the primitive built-in simple types.
* see <a href='http://www.w3.org/TR/xmlschema-2/#built-in-primitive-datatypes'>
* XML Schema Part 2: Datatypes </a>
*/
@@ -76,7 +76,7 @@ public interface XSSimpleType extends XS
public static final short PRIMITIVE_DOUBLE = 5;
/** "duration" type */
public static final short PRIMITIVE_DURATION = 6;
- /** "dataTime" type */
+ /** "dateTime" type */
public static final short PRIMITIVE_DATETIME = 7;
/** "time" type */
public static final short PRIMITIVE_TIME = 8;
Modified: xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/SchemaSymbols.java
URL: http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/SchemaSymbols.java?rev=978885&r1=978884&r2=978885&view=diff
==============================================================================
--- xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/SchemaSymbols.java (original)
+++ xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/SchemaSymbols.java Sat Jul 24 15:46:09 2010
@@ -149,6 +149,10 @@ public final class SchemaSymbols {
public static final String ATT_XPATH_DEFAULT_NS = "xpathDefaultNamespace".intern();
public static final String ATT_MINVERSION = "minVersion".intern();
public static final String ATT_MAXVERSION = "maxVersion".intern();
+ public static final String ATT_TYPEAVAILABLE = "typeAvailable".intern();
+ public static final String ATT_TYPEUNAVAILABLE = "typeUnavailable".intern();
+ public static final String ATT_FACETAVAILABLE = "facetAvailable".intern();
+ public static final String ATT_FACETUNAVAILABLE = "facetUnavailable".intern();
public static final String ATT_INHERITABLE = "inheritable".intern();
public static final String ATT_ASSERT_MESSAGE = "message".intern();
Modified: xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/opti/SchemaDOMParser.java
URL: http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/opti/SchemaDOMParser.java?rev=978885&r1=978884&r2=978885&view=diff
==============================================================================
--- xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/opti/SchemaDOMParser.java (original)
+++ xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/opti/SchemaDOMParser.java Sat Jul 24 15:46:09 2010
@@ -17,13 +17,14 @@
package org.apache.xerces.impl.xs.opti;
+import java.util.Iterator;
+import java.util.List;
import java.io.IOException;
import java.math.BigDecimal;
+import java.util.ArrayList;
import org.apache.xerces.impl.Constants;
import org.apache.xerces.impl.XMLErrorReporter;
-import org.apache.xerces.impl.dv.xs.DecimalDV;
-import org.apache.xerces.impl.dv.xs.TypeValidator;
import org.apache.xerces.impl.xs.SchemaSymbols;
import org.apache.xerces.impl.xs.XSMessageFormatter;
import org.apache.xerces.util.XMLAttributesImpl;
@@ -106,10 +107,10 @@ public class SchemaDOMParser extends Def
private XMLAttributes fEmptyAttr = new XMLAttributesImpl();
// fields for conditional inclusion
- private final TypeValidator fDecimalDV = new DecimalDV();
private XSDecimal fSupportedVersion;
private int fIgnoreDepth = -1;
private boolean fPerformConditionalInclusion = true; //REVISIT: use feature
+ private SchemaVersioningHelper schemaVersioningHelper = new SchemaVersioningHelper();
//
// XMLDocumentHandler methods
@@ -249,9 +250,10 @@ public class SchemaDOMParser extends Def
return;
}
- // check for version mismatch if any (does not apply to <schema> element)
+ // perform conditional exclusion checks for schema versioning
+ // namespace (does not apply to <schema> element).
if (fDepth > 0) {
- checkSupportedVersion(element, attributes);
+ checkVersionControlAttributes(element, attributes);
if (fIgnoreDepth > -1) {
return;
}
@@ -321,7 +323,9 @@ public class SchemaDOMParser extends Def
}
if (fDepth > -1) {
- boolean ignoreElement = checkSupportedVersion(element, attributes);
+ // perform conditional exclusion checks for schema versioning
+ // namespace.
+ boolean ignoreElement = checkVersionControlAttributes(element, attributes);
if (fIgnoreDepth > -1) {
if (ignoreElement) {
fIgnoreDepth--;
@@ -597,21 +601,38 @@ public class SchemaDOMParser extends Def
fSupportedVersion = version;
}
- private boolean checkSupportedVersion(QName element, XMLAttributes attributes) {
-
- boolean ignoreElement = false;
+ /*
+ * Method to check if any attributes of schema versioning namespace should
+ * cause exclusion of a schema component along with it's descendant
+ * instructions.
+ *
+ * ref: http://www.w3.org/TR/xmlschema11-1/#cip
+ */
+ private boolean checkVersionControlAttributes(QName element, XMLAttributes attributes) {
+ boolean ignoreSchemaComponent = false;
+
+ // variables holding schema versioning attribute values
BigDecimal minVer = null;
BigDecimal maxVer = null;
+ List typeAvailableList = null;
+ List typeUnavailableList = null;
+ List facetAvailableList = null;
+ List facetUnavailableList = null;
+ // iterate all attributes of an element, and get values of schema versioning attributes
final int length = attributes.getLength();
- for (int i = 0; i < length; ++i) {
- String uri = attributes.getURI(i);
+
+ for (int attrIdx = 0; attrIdx < length; ++attrIdx) {
+ String uri = attributes.getURI(attrIdx);
+
if (uri != null && SchemaSymbols.URI_SCHEMAVERSION.equals(uri)) {
- String attrLocalName = attributes.getLocalName(i);
+ String attrLocalName = attributes.getLocalName(attrIdx);
+ String attrValue = attributes.getValue(attrIdx);
+
if (SchemaSymbols.ATT_MINVERSION.equals(attrLocalName)) {
try {
- minVer = new BigDecimal(attributes.getValue(i));
+ minVer = new BigDecimal(attrValue);
}
catch (NumberFormatException nfe) {
fErrorReporter.reportError(XSMessageFormatter.SCHEMA_DOMAIN,
@@ -622,7 +643,7 @@ public class SchemaDOMParser extends Def
}
else if (SchemaSymbols.ATT_MAXVERSION.equals(attrLocalName)) {
try {
- maxVer = new BigDecimal(attributes.getValue(i));
+ maxVer = new BigDecimal(attrValue);
}
catch (NumberFormatException nfe) {
fErrorReporter.reportError(XSMessageFormatter.SCHEMA_DOMAIN,
@@ -631,42 +652,208 @@ public class SchemaDOMParser extends Def
XMLErrorReporter.SEVERITY_ERROR);
}
}
- else { //REVISIT: report error
-
+ else if (SchemaSymbols.ATT_TYPEAVAILABLE.equals(attrLocalName)) {
+ typeAvailableList = tokenizeString(attrValue, "\\s");
+ }
+ else if (SchemaSymbols.ATT_TYPEUNAVAILABLE.equals(attrLocalName)) {
+ typeUnavailableList = tokenizeString(attrValue, "\\s");
+ }
+ else if (SchemaSymbols.ATT_FACETAVAILABLE.equals(attrLocalName)) {
+ facetAvailableList = tokenizeString(attrValue, "\\s");
+ }
+ else if (SchemaSymbols.ATT_FACETUNAVAILABLE.equals(attrLocalName)) {
+ facetUnavailableList = tokenizeString(attrValue, "\\s");
+ }
+ else {
+ // throw warning. This is optional as per the spec,
+ // but highly recommended. TO DO ...
}
}
+
+ } // end attributes iteration
+
+ // perform checks for attributes vc:minVersion, vc:maxVersion, vc:typeAvailable,
+ // vc:typeUnavailable, vc:facetAvailable & vc:facetUnavailable.
+ boolean minMaxSchemaVerAllowsIgnore = (minVer == null && maxVer == null) ?
+ false :
+ schemaVersionAllowsExclude(minVer, maxVer);
+ boolean typeAvlAllowsIgnore = (typeAvailableList == null) ? false :
+ typeAndFacetAvailableAllowsExclude(
+ typeAvailableList,
+ Constants.IS_TYPE,
+ Constants.TYPE_AND_FACET_AVAILABILITY);
+ boolean typeUnAvlAllowsIgnore = (typeUnavailableList == null) ? false :
+ typeAndFacetAvailableAllowsExclude(
+ typeUnavailableList,
+ Constants.IS_TYPE,
+ Constants.TYPE_AND_FACET_UNAVAILABILITY);
+ boolean facetAvlAllowsIgnore = (facetAvailableList == null) ? false :
+ typeAndFacetAvailableAllowsExclude(
+ facetAvailableList,
+ Constants.IS_FACET,
+ Constants.TYPE_AND_FACET_AVAILABILITY);
+ boolean facetUnavlAllowsIgnore = (facetUnavailableList == null) ? false :
+ typeAndFacetAvailableAllowsExclude(
+ facetUnavailableList,
+ Constants.IS_FACET,
+ Constants.TYPE_AND_FACET_UNAVAILABILITY);
+
+ if (minMaxSchemaVerAllowsIgnore || typeAvlAllowsIgnore || typeUnAvlAllowsIgnore |
+ facetAvlAllowsIgnore || facetUnavlAllowsIgnore) {
+ ignoreSchemaComponent = true;
}
+ else {
+ ignoreSchemaComponent = false;
+ }
+
+ return ignoreSchemaComponent;
+
+ } //checkSupportedVersion
+
+
+ /*
+ * Method to determine whether a schema component and it's descendant
+ * instructions should be excluded from schema processing, depending
+ * on the values of vc:minVersion & vc:maxVersion attributes from schema
+ * versioning namespace.
+ */
+ public boolean schemaVersionAllowsExclude(BigDecimal minVer,
+ BigDecimal maxVer) {
+
+ boolean minMaxSchemaVerAllowsIgnore = false;
+
+ // The condition vc:minVersion <= V < vc:maxVersion needs to be true
+ // for a schema component to be included in a validation episode.
+ // Here value of "V" is an instance variable fSupportedVersion.
- // as per XML Schema 1.1 spec, the condition vc:minVersion <= V < vc:maxVersion
- // needs to be true for a schema component to be included in a validation
- // episode (ref, http://www.w3.org/TR/xmlschema11-1/#cip). here value of "V" is
- // an instance variable fSupportedVersion.
if (minVer != null && maxVer != null) {
// if both vc:minVersion & vc:maxVersion attributes are present on a schema component
if (!(minVer.compareTo(fSupportedVersion.getBigDecimal()) <= 0 &&
maxVer.compareTo(fSupportedVersion.getBigDecimal()) == 1)) {
fIgnoreDepth++;
- ignoreElement = true;
+ minMaxSchemaVerAllowsIgnore = true;
}
}
else if (minVer != null && maxVer == null) {
// only vc:minVersion attribute is present
if (!(minVer.compareTo(fSupportedVersion.getBigDecimal()) <= 0)) {
fIgnoreDepth++;
- ignoreElement = true;
+ minMaxSchemaVerAllowsIgnore = true;
}
}
else if (minVer == null && maxVer != null) {
// only vc:maxVersion attribute is present
if (!(maxVer.compareTo(fSupportedVersion.getBigDecimal()) == 1)) {
fIgnoreDepth++;
- ignoreElement = true;
+ minMaxSchemaVerAllowsIgnore = true;
}
}
- return ignoreElement;
+ return minMaxSchemaVerAllowsIgnore;
+
+ } // schemaVersionAllowsExclude
+
+
+ /*
+ * Method to determine whether a schema component and it's descendant
+ * instructions should be excluded from schema processing, depending
+ * on values of vc:typeAvailable, vc:typeUnavailable, vc:facetAvailable
+ * and vc:facetUnavailable attributes from schema versioning namespace.
+ */
+ private boolean typeAndFacetAvailableAllowsExclude(
+ List typeOrFacetList,
+ short typeOrFacet,
+ short availaibilityUnavlCheck) {
+
+ // either of the following boolean values should be returned from this
+ // method, depending on whether availability or unavailability check is
+ // asked for.
+ boolean typeOrFacetAvlAllowsIgnore = false;
+ boolean typeOrFacetUnavlAllowsIgnore = true;
+
+ for (Iterator iter = typeOrFacetList.iterator(); iter.hasNext(); ) {
+ String typeOrFacetRawValue = (String) iter.next();
+ String typeOrFacetLocalName = null;
+ String typeOrFacetUri = null;
+ if (typeOrFacetRawValue.indexOf(':') != -1) {
+ typeOrFacetLocalName = typeOrFacetRawValue.substring(
+ typeOrFacetRawValue.indexOf(':') + 1);
+ String typeOrFacetPrefix = typeOrFacetRawValue.substring(0,
+ typeOrFacetRawValue.indexOf(':'));
+ typeOrFacetUri = fNamespaceContext.getURI(typeOrFacetPrefix);
+ }
+ else {
+ typeOrFacetLocalName = typeOrFacetRawValue;
+ }
+
+ if (typeOrFacet == Constants.IS_TYPE) {
+ // check for availability of schema types
+ if (availaibilityUnavlCheck == Constants.TYPE_AND_FACET_AVAILABILITY &&
+ !schemaVersioningHelper.isTypeSupported(typeOrFacetLocalName,
+ typeOrFacetUri)) {
+ fIgnoreDepth++;
+ typeOrFacetAvlAllowsIgnore = true;
+ break;
+ }
+ else if (availaibilityUnavlCheck == Constants.TYPE_AND_FACET_UNAVAILABILITY &&
+ !schemaVersioningHelper.isTypeSupported(typeOrFacetLocalName,
+ typeOrFacetUri)) {
+ typeOrFacetUnavlAllowsIgnore = false;
+ break;
+ }
+ }
+ else if (typeOrFacet == Constants.IS_FACET) {
+ // check for availability of schema facets
+ if (availaibilityUnavlCheck == Constants.TYPE_AND_FACET_AVAILABILITY &&
+ !schemaVersioningHelper.isFacetSupported(typeOrFacetLocalName,
+ typeOrFacetUri)) {
+ fIgnoreDepth++;
+ typeOrFacetAvlAllowsIgnore = true;
+ break;
+ }
+ else if (availaibilityUnavlCheck == Constants.TYPE_AND_FACET_UNAVAILABILITY &&
+ !schemaVersioningHelper.isFacetSupported(typeOrFacetLocalName,
+ typeOrFacetUri)) {
+ typeOrFacetUnavlAllowsIgnore = false;
+ break;
+ }
+ }
+ }
+
+ if (availaibilityUnavlCheck == Constants.TYPE_AND_FACET_AVAILABILITY) {
+ if (typeOrFacetAvlAllowsIgnore) {
+ fIgnoreDepth++;
+ }
+ return typeOrFacetAvlAllowsIgnore;
+ }
+ else {
+ if (typeOrFacetUnavlAllowsIgnore) {
+ fIgnoreDepth++;
+ }
+ return typeOrFacetUnavlAllowsIgnore;
+ }
+
+ } // typeAndFacetAvailableAllowsExclude
+
+
+ /*
+ * Method to tokenize a string value given a delimeter, and return a List
+ * containing the string tokens.
+ */
+ private List tokenizeString(String strValue, String delim) {
+ List tokenizedList = new ArrayList();
+
+ String[] strSplitValue = strValue.split(delim);
+
+ for (int strIdx = 0; strIdx < strSplitValue.length; strIdx++) {
+ if (!(strSplitValue[strIdx].trim()).equals("")) {
+ tokenizedList.add(strSplitValue[strIdx].trim());
+ }
+ }
+
+ return tokenizedList;
- } //checkSupportedVersion
+ } // tokenizeString
/**
* A simple boolean based stack.
Added: xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/opti/SchemaVersioningHelper.java
URL: http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/opti/SchemaVersioningHelper.java?rev=978885&view=auto
==============================================================================
--- xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/opti/SchemaVersioningHelper.java (added)
+++ xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/opti/SchemaVersioningHelper.java Sat Jul 24 15:46:09 2010
@@ -0,0 +1,172 @@
+/*
+ * 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.xs.opti;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import org.apache.xerces.impl.Constants;
+import org.apache.xerces.xni.QName;
+
+/**
+ * This class provides supporting functionality for schema versioning
+ * pre-processing, during conditional inclusion of schema components (newly
+ * introduced in XML Schema 1.1).
+ *
+ *
+ * ref: http://www.w3.org/TR/xmlschema11-1/#cip
+ *
+ * @author Mukul Gandhi, IBM
+ *
+ * @version $Id: $
+ */
+public class SchemaVersioningHelper {
+
+ // list variables holding 'natively supported' XML Schema types and facets
+ // by Xerces-J XML Schema 1.1 engine.
+ List typesSupported = null;
+ List facetsSupported = null;
+
+ // class constructor
+ public SchemaVersioningHelper() {
+ typesSupported = new ArrayList();
+ facetsSupported = new ArrayList();
+ initialize();
+ }
+
+ // initializing the supported XML Schema types and facets
+ private void initialize() {
+ initSupportedTypes();
+ initSupportedFacets();
+ }
+
+ // initializing the supported XML Schema types
+ private void initSupportedTypes() {
+ typesSupported.add(new QName(null, "anySimpleType", "anySimpleType", Constants.NS_XMLSCHEMA));
+ typesSupported.add(new QName(null, "anyAtomicType", "anyAtomicType", Constants.NS_XMLSCHEMA));
+ typesSupported.add(new QName(null, "string", "string", Constants.NS_XMLSCHEMA));
+ typesSupported.add(new QName(null, "boolean", "boolean", Constants.NS_XMLSCHEMA));
+ typesSupported.add(new QName(null, "decimal", "decimal", Constants.NS_XMLSCHEMA));
+ typesSupported.add(new QName(null, "precisionDecimal", "precisionDecimal", Constants.NS_XMLSCHEMA));
+ typesSupported.add(new QName(null, "float", "float", Constants.NS_XMLSCHEMA));
+ typesSupported.add(new QName(null, "double", "double", Constants.NS_XMLSCHEMA));
+ typesSupported.add(new QName(null, "duration", "duration", Constants.NS_XMLSCHEMA));
+ typesSupported.add(new QName(null, "dateTime", "dateTime", Constants.NS_XMLSCHEMA));
+ typesSupported.add(new QName(null, "time", "time", Constants.NS_XMLSCHEMA));
+ typesSupported.add(new QName(null, "date", "date", Constants.NS_XMLSCHEMA));
+ typesSupported.add(new QName(null, "gYearMonth", "gYearMonth", Constants.NS_XMLSCHEMA));
+ typesSupported.add(new QName(null, "gYear", "gYear", Constants.NS_XMLSCHEMA));
+ typesSupported.add(new QName(null, "gMonthDay", "gMonthDay", Constants.NS_XMLSCHEMA));
+ typesSupported.add(new QName(null, "gDay", "gDay", Constants.NS_XMLSCHEMA));
+ typesSupported.add(new QName(null, "gMonth", "gMonth", Constants.NS_XMLSCHEMA));
+ typesSupported.add(new QName(null, "hexBinary", "hexBinary", Constants.NS_XMLSCHEMA));
+ typesSupported.add(new QName(null, "base64Binary", "base64Binary", Constants.NS_XMLSCHEMA));
+ typesSupported.add(new QName(null, "anyURI", "anyURI", Constants.NS_XMLSCHEMA));
+ typesSupported.add(new QName(null, "QName", "QName", Constants.NS_XMLSCHEMA));
+ typesSupported.add(new QName(null, "NOTATION", "NOTATION", Constants.NS_XMLSCHEMA));
+ typesSupported.add(new QName(null, "normalizedString", "normalizedString", Constants.NS_XMLSCHEMA));
+ typesSupported.add(new QName(null, "token", "token", Constants.NS_XMLSCHEMA));
+ typesSupported.add(new QName(null, "language", "language", Constants.NS_XMLSCHEMA));
+ typesSupported.add(new QName(null, "NMTOKEN", "NMTOKEN", Constants.NS_XMLSCHEMA));
+ typesSupported.add(new QName(null, "NMTOKENS", "NMTOKENS", Constants.NS_XMLSCHEMA));
+ typesSupported.add(new QName(null, "Name", "Name", Constants.NS_XMLSCHEMA));
+ typesSupported.add(new QName(null, "NCName", "NCName", Constants.NS_XMLSCHEMA));
+ typesSupported.add(new QName(null, "ID", "ID", Constants.NS_XMLSCHEMA));
+ typesSupported.add(new QName(null, "IDREF", "IDREF", Constants.NS_XMLSCHEMA));
+ typesSupported.add(new QName(null, "IDREFS", "IDREFS", Constants.NS_XMLSCHEMA));
+ typesSupported.add(new QName(null, "ENTITY", "ENTITY", Constants.NS_XMLSCHEMA));
+ typesSupported.add(new QName(null, "ENTITIES", "ENTITIES", Constants.NS_XMLSCHEMA));
+ typesSupported.add(new QName(null, "integer", "integer", Constants.NS_XMLSCHEMA));
+ typesSupported.add(new QName(null, "nonPositiveInteger", "nonPositiveInteger", Constants.NS_XMLSCHEMA));
+ typesSupported.add(new QName(null, "negativeInteger", "negativeInteger", Constants.NS_XMLSCHEMA));
+ typesSupported.add(new QName(null, "long", "long", Constants.NS_XMLSCHEMA));
+ typesSupported.add(new QName(null, "int", "int", Constants.NS_XMLSCHEMA));
+ typesSupported.add(new QName(null, "short", "short", Constants.NS_XMLSCHEMA));
+ typesSupported.add(new QName(null, "byte", "byte", Constants.NS_XMLSCHEMA));
+ typesSupported.add(new QName(null, "nonNegativeInteger", "nonNegativeInteger", Constants.NS_XMLSCHEMA));
+ typesSupported.add(new QName(null, "unsignedLong", "unsignedLong", Constants.NS_XMLSCHEMA));
+ typesSupported.add(new QName(null, "unsignedInt", "unsignedInt", Constants.NS_XMLSCHEMA));
+ typesSupported.add(new QName(null, "unsignedShort", "unsignedShort", Constants.NS_XMLSCHEMA));
+ typesSupported.add(new QName(null, "unsignedByte", "unsignedByte", Constants.NS_XMLSCHEMA));
+ typesSupported.add(new QName(null, "positiveInteger", "positiveInteger", Constants.NS_XMLSCHEMA));
+ typesSupported.add(new QName(null, "yearMonthDuration", "yearMonthDuration", Constants.NS_XMLSCHEMA));
+ typesSupported.add(new QName(null, "dayTimeDuration", "dayTimeDuration", Constants.NS_XMLSCHEMA));
+ typesSupported.add(new QName(null, "dateTimeStamp", "dateTimeStamp", Constants.NS_XMLSCHEMA));
+ }
+
+
+ // initializing the supported XML Schema facets
+ private void initSupportedFacets() {
+ facetsSupported.add(new QName(null, "length", "length", Constants.NS_XMLSCHEMA));
+ facetsSupported.add(new QName(null, "minLength", "minLength", Constants.NS_XMLSCHEMA));
+ facetsSupported.add(new QName(null, "maxLength", "maxLength", Constants.NS_XMLSCHEMA));
+ facetsSupported.add(new QName(null, "pattern", "pattern", Constants.NS_XMLSCHEMA));
+ facetsSupported.add(new QName(null, "enumeration", "enumeration", Constants.NS_XMLSCHEMA));
+ facetsSupported.add(new QName(null, "whiteSpace", "whiteSpace", Constants.NS_XMLSCHEMA));
+ facetsSupported.add(new QName(null, "maxInclusive", "maxInclusive", Constants.NS_XMLSCHEMA));
+ facetsSupported.add(new QName(null, "maxExclusive", "maxExclusive", Constants.NS_XMLSCHEMA));
+ facetsSupported.add(new QName(null, "minInclusive", "minInclusive", Constants.NS_XMLSCHEMA));
+ facetsSupported.add(new QName(null, "totalDigits", "totalDigits", Constants.NS_XMLSCHEMA));
+ facetsSupported.add(new QName(null, "minExclusive", "minExclusive", Constants.NS_XMLSCHEMA));
+ facetsSupported.add(new QName(null, "fractionDigits", "fractionDigits", Constants.NS_XMLSCHEMA));
+ facetsSupported.add(new QName(null, "maxScale", "maxScale", Constants.NS_XMLSCHEMA));
+ facetsSupported.add(new QName(null, "minScale", "minScale", Constants.NS_XMLSCHEMA));
+ facetsSupported.add(new QName(null, "assertion", "assertion", Constants.NS_XMLSCHEMA));
+ facetsSupported.add(new QName(null, "explicitTimezone", "explicitTimezone", Constants.NS_XMLSCHEMA));
+ }
+
+
+ // checks if the schema type specified by method arguments (the QName
+ // components of the schema type) is supported by Xerces-J natively.
+ public boolean isTypeSupported(String localName, String uri) {
+ boolean typeSupported = false;
+
+ for (Iterator iter = typesSupported.iterator(); iter.hasNext(); ) {
+ QName typeQname = (QName) iter.next();
+ if (localName.equals(typeQname.localpart) &&
+ uri.equals(typeQname.uri)) {
+ typeSupported = true;
+ break;
+ }
+ }
+
+ return typeSupported;
+
+ } // isTypeSupported
+
+
+ // checks if the schema facet specified by method arguments (the QName
+ // components of a schema facet) is supported by Xerces-J natively.
+ public boolean isFacetSupported(String localName, String uri) {
+ boolean facetSupported = false;
+
+ for (Iterator iter = facetsSupported.iterator(); iter.hasNext(); ) {
+ QName typeQname = (QName) iter.next();
+ if (localName.equals(typeQname.localpart) &&
+ uri.equals(typeQname.uri)) {
+ facetSupported = true;
+ break;
+ }
+ }
+
+ return facetSupported;
+
+ } // isFacetSupported
+
+}
Modified: xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/util/NamespaceSupport.java
URL: http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/util/NamespaceSupport.java?rev=978885&r1=978884&r2=978885&view=diff
==============================================================================
--- xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/util/NamespaceSupport.java (original)
+++ xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/util/NamespaceSupport.java Sat Jul 24 15:46:09 2010
@@ -189,7 +189,7 @@ public class NamespaceSupport implements
// find prefix in current context
for (int i = fNamespaceSize; i > 0; i -= 2) {
- if (fNamespace[i - 2] == prefix) {
+ if (prefix.equals(fNamespace[i - 2])) {
return fNamespace[i - 1];
}
}
@@ -207,8 +207,8 @@ public class NamespaceSupport implements
// find uri in current context
for (int i = fNamespaceSize; i > 0; i -= 2) {
- if (fNamespace[i - 1] == uri) {
- if (getURI(fNamespace[i - 2]) == uri)
+ if (uri.equals(fNamespace[i - 1])) {
+ if (uri.equals(getURI(fNamespace[i - 2])))
return fNamespace[i - 2];
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@xerces.apache.org
For additional commands, e-mail: commits-help@xerces.apache.org