svn commit: r1172656 - in /xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl: dv/xs/XSSimpleTypeDecl.java msg/XMLSchemaMessages.properties xs/traversers/XSDAttributeTraverser.java xs/
Author: knoaman Date: Mon Sep 19 15:12:32 2011 New Revision: 1172656 URL: http://svn.apache.org/viewvc?rev=1172656view=rev Log: NOTATION datatype - Schema Component Constraint - Jira issue 1536 https://issues.apache.org/jira/browse/XERCESJ-1536 Modified: 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/msg/XMLSchemaMessages.properties 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/XSDElementTraverser.java 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=1172656r1=1172655r2=1172656view=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 Mon Sep 19 15:12:32 2011 @@ -979,7 +979,7 @@ public class XSSimpleTypeDecl implements } else { maxInclusiveAnnotation = facets.maxInclusiveAnnotation; try { -fMaxInclusive = fBase.getActualValue(facets.maxInclusive, context, tempInfo, true); +fMaxInclusive = fBase.getActualValue(facets.maxInclusive, context, tempInfo, true, false); fFacetsDefined |= FACET_MAXINCLUSIVE; if ((fixedFacet FACET_MAXINCLUSIVE) != 0) fFixedFacet |= FACET_MAXINCLUSIVE; @@ -1015,7 +1015,7 @@ public class XSSimpleTypeDecl implements } else { maxExclusiveAnnotation = facets.maxExclusiveAnnotation; try { -fMaxExclusive = fBase.getActualValue(facets.maxExclusive, context, tempInfo, true); +fMaxExclusive = fBase.getActualValue(facets.maxExclusive, context, tempInfo, true, false); fFacetsDefined |= FACET_MAXEXCLUSIVE; if ((fixedFacet FACET_MAXEXCLUSIVE) != 0) fFixedFacet |= FACET_MAXEXCLUSIVE; @@ -1062,7 +1062,7 @@ public class XSSimpleTypeDecl implements } else { minExclusiveAnnotation = facets.minExclusiveAnnotation; try { -fMinExclusive = fBase.getActualValue(facets.minExclusive, context, tempInfo, true); +fMinExclusive = fBase.getActualValue(facets.minExclusive, context, tempInfo, true, false); fFacetsDefined |= FACET_MINEXCLUSIVE; if ((fixedFacet FACET_MINEXCLUSIVE) != 0) fFixedFacet |= FACET_MINEXCLUSIVE; @@ -1108,7 +1108,7 @@ public class XSSimpleTypeDecl implements } else { minInclusiveAnnotation = facets.minInclusiveAnnotation; try { -fMinInclusive = fBase.getActualValue(facets.minInclusive, context, tempInfo, true); +fMinInclusive = fBase.getActualValue(facets.minInclusive, context, tempInfo, true, false); fFacetsDefined |= FACET_MININCLUSIVE; if ((fixedFacet FACET_MININCLUSIVE) != 0) fFixedFacet |= FACET_MININCLUSIVE; @@ -1743,7 +1743,7 @@ public class XSSimpleTypeDecl implements // first normalize string value, and convert it to actual value boolean needNormalize = context==null||context.needToNormalize(); -Object ob = getActualValue(content, context, validatedInfo, needNormalize); +Object ob = getActualValue(content, context, validatedInfo, needNormalize, false); validate(context, validatedInfo); @@ -1753,13 +1753,18 @@ public class XSSimpleTypeDecl implements protected ValidatedInfo getActualEnumValue(String lexical, ValidationContext ctx, ValidatedInfo info) throws InvalidDatatypeValueException { -return fBase.validateWithInfo(lexical, ctx, info); +return fBase.validateWithInfo(lexical, ctx, info, true); } /** * validate a value, and return the compiled form */ public ValidatedInfo validateWithInfo(String content, ValidationContext context, ValidatedInfo validatedInfo) throws InvalidDatatypeValueException { +return validateWithInfo(content, context, validatedInfo, false); +} + +private ValidatedInfo validateWithInfo(String content, ValidationContext context, +ValidatedInfo validatedInfo, boolean enumerationValidation) throws InvalidDatatypeValueException { if (context == null) context = fEmptyContext
svn commit: r1171605 - /xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/AnyURIDV.java
Author: knoaman Date: Fri Sep 16 14:53:12 2011 New Revision: 1171605 URL: http://svn.apache.org/viewvc?rev=1171605view=rev Log: anyURI values can be any valid XML String - Jira issue 1534 (https://issues.apache.org/jira/browse/XERCESJ-1534) Modified: xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/AnyURIDV.java Modified: xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/AnyURIDV.java URL: http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/AnyURIDV.java?rev=1171605r1=1171604r2=1171605view=diff == --- xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/AnyURIDV.java (original) +++ xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/AnyURIDV.java Fri Sep 16 14:53:12 2011 @@ -46,21 +46,38 @@ public class AnyURIDV extends TypeValida // before we return string we have to make sure it is correct URI as per spec. // for some types (string and derived), they just return the string itself public Object getActualValue(String content, ValidationContext context) throws InvalidDatatypeValueException { -// check 3.2.17.c0 must: URI (rfc 2396/2723) -try { -if( content.length() != 0 ) { -// encode special characters using XLink 5.4 algorithm -final String encoded = encode(content); -// Support for relative URLs -// According to Java 1.1: URLs may also be specified with a -// String and the URL object that it is related to. -new URI(BASE_URI, encoded ); +// According to XML Schema 1.1 +// +// 3.3.17.1 Value Space +// +// The value space of anyURI is the set of finite-length sequences of +// zero or more characters (as defined in [XML]) that match the Char +// production from [XML]. +// +// 3.3.17.2 Lexical Mapping +// +// The lexical space of anyURI is the set of finite-length sequences +// of zero or more characters (as defined in [XML]) that match the +// Char production from [XML]. + +// Only for XML Schema 1.0 +if (!context.getTypeValidatorHelper().isXMLSchema11()) { +// check 3.2.17.c0 must: URI (rfc 2396/2723) +try { +if( content.length() != 0 ) { +// encode special characters using XLink 5.4 algorithm +final String encoded = encode(content); +// Support for relative URLs +// According to Java 1.1: URLs may also be specified with a +// String and the URL object that it is related to. +new URI(BASE_URI, encoded );new URI(content); +} +} catch (URI.MalformedURIException ex) { +throw new InvalidDatatypeValueException(cvc-datatype-valid.1.2.1, new Object[]{content, anyURI}); } -} catch (URI.MalformedURIException ex) { -throw new InvalidDatatypeValueException(cvc-datatype-valid.1.2.1, new Object[]{content, anyURI}); } -// REVISIT: do we need to return the new URI object? +// REVISIT - XML Schema 1.0: do we need to return the new URI object? return content; } - To unsubscribe, e-mail: commits-unsubscr...@xerces.apache.org For additional commands, e-mail: commits-h...@xerces.apache.org
svn commit: r1171610 - /xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/AnyURIDV.java
Author: knoaman Date: Fri Sep 16 14:59:57 2011 New Revision: 1171610 URL: http://svn.apache.org/viewvc?rev=1171610view=rev Log: Removed code that is not needed Modified: xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/AnyURIDV.java Modified: xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/AnyURIDV.java URL: http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/AnyURIDV.java?rev=1171610r1=1171609r2=1171610view=diff == --- xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/AnyURIDV.java (original) +++ xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/AnyURIDV.java Fri Sep 16 14:59:57 2011 @@ -70,7 +70,7 @@ public class AnyURIDV extends TypeValida // Support for relative URLs // According to Java 1.1: URLs may also be specified with a // String and the URL object that it is related to. -new URI(BASE_URI, encoded );new URI(content); +new URI(BASE_URI, encoded ); } } catch (URI.MalformedURIException ex) { throw new InvalidDatatypeValueException(cvc-datatype-valid.1.2.1, new Object[]{content, anyURI}); - To unsubscribe, e-mail: commits-unsubscr...@xerces.apache.org For additional commands, e-mail: commits-h...@xerces.apache.org
svn commit: r1171718 - /xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/XMLSchemaValidator.java
Author: knoaman Date: Fri Sep 16 18:51:45 2011 New Revision: 1171718 URL: http://svn.apache.org/viewvc?rev=1171718view=rev Log: For dynamic EDC, check for local elements in current type as well as the base type chain. Jira issue 1535 (https://issues.apache.org/jira/browse/XERCESJ-1535) Modified: xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/XMLSchemaValidator.java 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=1171718r1=1171717r2=1171718view=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 Fri Sep 16 18:51:45 2011 @@ -2382,7 +2382,7 @@ public class XMLSchemaValidator // EDC rule if (isSchema11) { if (wildcard != null fCurrentCM != null) { -XSElementDecl elemDecl = fCurrentCM.findMatchingElemDecl(element, fSubGroupHandler); +XSElementDecl elemDecl = findLocallyDeclaredType(element, fCurrentCM, fTypeStack[fElementDepth-1].getBaseType()); if (elemDecl != null) { final XSTypeDefinition elemType = elemDecl.getTypeDefinition(); // types need to be equivalent @@ -2566,6 +2566,19 @@ public class XMLSchemaValidator return augs; } // handleStartElement(QName,XMLAttributes,boolean) + +private XSElementDecl findLocallyDeclaredType(QName element, +XSCMValidator currentCM, XSTypeDefinition baseType) { +XSElementDecl elemDecl = currentCM.findMatchingElemDecl(element, fSubGroupHandler); +if (elemDecl == null) { +if (baseType.getTypeCategory() != XSTypeDefinition.SIMPLE_TYPE +baseType != SchemaGrammar.getXSAnyType(fSchemaVersion)) { +currentCM = ((XSComplexTypeDecl) baseType).getContentModel(fCMBuilder); +return findLocallyDeclaredType(element, currentCM, baseType.getBaseType()); +} +} +return elemDecl; +} /* * Delegate to assertions validator startElement handler. - To unsubscribe, e-mail: commits-unsubscr...@xerces.apache.org For additional commands, e-mail: commits-h...@xerces.apache.org
svn commit: r1171226 - /xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/traversers/XSDHandler.java
Author: knoaman Date: Thu Sep 15 19:06:33 2011 New Revision: 1171226 URL: http://svn.apache.org/viewvc?rev=1171226view=rev Log: Fix for Jira bug 1531 - https://issues.apache.org/jira/browse/XERCESJ-1531 Modified: xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/traversers/XSDHandler.java 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=1171226r1=1171225r2=1171226view=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 19:06:33 2011 @@ -1451,7 +1451,9 @@ public class XSDHandler { if (fSchemaVersion Constants.SCHEMA_VERSION_1_1 || !dependenciesCanOccur) { reportSchemaError(s4s-elt-invalid-content.3, new Object [] {componentType}, globalComp); } -// skip it; traverse it later +final SchemaGrammar currSG = fGrammarBucket.getGrammar(currSchemaDoc.fTargetNamespace); +currSchemaDoc.fDefaultOpenContent = fComplexTypeTraverser.traverseOpenContent(globalComp, currSchemaDoc, currSG, true); +DOMUtil.setHidden(globalComp, fHiddenNodes); dependenciesCanOccur = false; continue; } @@ -1624,23 +1626,6 @@ public class XSDHandler { currSG.addAnnotation(fElementTraverser.traverseAnnotationDecl(globalComp, currSchemaDoc.getSchemaAttrs(), true, currSchemaDoc)); sawAnnotation = true; } -else if (fSchemaVersion == Constants.SCHEMA_VERSION_1_1) { -if (componentType.equals(SchemaSymbols.ELT_DEFAULTOPENCONTENT)) { -currSchemaDoc.fDefaultOpenContent = fComplexTypeTraverser.traverseOpenContent(globalComp, currSchemaDoc, currSG, true); -} -// if component is of override type - currently we do not -// attempt to validate override Element since it will -// be reflected on schema anyway -// -// REVISIT - is it required to validate Override components -// that do not affect any schema..? -else if (componentType.equals(SchemaSymbols.ELT_OVERRIDE)){ -continue; -} -else { -reportSchemaError(s4s-elt-invalid-content.1, new Object [] {SchemaSymbols.ELT_SCHEMA, DOMUtil.getLocalName(globalComp)}, globalComp); -} -} else { reportSchemaError(s4s-elt-invalid-content.1, new Object [] {SchemaSymbols.ELT_SCHEMA, DOMUtil.getLocalName(globalComp)}, globalComp); } - To unsubscribe, e-mail: commits-unsubscr...@xerces.apache.org For additional commands, e-mail: commits-h...@xerces.apache.org
svn commit: r1170728 - /xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/TimeDV.java
Author: knoaman Date: Wed Sep 14 17:35:03 2011 New Revision: 1170728 URL: http://svn.apache.org/viewvc?rev=1170728view=rev Log: Implement changes to xs:time values - Jira issue 1530 (https://issues.apache.org/jira/browse/XERCESJ-1530) Modified: xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/TimeDV.java Modified: xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/TimeDV.java URL: http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/TimeDV.java?rev=1170728r1=1170727r2=1170728view=diff == --- xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/TimeDV.java (original) +++ xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/TimeDV.java Wed Sep 14 17:35:03 2011 @@ -72,13 +72,18 @@ public class TimeDV extends AbstractDate //validate and normalize validateDateTime(date, isXMLSchema11); + +// reset back day +date.day = 15; //save unnormalized values saveUnnormalized(date); if ( date.utc!=0 date.utc != 'Z') { normalize(date); -date.day = 15; +if (!isXMLSchema11) { +date.day = 15; +} } date.position = 2; return date; - To unsubscribe, e-mail: commits-unsubscr...@xerces.apache.org For additional commands, e-mail: commits-h...@xerces.apache.org
svn commit: r1167179 - in /xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs: opti/SchemaDOMParser.java traversers/XSDHandler.java
Author: knoaman Date: Fri Sep 9 14:03:58 2011 New Revision: 1167179 URL: http://svn.apache.org/viewvc?rev=1167179view=rev Log: Handle min/maxVersion on xs:schema - Jira issue 1528 https://issues.apache.org/jira/browse/XERCESJ-1528 Modified: 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/impl/xs/traversers/XSDHandler.java 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=1167179r1=1167178r2=1167179view=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 Fri Sep 9 14:03:58 2011 @@ -256,7 +256,7 @@ public class SchemaDOMParser extends Def // perform conditional exclusion checks for schema versioning namespace // (does not apply to schema element). -if (fDepth 0) { +if (fDepth -1) { checkVersionControlAttributes(element, attributes); if (fIgnoreDepth -1) { return; 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=1167179r1=1167178r2=1167179view=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 Fri Sep 9 14:03:58 2011 @@ -2686,13 +2686,18 @@ public class XSDHandler { private Element getSchemaDocument0(XSDKey key, String schemaId, Element schemaElement) { // now we need to store the mapping information from system id // to the document. also from the document to the system id. -if (key != null) { -fTraversed.put(key, schemaElement); +if (schemaElement != null) { +if (key != null) { +fTraversed.put(key, schemaElement); +} +if (schemaId != null) { +fDoc2SystemId.put(schemaElement, schemaId); +} +fLastSchemaWasDuplicate = false; } -if (schemaId != null) { -fDoc2SystemId.put(schemaElement, schemaId); +else { +fLastSchemaWasDuplicate = true; } -fLastSchemaWasDuplicate = false; return schemaElement; } // getSchemaDocument0(XSDKey, String, Element): Element - To unsubscribe, e-mail: commits-unsubscr...@xerces.apache.org For additional commands, e-mail: commits-h...@xerces.apache.org
svn commit: r1167216 - in /xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs: XS11Constraints.java XSConstraints.java models/XS11CMRestriction.java
Author: knoaman Date: Fri Sep 9 14:34:51 2011 New Revision: 1167216 URL: http://svn.apache.org/viewvc?rev=1167216view=rev Log: Implement new rule for Schema Component Constraint: Content type restricts (Complex Content) Jira issue 1529 - https://issues.apache.org/jira/browse/XERCESJ-1529 Modified: xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/XS11Constraints.java xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/XSConstraints.java xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/models/XS11CMRestriction.java Modified: xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/XS11Constraints.java URL: http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/XS11Constraints.java?rev=1167216r1=1167215r2=1167216view=diff == --- xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/XS11Constraints.java (original) +++ xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/XS11Constraints.java Fri Sep 9 14:34:51 2011 @@ -198,7 +198,7 @@ class XS11Constraints extends XSConstrai /* * Check if two type tables are equivalent. */ -protected boolean isTypeTablesEquivalent(XSElementDecl elementDecl1, XSElementDecl elementDecl2) { +final public boolean isTypeTablesEquivalent(XSElementDecl elementDecl1, XSElementDecl elementDecl2) { final XSTypeAlternativeImpl[] typeTable1 = elementDecl1.getTypeAlternatives(); final XSTypeAlternativeImpl[] typeTable2 = elementDecl2.getTypeAlternatives(); Modified: xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/XSConstraints.java URL: http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/XSConstraints.java?rev=1167216r1=1167215r2=1167216view=diff == --- xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/XSConstraints.java (original) +++ xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/XSConstraints.java Fri Sep 9 14:34:51 2011 @@ -87,6 +87,10 @@ public abstract class XSConstraints { final public short getSchemaVersion() { return fSchemaVersion; } + +public boolean isTypeTablesEquivalent(XSElementDecl elementDecl1, XSElementDecl elementDecl2) { +return true; +} /** * check whether derived is valid derived from base, given a subset Modified: xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/models/XS11CMRestriction.java URL: http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/models/XS11CMRestriction.java?rev=1167216r1=1167215r2=1167216view=diff == --- xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/models/XS11CMRestriction.java (original) +++ xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/models/XS11CMRestriction.java Fri Sep 9 14:34:51 2011 @@ -496,6 +496,12 @@ public final class XS11CMRestriction imp return false; } +// 4.6 S.{type table} and G.{type table} either are both absent or +// are both present and equivalent. +if (!xsc.isTypeTablesEquivalent(eb, ed)) { +return false; +} + return true; } - To unsubscribe, e-mail: commits-unsubscr...@xerces.apache.org For additional commands, e-mail: commits-h...@xerces.apache.org
svn commit: r1166836 - in /xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl: dv/xs/ xs/ xs/models/ xs/traversers/
Author: knoaman Date: Thu Sep 8 18:21:19 2011 New Revision: 1166836 URL: http://svn.apache.org/viewvc?rev=1166836view=rev Log: Allow equality check between singleton list value and atomic value - Jira 1527 (https://issues.apache.org/jira/browse/XERCESJ-1527) Added: xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/EqualityHelper.java (with props) Modified: 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/xs/XMLSchemaValidator.java xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/XSAttributeGroupDecl.java xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/XSConstraints.java xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/models/XS11CMRestriction.java xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/traversers/XSDAttributeTraverser.java Added: xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/EqualityHelper.java URL: http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/EqualityHelper.java?rev=1166836view=auto == --- xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/EqualityHelper.java (added) +++ xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/EqualityHelper.java Thu Sep 8 18:21:19 2011 @@ -0,0 +1,217 @@ +/* + * 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.dv.xs; + +import org.apache.xerces.impl.Constants; +import org.apache.xerces.impl.dv.ValidatedInfo; +import org.apache.xerces.impl.dv.xs.ListDV.ListData; +import org.apache.xerces.xs.ShortList; +import org.apache.xerces.xs.XSConstants; + +/** + * @version $Id$ + */ +public class EqualityHelper { + +// private constructor +private EqualityHelper() {} + +// public methods + +/** + * Compare 2 actual values + */ +public static boolean isEqual(Object value1, Object value2, +short value1Type, short value2Type, +ShortList typeList1, ShortList typeList2, +short schemaVersion) { +if (schemaVersion == Constants.SCHEMA_VERSION_1_1) { +return isEqual11(value1, value2, value1Type, value2Type, typeList1, typeList2); +} + +return isEqual(value1, value2, value1Type, value2Type, typeList1, typeList2); +} + +public static boolean isEqual(ValidatedInfo value1, ValidatedInfo value2, short schemaVersion) { +if (schemaVersion == Constants.SCHEMA_VERSION_1_1) { +return isEqual11(value1.actualValue, value2.actualValue, +value1.actualValueType, value2.actualValueType, +value1.itemValueTypes, value2.itemValueTypes); +} + +return isEqual(value1.actualValue, value2.actualValue, +value1.actualValueType, value2.actualValueType, +value1.itemValueTypes, value2.itemValueTypes); +} + +// private XML Schema 1.0 methods +private static boolean isEqual(Object value1, Object value2, +short value1Type, short value2Type, +ShortList typeList1, ShortList typeList2) { + +if (!isTypeComparable(value1Type, value2Type, typeList1, typeList2)) { +return false; +} + +if (value1 == value2) { +return true; +} + +if (value1 == null || value2 == null) { +return false; +} + +return value1.equals(value2); +} + +private static boolean isTypeComparable(short type1, short type2, +ShortList typeList1, ShortList typeList2) { + +final short primitiveType1 = convertToPrimitiveKind(type1); +final short primitiveType2 = convertToPrimitiveKind(type2); + +// Same types +if (primitiveType1 == primitiveType2) { +if (primitiveType1 == XSConstants.LIST_DT) { +return isListTypeComparable(typeList1, typeList2
svn commit: r1166846 - /xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/XSConstraints.java
Author: knoaman Date: Thu Sep 8 18:34:13 2011 New Revision: 1166846 URL: http://svn.apache.org/viewvc?rev=1166846view=rev Log: Remove unused imports Modified: xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/XSConstraints.java Modified: xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/XSConstraints.java URL: http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/XSConstraints.java?rev=1166846r1=1166845r2=1166846view=diff == --- xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/XSConstraints.java (original) +++ xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/XSConstraints.java Thu Sep 8 18:34:13 2011 @@ -26,13 +26,10 @@ import org.apache.xerces.impl.dv.Invalid import org.apache.xerces.impl.dv.ValidatedInfo; import org.apache.xerces.impl.dv.ValidationContext; import org.apache.xerces.impl.dv.XSSimpleType; -import org.apache.xerces.impl.xs.alternative.XSTypeAlternativeImpl; import org.apache.xerces.impl.xs.models.CMBuilder; import org.apache.xerces.impl.xs.models.XSCMValidator; import org.apache.xerces.impl.xs.util.SimpleLocator; import org.apache.xerces.impl.xs.util.XSObjectListImpl; -import org.apache.xerces.impl.xs.util.XSTypeHelper; -import org.apache.xerces.util.NamespaceSupport; import org.apache.xerces.util.SymbolHash; import org.apache.xerces.xs.XSConstants; import org.apache.xerces.xs.XSObjectList; - To unsubscribe, e-mail: commits-unsubscr...@xerces.apache.org For additional commands, e-mail: commits-h...@xerces.apache.org
svn commit: r1163738 - /xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/XSWildcardDecl.java
Author: knoaman Date: Wed Aug 31 18:38:35 2011 New Revision: 1163738 URL: http://svn.apache.org/viewvc?rev=1163738view=rev Log: Support additional rules for EDC - Jira 1526 https://issues.apache.org/jira/browse/XERCESJ-1526 Modified: xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/XSWildcardDecl.java Modified: xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/XSWildcardDecl.java URL: http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/XSWildcardDecl.java?rev=1163738r1=1163737r2=1163738view=diff == --- xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/XSWildcardDecl.java (original) +++ xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/XSWildcardDecl.java Wed Aug 31 18:38:35 2011 @@ -127,14 +127,18 @@ public class XSWildcardDecl implements X * * Validation Rule: Wildcard allows Name */ -public boolean allowQName(QName name) { +final public boolean allowQName(QName name) { +return allowName(name.uri, name.localpart); +} + +final public boolean allowName(String uri, String localPart) { // 1 The namespace name is valid with respect to C, as defined in Wildcard allows Namespace Name (3.10.4.3); // 2 C.{disallowed names} does not contain E. -if (allowNamespace(name.uri)) { +if (allowNamespace(uri)) { if (fDisallowedNamesList == null || fDisallowedNamesList.length == 0) { return true; } -return isNameAllowed(name.uri, name.localpart); +return isNameAllowed(uri, localPart); } // failed - To unsubscribe, e-mail: commits-unsubscr...@xerces.apache.org For additional commands, e-mail: commits-h...@xerces.apache.org
svn commit: r1157133 - /xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/traversers/XSDSimpleTypeTraverser.java
Author: knoaman Date: Fri Aug 12 14:46:12 2011 New Revision: 1157133 URL: http://svn.apache.org/viewvc?rev=1157133view=rev Log: Move the check for itemType and memberTypes not being special type to findDTDValidator Modified: xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/traversers/XSDSimpleTypeTraverser.java 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=1157133r1=1157132r2=1157133view=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 Fri Aug 12 14:46:12 2011 @@ -29,7 +29,6 @@ import org.apache.xerces.impl.xs.SchemaS import org.apache.xerces.impl.xs.XSAnnotationImpl; import org.apache.xerces.impl.xs.util.XInt; import org.apache.xerces.impl.xs.util.XSObjectListImpl; -import org.apache.xerces.impl.xs.util.XSTypeHelper; import org.apache.xerces.util.DOMUtil; import org.apache.xerces.xni.QName; import org.apache.xerces.xs.XSConstants; @@ -307,18 +306,15 @@ class XSDSimpleTypeTraverser extends XSD // get types from memberTypes attribute ArrayList dTValidators = null; XSSimpleType dv = null; -XSSimpleType[] memberTypeDvList = null; XSObjectList dvs; if (union memberTypes != null memberTypes.size() 0) { int size = memberTypes.size(); -memberTypeDvList = new XSSimpleType[size]; dTValidators = new ArrayList(size); // for each qname in the list for (int i = 0; i size; i++) { // get the type decl dv = findDTValidator(child, name, (QName)memberTypes.elementAt(i), XSConstants.DERIVATION_UNION, schemaDoc); -memberTypeDvList[i] = dv; if (dv != null) { // if it's a union, expand it // In XML Schema 1.1, we do not expand @@ -449,20 +445,7 @@ class XSDSimpleTypeTraverser extends XSD annotations == null? null : new XSObjectListImpl(annotations, annotations.length)); } } - -if (fSchemaHandler.fSchemaVersion == Constants.SCHEMA_VERSION_1_1) { -if (list baseValidator != null XSTypeHelper.isSpecialSimpleType(baseValidator)) { - reportSchemaError(st-props-correct.1, new Object[] {((XSSimpleTypeDecl)newDecl).getTypeName(), xs:list}, child); -} -else if (union memberTypeDvList != null) { - for (int memTypeIdx = 0; memTypeIdx memberTypeDvList.length; memTypeIdx++) { - if (XSTypeHelper.isSpecialSimpleType(memberTypeDvList[memTypeIdx])) { - reportSchemaError(st-props-correct.1, new Object[] {((XSSimpleTypeDecl)newDecl).getTypeName(), xs:union}, child); - } - } -} -} - + // XML Schema 1.1 // Set context information final int localValidatorsSize = localValidators.size(); @@ -510,15 +493,22 @@ class XSDSimpleTypeTraverser extends XSD // if it's a complex type, or if its restriction of anySimpleType // or anyAtomicType (XML Schema 1.1) -if ((baseType == SchemaGrammar.fAnySimpleType || baseType == SchemaGrammar.fAnyAtomicType) -baseRefContext == XSConstants.DERIVATION_RESTRICTION) { -// if the base type is anySimpleType and the current type is -// a S4S built-in type, return null. (not an error). -if (checkBuiltIn(refName, schemaDoc.fTargetNamespace)) { +if (baseType == SchemaGrammar.fAnySimpleType || baseType == SchemaGrammar.fAnyAtomicType) { +if (baseRefContext == XSConstants.DERIVATION_RESTRICTION) { +// if the base type is anySimpleType and the current type is +// a S4S built-in type, return null. (not an error). +if (checkBuiltIn(refName, schemaDoc.fTargetNamespace)) { +return null; +} +reportSchemaError(cos-st-restricts.1.1, new Object[]{baseTypeStr.rawname, refName}, elm); +return null; +} +else if (fSchemaHandler.fSchemaVersion == Constants.SCHEMA_VERSION_1_1) { +// itemType and memberType cannot be a special type +final String contextString = (baseRefContext == XSConstants.DERIVATION_LIST) ? xs:list : xs:union; +reportSchemaError(st-props-correct.1, new Object[] {refName, contextString}, elm
svn commit: r1156625 - /xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/XMLSchemaValidator.java
Author: knoaman Date: Thu Aug 11 14:14:00 2011 New Revision: 1156625 URL: http://svn.apache.org/viewvc?rev=1156625view=rev Log: Fix typo - Wrong message key was used Modified: xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/XMLSchemaValidator.java 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=1156625r1=1156624r2=1156625view=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 Aug 11 14:14:00 2011 @@ -2360,7 +2360,7 @@ public class XMLSchemaValidator } if (!fXSConstraints.checkTypeDerivationOk(fCurrentType, elemType, block)) { reportSchemaError( -cvc-elt.4.cos-element-consistent.4.a, +cos-element-consistent.4.a, new Object[] { element.rawname, fCurrentType, elemType.getName()}); } } - To unsubscribe, e-mail: commits-unsubscr...@xerces.apache.org For additional commands, e-mail: commits-h...@xerces.apache.org
svn commit: r1156751 - /xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/traversers/XSDComplexTypeTraverser.java
Author: knoaman Date: Thu Aug 11 19:18:37 2011 New Revision: 1156751 URL: http://svn.apache.org/viewvc?rev=1156751view=rev Log: Implement latest changes to openContent (dealing with derivation by extension) Modified: xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/traversers/XSDComplexTypeTraverser.java 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=1156751r1=1156750r2=1156751view=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 Aug 11 19:18:37 2011 @@ -1251,24 +1251,48 @@ class XSDComplexTypeTraverser extends X } } -// If the wildcard element is not absent -if (fOpenContent != null) { -// 6.2 If the actual value of its mode [attribute] is 'none', then an absent {open content} -if (fOpenContent.fMode == XSOpenContentDecl.MODE_NONE) { -fOpenContent = null; -} -// 6.3 If the {variety} is empty, then a Particle as follows: +// 6.1 If the wildcard element is absent or is present and has +// mode = 'none', then the explicit content type. +if (fOpenContent == null || fOpenContent.fMode == XSOpenContentDecl.MODE_NONE) { +fOpenContent = explicitOpenContent; +} +else { +// 6.2 + +// If the {variety} is empty, then a Particle as follows: // {min occurs} 1 // {max occurs} 1 // {term} a model group whose {compositor} is sequence and whose {particles} is empty. -else if (fContentType == XSComplexTypeDecl.CONTENTTYPE_EMPTY) { +if (fContentType == XSComplexTypeDecl.CONTENTTYPE_EMPTY) { fParticle = XSConstraints.getEmptySequence(); fContentType = XSComplexTypeDecl.CONTENTTYPE_ELEMENT; } -} -// 6.1 If the wildcard element is absent, then the explicit open content. -else { -fOpenContent = explicitOpenContent; + +// An Open Content as follows: +// PropertyValue +// {mode} The actual value of the mode [attribute] of the +// wildcard element, if present, otherwise +// interleave. +// +// {wildcard} Let W be the wildcard corresponding to the any +// [child] of the wildcard element. If the +// {open content} of the explicit content type is +// absent, then W; otherwise a wildcard whose +// {process contents} and {annotations} are those of +// W, and whose {namespace constraint} is the +// wildcard union of the {namespace constraint} of W +// and of {open content}.{wildcard} of the explicit +// content type, as defined in Attribute Wildcard +// Union (3.10.6.3). + +// If explicit open content is null, no need to make any changes +if (explicitOpenContent != null) { +XSOpenContentDecl oc = new XSOpenContentDecl(); +oc.fMode = fOpenContent.fMode; // interleave by default +oc.fWildcard = fSchemaHandler.fXSConstraints.performUnionWith(fOpenContent.fWildcard, explicitOpenContent.fWildcard, fOpenContent.fWildcard.fProcessContents); +oc.fWildcard.fAnnotations = fOpenContent.fWildcard.fAnnotations; +fOpenContent = oc; +} } if (fDerivedBy == XSConstants.DERIVATION_EXTENSION baseType.getContentType() != XSComplexTypeDecl.CONTENTTYPE_EMPTY) { - To unsubscribe, e-mail: commits-unsubscr...@xerces.apache.org For additional commands, e-mail: commits-h...@xerces.apache.org
svn commit: r1155073 - in /xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs: ./ models/ traversers/
Author: knoaman Date: Mon Aug 8 20:02:50 2011 New Revision: 1155073 URL: http://svn.apache.org/viewvc?rev=1155073view=rev Log: Element Delcaration Consistent When matching a wildcard, the type of the matched global declaration must be same or validly derived from the type of any local element delcaration with the same name Modified: 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/XSConstraints.java xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/models/XS11AllCM.java xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/models/XSAllCM.java xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/models/XSCMValidator.java xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/models/XSDFACM.java xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/models/XSEmptyCM.java xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/traversers/XSDHandler.java 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=1155073r1=1155072r2=1155073view=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 Mon Aug 8 20:02:50 2011 @@ -410,7 +410,9 @@ public class XMLSchemaValidator * While parsing a document, keep the location of the document. */ private XMLLocator fLocator; - + +private ArrayList fXSITypeErrors = new ArrayList(4); + private IDContext fIDContext = null; /** @@ -2230,6 +2232,8 @@ public class XMLSchemaValidator } // if no decl/type found for the current element +final boolean isSchema11 = (fSchemaVersion == Constants.SCHEMA_VERSION_1_1); +boolean needToPushErrorContext = false; if (fCurrentType == null xsiType == null) { // if this is the validation root, report an error, because // we can't find eith decl or type for this element @@ -2289,17 +2293,35 @@ public class XMLSchemaValidator // push error reporter context: record the current position // This has to happen after we process skip contents, // otherwise push and pop won't be correctly paired. -fXSIErrorReporter.pushContext(); +if (isSchema11) { +needToPushErrorContext = true; +} +else { +fXSIErrorReporter.pushContext(); +} } else { // push error reporter context: record the current position // This has to happen after we process skip contents, // otherwise push and pop won't be correctly paired. -fXSIErrorReporter.pushContext(); +if (isSchema11) { +needToPushErrorContext = true; +} +else { +fXSIErrorReporter.pushContext(); +} // get xsi:type if (xsiType != null) { XSTypeDefinition oldType = fCurrentType; -fCurrentType = getAndCheckXsiType(element, xsiType, attributes); +if (isSchema11) { +if (fXSITypeErrors.size() 0) { +fXSITypeErrors.clear(); +} +fCurrentType = getAndCheckXsiType(element, xsiType, attributes, fXSITypeErrors); +} +else { +fCurrentType = getAndCheckXsiType(element, xsiType, attributes); +} // If it fails, use the old type. Use anyType if ther is no old type. if (fCurrentType == null) { if (oldType == null) @@ -2325,6 +2347,39 @@ public class XMLSchemaValidator } } +// EDC rule +if (isSchema11) { +if (wildcard != null fCurrentCM != null) { +XSElementDecl elemDecl = fCurrentCM.findMatchingElemDecl(element, fSubGroupHandler); +if (elemDecl != null) { +final XSTypeDefinition elemType = elemDecl.getTypeDefinition(); +// types need to be equivalent +if (fCurrentType != elemType) { +short block = elemDecl.fBlock; +if (elemType.getTypeCategory() == XSTypeDefinition.COMPLEX_TYPE) { +block |= ((XSComplexTypeDecl) elemType).fBlock
svn commit: r1129316 - /xerces/java/trunk/src/org/apache/xerces/impl/xpath/regex/ParserForXMLSchema.java
Author: knoaman Date: Mon May 30 19:31:20 2011 New Revision: 1129316 URL: http://svn.apache.org/viewvc?rev=1129316view=rev Log: Fixing Jira bug XERCESJ-1514 (https://issues.apache.org/jira/browse/XERCESJ-1514). Modified: xerces/java/trunk/src/org/apache/xerces/impl/xpath/regex/ParserForXMLSchema.java Modified: xerces/java/trunk/src/org/apache/xerces/impl/xpath/regex/ParserForXMLSchema.java URL: http://svn.apache.org/viewvc/xerces/java/trunk/src/org/apache/xerces/impl/xpath/regex/ParserForXMLSchema.java?rev=1129316r1=1129315r2=1129316view=diff == --- xerces/java/trunk/src/org/apache/xerces/impl/xpath/regex/ParserForXMLSchema.java (original) +++ xerces/java/trunk/src/org/apache/xerces/impl/xpath/regex/ParserForXMLSchema.java Mon May 30 19:31:20 2011 @@ -249,7 +249,7 @@ class ParserForXMLSchema extends RegexPa if (c == ']') throw this.ex(parser.cc.7, this.offset-2); if (c == '-' this.chardata != ']' !firstloop) throw this.ex(parser.cc.8, this.offset-2); // if regex = '[-]' then invalid } -if (this.read() != T_CHAR || this.chardata != '-' || c == '-' firstloop) { // Here is no '-'. +if (this.read() != T_CHAR || this.chardata != '-' || c == '-' !wasDecoded firstloop) { // Here is no '-'. if (!this.isSet(RegularExpression.IGNORE_CASE) || c 0x) { tok.addRange(c, c); } - To unsubscribe, e-mail: commits-unsubscr...@xerces.apache.org For additional commands, e-mail: commits-h...@xerces.apache.org
svn commit: r1129322 - /xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xpath/regex/ParserForXMLSchema.java
Author: knoaman Date: Mon May 30 19:49:07 2011 New Revision: 1129322 URL: http://svn.apache.org/viewvc?rev=1129322view=rev Log: Fixing Jira bug XERCESJ-1514 (https://issues.apache.org/jira/browse/XERCESJ-1514). Modified: xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xpath/regex/ParserForXMLSchema.java 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=1129322r1=1129321r2=1129322view=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 Mon May 30 19:49:07 2011 @@ -249,7 +249,7 @@ class ParserForXMLSchema extends RegexPa if (c == ']') throw this.ex(parser.cc.7, this.offset-2); if (c == '-' this.chardata != ']' !firstloop) throw this.ex(parser.cc.8, this.offset-2); // if regex = '[-]' then invalid } -if (this.read() != T_CHAR || this.chardata != '-' || c == '-' firstloop) { // Here is no '-'. +if (this.read() != T_CHAR || this.chardata != '-' || c == '-' !wasDecoded firstloop) { // Here is no '-'. if (!this.isSet(RegularExpression.IGNORE_CASE) || c 0x) { tok.addRange(c, c); } - To unsubscribe, e-mail: commits-unsubscr...@xerces.apache.org For additional commands, e-mail: commits-h...@xerces.apache.org
svn commit: r1082533 - /xerces/java/trunk/src/org/apache/xerces/impl/xs/SchemaGrammar.java
Author: knoaman Date: Thu Mar 17 15:22:26 2011 New Revision: 1082533 URL: http://svn.apache.org/viewvc?rev=1082533view=rev Log: Fix for JIRA bug https://issues.apache.org/jira/browse/XERCESJ-1500 Modified: xerces/java/trunk/src/org/apache/xerces/impl/xs/SchemaGrammar.java Modified: xerces/java/trunk/src/org/apache/xerces/impl/xs/SchemaGrammar.java URL: http://svn.apache.org/viewvc/xerces/java/trunk/src/org/apache/xerces/impl/xs/SchemaGrammar.java?rev=1082533r1=1082532r2=1082533view=diff == --- xerces/java/trunk/src/org/apache/xerces/impl/xs/SchemaGrammar.java (original) +++ xerces/java/trunk/src/org/apache/xerces/impl/xs/SchemaGrammar.java Thu Mar 17 15:22:26 2011 @@ -234,7 +234,7 @@ public class SchemaGrammar implements XS fRedefinedGroupDecls = new XSGroupDecl[grammar.fRedefinedGroupDecls.length]; fRGLocators = new SimpleLocator[grammar.fRGLocators.length]; System.arraycopy(grammar.fRedefinedGroupDecls, 0, fRedefinedGroupDecls, 0, fRGCount); -System.arraycopy(grammar.fRGLocators, 0, fRGLocators, 0, fRGCount); +System.arraycopy(grammar.fRGLocators, 0, fRGLocators, 0, fRGCount/2); } // List of imported grammars - To unsubscribe, e-mail: commits-unsubscr...@xerces.apache.org For additional commands, e-mail: commits-h...@xerces.apache.org
svn commit: r1070524 - in /xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl: validation/ConfigurableValidationState.java validation/ValidationState.java xs/IDContext.java xs/XMLSchem
Author: knoaman Date: Mon Feb 14 15:33:49 2011 New Revision: 1070524 URL: http://svn.apache.org/viewvc?rev=1070524view=rev Log: Handle duplicate ID values - XML Schema 1.1 allows an element to have multiple attributes of type ID. More than one attribute can have the same ID value which is not considered a duplicate. - From XML Schema 1.0 (clarified in 1.1), child elements with simple type ID can have the same value (which identifies the parent element), and these values are not considered duplicate Added: xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/IDContext.java (with props) xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/XSValidationState.java (with props) Modified: xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/validation/ConfigurableValidationState.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/xs/XMLSchemaValidator.java Modified: xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/validation/ConfigurableValidationState.java URL: http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/validation/ConfigurableValidationState.java?rev=1070524r1=1070523r2=1070524view=diff == --- xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/validation/ConfigurableValidationState.java (original) +++ xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/validation/ConfigurableValidationState.java Mon Feb 14 15:33:49 2011 @@ -26,12 +26,12 @@ package org.apache.xerces.impl.validatio * @author Peter McCracken, IBM * @version $Id$ */ -public final class ConfigurableValidationState extends ValidationState { +public class ConfigurableValidationState extends ValidationState { /** * Whether to check for ID/IDREF errors */ -private boolean fIdIdrefChecking; +protected boolean fIdIdrefChecking; /** * Whether to check for unparsed entity errors @@ -54,7 +54,7 @@ public final class ConfigurableValidatio * @param setting true to turn on error checking, * false to turn off error checking */ -public void setIdIdrefChecking(boolean setting) { +public final void setIdIdrefChecking(boolean setting) { fIdIdrefChecking = setting; } @@ -63,7 +63,7 @@ public final class ConfigurableValidatio * @param setting true to turn on error checking, * false to turn off error checking */ -public void setUnparsedEntityChecking(boolean setting) { +public final void setUnparsedEntityChecking(boolean setting) { fUnparsedEntityChecking = setting; } @@ -72,7 +72,7 @@ public final class ConfigurableValidatio * @return null, if ID/IDREF checking is turned off * otherwise, returns the value of the super implementation */ -public String checkIDRefID() { +public final String checkIDRefID() { return (fIdIdrefChecking) ? super.checkIDRefID() : null; } @@ -90,7 +90,7 @@ public final class ConfigurableValidatio * @return true, if unparsed entity checking is turned off * otherwise, returns the value of the super implementation */ -public boolean isEntityDeclared(String name) { +public final boolean isEntityDeclared(String name) { return (fUnparsedEntityChecking) ? super.isEntityDeclared(name) : true; } @@ -99,7 +99,7 @@ public final class ConfigurableValidatio * @return true, if unparsed entity checking is turned off * otherwise, returns the value of the super implementation */ -public boolean isEntityUnparsed(String name) { +public final boolean isEntityUnparsed(String name) { return (fUnparsedEntityChecking) ? super.isEntityUnparsed(name) : true; } @@ -117,7 +117,7 @@ public final class ConfigurableValidatio * Adds the IDREF, if ID/IDREF checking is enabled. * @param name the IDREF to add */ -public void addIdRef(String name) { +public final void addIdRef(String name) { if (fIdIdrefChecking) { super.addIdRef(name); } 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=1070524r1=1070523r2=1070524view=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
svn commit: r1060530 - in /xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs: SchemaGrammar.java traversers/XSDHandler.java
Author: knoaman Date: Tue Jan 18 18:46:56 2011 New Revision: 1060530 URL: http://svn.apache.org/viewvc?rev=1060530view=rev Log: Allow reference to xsi attribute in schema documents (per XML Schema 1.1). Ref, the recent discussion on xerces-dev list - http://markmail.org/message/sjo34dqenmhyzeno. Modified: xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/SchemaGrammar.java xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/traversers/XSDHandler.java Modified: xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/SchemaGrammar.java URL: http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/SchemaGrammar.java?rev=1060530r1=1060529r2=1060530view=diff == --- xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/SchemaGrammar.java (original) +++ xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/SchemaGrammar.java Tue Jan 18 18:46:56 2011 @@ -1362,6 +1362,7 @@ public class SchemaGrammar implements XS // the grammars to hold components of the schema-instance namespace public final static BuiltinSchemaGrammar SG_XSI = new BuiltinSchemaGrammar(GRAMMAR_XSI, Constants.SCHEMA_VERSION_1_0); +private final static BuiltinSchemaGrammar SG_XSI11 = new BuiltinSchemaGrammar(GRAMMAR_XSI, Constants.SCHEMA_VERSION_1_1); public static SchemaGrammar getS4SGrammar(short schemaVersion) { if (schemaVersion == Constants.SCHEMA_VERSION_1_0) { @@ -1373,6 +1374,14 @@ public class SchemaGrammar implements XS return SG_SchemaNSExtended; } + +public static SchemaGrammar getXSIGrammar(short schemaVersion) { +if (schemaVersion == Constants.SCHEMA_VERSION_1_1) { +return SG_XSI11; +} + +return SG_XSI; +} static final XSComplexTypeDecl[] resize(XSComplexTypeDecl[] oldArray, int newSize) { XSComplexTypeDecl[] newArray = new XSComplexTypeDecl[newSize]; 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=1060530r1=1060529r2=1060530view=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 Tue Jan 18 18:46:56 2011 @@ -1793,6 +1793,17 @@ public class XSDHandler { } } +// XML Schema 1.1 allows reference to xsi attributes +if (fSchemaVersion == Constants.SCHEMA_VERSION_1_1 +declType == ATTRIBUTE_TYPE +declToTraverse.uri == SchemaSymbols.URI_XSI) { +SchemaGrammar xsiGrammar = SchemaGrammar.getXSIGrammar(fSchemaVersion); +Object retObj = xsiGrammar.getGlobalAttributeDecl(declToTraverse.localpart); +if (retObj != null) { +return retObj; +} +} + // now check whether this document can access the requsted namespace if (!currSchema.isAllowedNS(declToTraverse.uri)) { // cannot get to this schema from the one containing the requesting decl - To unsubscribe, e-mail: commits-unsubscr...@xerces.apache.org For additional commands, e-mail: commits-h...@xerces.apache.org
svn commit: r1058581 - in /xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl: msg/XMLSchemaMessages.properties xs/traversers/XSDComplexTypeTraverser.java
Author: knoaman Date: Thu Jan 13 14:29:18 2011 New Revision: 1058581 URL: http://svn.apache.org/viewvc?rev=1058581view=rev Log: Schema Representation Constraint: Complex Type Definition Representation OK 4. If the complexContent alternative is chosen and the mixed [attribute] is present on both complexType and complexContent, then actual values of those [attributes] must be the same. Modified: xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/msg/XMLSchemaMessages.properties xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/traversers/XSDComplexTypeTraverser.java Modified: xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/msg/XMLSchemaMessages.properties URL: http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/msg/XMLSchemaMessages.properties?rev=1058581r1=1058580r2=1058581view=diff == --- xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/msg/XMLSchemaMessages.properties (original) +++ xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/msg/XMLSchemaMessages.properties Thu Jan 13 14:29:18 2011 @@ -132,6 +132,7 @@ src-ct.4 = src-ct.4: Complex Type Definition Representation Error for type ''{0}''. The intersection of wildcards is not expressible. src-ct.5 = src-ct.5: Complex Type Definition Representation Error for type ''{0}''. The union of wildcards is not expressible. src-ct.6 = src-ct.5: Complex Type Definition Representation Error for type ''{0}''. If openContent is present and the actual value of its mode [attribute] is not 'none', then there must be an any among the [children] of openContent. +src-ct11.4 = src-ct11.4: Complex Type Definition Representation Error for type ''{0}''. If the complexContent alternative is chosen and the 'mixed' attribute is present on both complexType and complexContent, then the actual values of those attributes must be the same. src-element.1 = src-element.1: The properties ''default'' and ''fixed'' cannot both be present in element declaration ''{0}''. Use only one of them. src-element.2.1 = src-element.2.1: : One of 'ref' or 'name' must be present in a local element declaration. src-element.2.2 = src-element.2.2: Since ''{0}'' contains the ''ref'' attribute, its content must match (annotation?). However, ''{1}'' was found. 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=1058581r1=1058580r2=1058581view=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 Jan 13 14:29:18 2011 @@ -435,8 +435,10 @@ class XSDComplexTypeTraverser extends X } else if (DOMUtil.getLocalName(child).equals (SchemaSymbols.ELT_COMPLEXCONTENT)) { +final boolean mixedAttPresent = (fSchemaHandler.fSchemaVersion == Constants.SCHEMA_VERSION_1_1) +? DOMUtil.getAttr(complexTypeDecl, SchemaSymbols.ATT_MIXED) != null : false; traverseComplexContent(child, mixedAtt.booleanValue(), -schemaDoc, grammar); +mixedAttPresent, schemaDoc, grammar); Element elemTmp = DOMUtil.getNextSiblingElement(child); if (elemTmp != null) { String siblingName = DOMUtil.getLocalName(elemTmp); @@ -885,8 +887,8 @@ class XSDComplexTypeTraverser extends X } private void traverseComplexContent(Element complexContentElement, -boolean mixedOnType, XSDocumentInfo schemaDoc, -SchemaGrammar grammar) +boolean mixedOnType, boolean mixedOnTypePresent, +XSDocumentInfo schemaDoc, SchemaGrammar grammar) throws ComplexTypeRecoverableError { Object[] complexContentAttrValues = fAttrChecker.checkAttributes(complexContentElement, false, @@ -899,6 +901,11 @@ class XSDComplexTypeTraverser extends X Boolean mixedAtt = (Boolean) complexContentAttrValues[XSAttributeChecker.ATTIDX_MIXED]; if (mixedAtt != null) { mixedContent = mixedAtt.booleanValue(); +if (mixedOnTypePresent mixedContent != mixedOnType) { +fAttrChecker.returnAttrArray(complexContentAttrValues, schemaDoc); +throw new ComplexTypeRecoverableError(src-ct11.4, +new Object[]{fName}, complexContentElement
svn commit: r1058584 - in /xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl: msg/XMLSchemaMessages.properties xs/traversers/XSDComplexTypeTraverser.java
Author: knoaman Date: Thu Jan 13 14:42:22 2011 New Revision: 1058584 URL: http://svn.apache.org/viewvc?rev=1058584view=rev Log: Schema Representation Constraint: Complex Type Definition Representation OK 3. If openContent is present and has mode = 'none', then there must not be an any among the [children] of openContent Modified: xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/msg/XMLSchemaMessages.properties xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/traversers/XSDComplexTypeTraverser.java Modified: xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/msg/XMLSchemaMessages.properties URL: http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/msg/XMLSchemaMessages.properties?rev=1058584r1=1058583r2=1058584view=diff == --- xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/msg/XMLSchemaMessages.properties (original) +++ xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/msg/XMLSchemaMessages.properties Thu Jan 13 14:42:22 2011 @@ -132,6 +132,7 @@ src-ct.4 = src-ct.4: Complex Type Definition Representation Error for type ''{0}''. The intersection of wildcards is not expressible. src-ct.5 = src-ct.5: Complex Type Definition Representation Error for type ''{0}''. The union of wildcards is not expressible. src-ct.6 = src-ct.5: Complex Type Definition Representation Error for type ''{0}''. If openContent is present and the actual value of its mode [attribute] is not 'none', then there must be an any among the [children] of openContent. +src-ct11.3 = src-ct11.3: Complex Type Definition Representation Error for type ''{0}''. If openContent is present and has mode = 'none', then there must not be an any among the [children] of openContent. src-ct11.4 = src-ct11.4: Complex Type Definition Representation Error for type ''{0}''. If the complexContent alternative is chosen and the 'mixed' attribute is present on both complexType and complexContent, then the actual values of those attributes must be the same. src-element.1 = src-element.1: The properties ''default'' and ''fixed'' cannot both be present in element declaration ''{0}''. Use only one of them. src-element.2.1 = src-element.2.1: : One of 'ref' or 'name' must be present in a local element declaration. 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=1058584r1=1058583r2=1058584view=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 Jan 13 14:42:22 2011 @@ -316,6 +316,10 @@ class XSDComplexTypeTraverser extends X Object[] wcAttrValues = fAttrChecker.checkAttributes(child, false, schemaDoc); ocDecl.fWildcard = fSchemaHandler.fWildCardTraverser.traverseWildcardDecl(child, wcAttrValues, schemaDoc, grammar); fAttrChecker.returnAttrArray(wcAttrValues, schemaDoc); +if (ocMode == XSOpenContentDecl.MODE_NONE) { +ocDecl.fWildcard = null; +reportSchemaError(src-ct11.3, new Object[]{fName}, elmNode); +} } fAttrChecker.returnAttrArray(attrValues, schemaDoc); - To unsubscribe, e-mail: commits-unsubscr...@xerces.apache.org For additional commands, e-mail: commits-h...@xerces.apache.org
svn commit: r1036152 - in /xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl: msg/XMLSchemaMessages.properties xs/traversers/XSDHandler.java xs/traversers/override/DOMOverrideImpl.jav
Author: knoaman Date: Wed Nov 17 18:15:40 2010 New Revision: 1036152 URL: http://svn.apache.org/viewvc?rev=1036152view=rev Log: Fix couple of bugs in xs:override implementation Modified: xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/msg/XMLSchemaMessages.properties 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/override/DOMOverrideImpl.java Modified: xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/msg/XMLSchemaMessages.properties URL: http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/msg/XMLSchemaMessages.properties?rev=1036152r1=1036151r2=1036152view=diff == --- xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/msg/XMLSchemaMessages.properties (original) +++ xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/msg/XMLSchemaMessages.properties Wed Nov 17 18:15:40 2010 @@ -148,6 +148,8 @@ src-import.3.1 = src-import.3.1: The namespace attribute, ''{0}'', of an import element information item must be identical to the targetNamespace attribute, ''{1}'', of the imported document. src-import.3.2 = src-import.3.2: An import element information item that had no namespace attribute was found, so the imported document cannot have a targetNamespace attribute. However, the targetNamespace ''{1}'' was found in the imported document. src-include.1 = src-include.1: The root element of document ''{0}'' has to have the namespace name ''http://www.w3.org/2001/XMLSchema'' and the local name ''schema''. +src-override.2.1 = src-override.2.1: The targetNamespace of the overridden schema, currently ''{1}'', must be identical to that of the overriding schema, currently ''{0}''. +src-override-transformation.1 = src-override-transformation.1: A ''{0}'' definition with the name ''{2}'' cannot override a ''{1}'' definition with the same name. src-override-collision.1 = src-override-collision.1: The schema id ''{0}'' referenced by {1} is colliding with an already overridden schema. Referenced schema is being ignored. src-override-collision.2 = src-override-collision.2: The override transformation of schema id ''{0}'' collides with an existing schema that was previously included, redefined, or overridden. Transformed schema is being ignored and override will not take place. src-include.2.1 = src-include.2.1: The targetNamespace of the referenced schema, currently ''{1}'', must be identical to that of the including schema, currently ''{0}''. 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=1036152r1=1036151r2=1036152view=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 Wed Nov 17 18:15:40 2010 @@ -805,7 +805,8 @@ public class XSDHandler { {TargetNamespace.1, TargetNamespace.2}, {TargetNamespace.1, TargetNamespace.2}, {TargetNamespace.1, TargetNamespace.2}, -{TargetNamespace.1, TargetNamespace.2} +{TargetNamespace.1, TargetNamespace.2}, +{src-override.2.1, src-override.2.1}, }; private static final String[] ELE_ERROR_CODES = { Modified: xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/traversers/override/DOMOverrideImpl.java URL: http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/traversers/override/DOMOverrideImpl.java?rev=1036152r1=1036151r2=1036152view=diff == --- xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/traversers/override/DOMOverrideImpl.java (original) +++ xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/traversers/override/DOMOverrideImpl.java Wed Nov 17 18:15:40 2010 @@ -163,6 +163,16 @@ public final class DOMOverrideImpl exten Element oldNode = child; //check if element needs to be overridden if (newNode != null){ +if (componentType == OVERRIDE_TYPE_DEFINITION) { +final String overridingLocalName = getLocalName(newNode.originalElement); +if (!localName.equals(overridingLocalName)) { + fSchemaHandler.reportSchemaError(src
svn commit: r1036217 - /xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/traversers/override/DOMOverrideImpl.java
Author: knoaman Date: Wed Nov 17 20:43:35 2010 New Revision: 1036217 URL: http://svn.apache.org/viewvc?rev=1036217view=rev Log: Fixing another bug in xs:override where we did not report an error for duplicate children components Modified: xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/traversers/override/DOMOverrideImpl.java Modified: xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/traversers/override/DOMOverrideImpl.java URL: http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/traversers/override/DOMOverrideImpl.java?rev=1036217r1=1036216r2=1036217view=diff == --- xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/traversers/override/DOMOverrideImpl.java (original) +++ xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/traversers/override/DOMOverrideImpl.java Wed Nov 17 20:43:35 2010 @@ -18,6 +18,7 @@ package org.apache.xerces.impl.xs.traversers.override; import java.util.ArrayList; +import java.util.HashMap; import java.util.Iterator; import org.apache.xerces.impl.xs.SchemaSymbols; @@ -38,6 +39,10 @@ public final class DOMOverrideImpl exten // records all the override schema components and it's properties private final ArrayList fOverrideComponents = new ArrayList(); +private final HashMap[] fOverrideComponentsMap = new HashMap[] { +null, new HashMap(), new HashMap(), new HashMap(), +new HashMap(), new HashMap(), new HashMap() +}; // overridden schema document private Document fOverridenDoc; @@ -78,6 +83,9 @@ public final class DOMOverrideImpl exten public void clearState(){ fOverrideComponents.clear(); +for (int i=1; i fOverrideComponentsMap.length; i++) { +fOverrideComponentsMap[i].clear(); +} fOverridenDoc = null; fOverrideElem = null; hasPerformedTransformations = false; @@ -214,9 +222,16 @@ public final class DOMOverrideImpl exten * Create a new OverrideElemnt and record it into override components */ private void addOverrideElement(int componentType, Element elem) { -String cName = DOMUtil.getAttrValue(elem, SchemaSymbols.ATT_NAME); -OverrideElement e = new OverrideElement(componentType, elem,cName); -fOverrideComponents.add(e); +final String cName = DOMUtil.getAttrValue(elem, SchemaSymbols.ATT_NAME); +final HashMap cMap = fOverrideComponentsMap[componentType]; +if (cMap.get(cName) != null) { +fSchemaHandler.reportSchemaError(sch-props-correct.2, new Object []{cName}, elem); +} +else { +OverrideElement e = new OverrideElement(componentType, elem,cName); +fOverrideComponents.add(e); +cMap.put(cName, e); +} } /** - To unsubscribe, e-mail: commits-unsubscr...@xerces.apache.org For additional commands, e-mail: commits-h...@xerces.apache.org
svn commit: r1033652 - in /xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl: msg/ xs/ xs/traversers/ xs/traversers/override/ xs/traversers/override/exception/
Author: knoaman Date: Wed Nov 10 19:19:05 2010 New Revision: 1033652 URL: http://svn.apache.org/viewvc?rev=1033652view=rev Log: Implementation of xs:override by Udayanga Wickramasinghe (with some minor changes). Jira bug: https://issues.apache.org/jira/browse/XERCESJ-1433 Added: xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/traversers/override/ xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/traversers/override/DOMOverrideImpl.java (with props) xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/traversers/override/OverrideTransformationManager.java (with props) xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/traversers/override/OverrideTransformer.java (with props) xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/traversers/override/exception/ xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/traversers/override/exception/OverrideTransformException.java (with props) Modified: xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/msg/XMLSchemaMessages.properties 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/XSDDescription.java xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/traversers/XSAttributeChecker.java xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/traversers/XSDHandler.java Modified: xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/msg/XMLSchemaMessages.properties URL: http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/msg/XMLSchemaMessages.properties?rev=1033652r1=1033651r2=1033652view=diff == --- xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/msg/XMLSchemaMessages.properties (original) +++ xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/msg/XMLSchemaMessages.properties Wed Nov 10 19:19:05 2010 @@ -148,6 +148,8 @@ src-import.3.1 = src-import.3.1: The namespace attribute, ''{0}'', of an import element information item must be identical to the targetNamespace attribute, ''{1}'', of the imported document. src-import.3.2 = src-import.3.2: An import element information item that had no namespace attribute was found, so the imported document cannot have a targetNamespace attribute. However, the targetNamespace ''{1}'' was found in the imported document. src-include.1 = src-include.1: The root element of document ''{0}'' has to have the namespace name ''http://www.w3.org/2001/XMLSchema'' and the local name ''schema''. +src-override-collision.1 = src-override-collision.1: The schema id ''{0}'' referenced by {1} is colliding with an already overridden schema. Referenced schema is being ignored. +src-override-collision.2 = src-override-collision.2: The override transformation of schema id ''{0}'' collides with an existing schema that was previously included, redefined, or overridden. Transformed schema is being ignored and override will not take place. src-include.2.1 = src-include.2.1: The targetNamespace of the referenced schema, currently ''{1}'', must be identical to that of the including schema, currently ''{0}''. src-redefine.2 = src-redefine.2: The root element of document ''{0}'' has to have the namespace name ''http://www.w3.org/2001/XMLSchema'' and the local name ''schema''. src-redefine.3.1 = src-redefine.3.1: The targetNamespace of the referenced schema, currently ''{1}'', must be identical to that of the redefining schema, currently ''{0}''. 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=1033652r1=1033651r2=1033652view=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 Wed Nov 10 19:19:05 2010 @@ -90,6 +90,7 @@ public final class SchemaSymbols { public static final String ELT_MINSCALE = minScale.intern(); public static final String ELT_NOTATION = notation.intern(); public static final String ELT_OPENCONTENT= openContent.intern(); +public static final String ELT_OVERRIDE = override.intern(); public static final String ELT_PATTERN= pattern.intern(); public static final String ELT_REDEFINE = redefine.intern(); public static final String
svn commit: r1033661 - /xerces/java/trunk/src/org/apache/xerces/impl/xpath/regex/RegexParser.java
Author: knoaman Date: Wed Nov 10 19:31:44 2010 New Revision: 1033661 URL: http://svn.apache.org/viewvc?rev=1033661view=rev Log: Fix for Backreference processing in RegEx. Jira Bug: https://issues.apache.org/jira/browse/XERCESJ-1473 Modified: xerces/java/trunk/src/org/apache/xerces/impl/xpath/regex/RegexParser.java Modified: xerces/java/trunk/src/org/apache/xerces/impl/xpath/regex/RegexParser.java URL: http://svn.apache.org/viewvc/xerces/java/trunk/src/org/apache/xerces/impl/xpath/regex/RegexParser.java?rev=1033661r1=1033660r2=1033661view=diff == --- xerces/java/trunk/src/org/apache/xerces/impl/xpath/regex/RegexParser.java (original) +++ xerces/java/trunk/src/org/apache/xerces/impl/xpath/regex/RegexParser.java Wed Nov 10 19:31:44 2010 @@ -471,7 +471,7 @@ class RegexParser { while (this.offset + 1 this.regexlen) { ch = this.regex.charAt(this.offset + 1); -if ('1' = ch ch = '9') { +if ('0' = ch ch = '9') { refno = (refno * 10) + (ch - '0'); if (refno this.parennumber) { finalRefno= refno; @@ -604,7 +604,7 @@ class RegexParser { while (this.offset this.regexlen) { final int ch = this.regex.charAt(this.offset); -if ('1' = ch ch = '9') { +if ('0' = ch ch = '9') { refnum = (refnum * 10) + (ch - '0'); if (refnum this.parennumber) { ++this.offset; - To unsubscribe, e-mail: commits-unsubscr...@xerces.apache.org For additional commands, e-mail: commits-h...@xerces.apache.org
svn commit: r1033662 - /xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xpath/regex/RegexParser.java
Author: knoaman Date: Wed Nov 10 19:32:22 2010 New Revision: 1033662 URL: http://svn.apache.org/viewvc?rev=1033662view=rev Log: Fix for Backreference processing in RegEx. Jira Bug: https://issues.apache.org/jira/browse/XERCESJ-1473 Modified: xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xpath/regex/RegexParser.java Modified: xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xpath/regex/RegexParser.java URL: http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xpath/regex/RegexParser.java?rev=1033662r1=1033661r2=1033662view=diff == --- xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xpath/regex/RegexParser.java (original) +++ xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xpath/regex/RegexParser.java Wed Nov 10 19:32:22 2010 @@ -471,7 +471,7 @@ class RegexParser { while (this.offset + 1 this.regexlen) { ch = this.regex.charAt(this.offset + 1); -if ('1' = ch ch = '9') { +if ('0' = ch ch = '9') { refno = (refno * 10) + (ch - '0'); if (refno this.parennumber) { finalRefno= refno; @@ -604,7 +604,7 @@ class RegexParser { while (this.offset this.regexlen) { final int ch = this.regex.charAt(this.offset); -if ('1' = ch ch = '9') { +if ('0' = ch ch = '9') { refnum = (refnum * 10) + (ch - '0'); if (refnum this.parennumber) { ++this.offset; - To unsubscribe, e-mail: commits-unsubscr...@xerces.apache.org For additional commands, e-mail: commits-h...@xerces.apache.org
svn commit: r985524 - in /xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs: BaseSchemaDVFactory.java Schema11DVFactoryImpl.java SchemaDVFactoryImpl.java
Author: knoaman Date: Sat Aug 14 16:16:36 2010 New Revision: 985524 URL: http://svn.apache.org/viewvc?rev=985524view=rev Log: ENTITIES, IDREFS, NMTOKENS have anyAtomicType as base in XML Schema 1.1 Modified: xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/BaseSchemaDVFactory.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/SchemaDVFactoryImpl.java Modified: xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/BaseSchemaDVFactory.java URL: http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/BaseSchemaDVFactory.java?rev=985524r1=985523r2=985524view=diff == --- xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/BaseSchemaDVFactory.java (original) +++ xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/BaseSchemaDVFactory.java Sat Aug 14 16:16:36 2010 @@ -220,31 +220,31 @@ public abstract class BaseSchemaDVFactor XSSimpleTypeDecl idrefDV = new XSSimpleTypeDecl(ncnameDV, IDREF , XSSimpleTypeDecl.DV_IDREF, XSSimpleType.ORDERED_FALSE, false, false, false, true, XSConstants.IDREF_DT); builtInTypes.put(IDREF, idrefDV); -facets.minLength = 1; +/*facets.minLength = 1; XSSimpleTypeDecl tempDV = new XSSimpleTypeDecl(null, URI_SCHEMAFORSCHEMA, (short)0, idrefDV, true, null); XSSimpleTypeDecl idrefsDV = new XSSimpleTypeDecl(tempDV, IDREFS, URI_SCHEMAFORSCHEMA, (short)0, false, null); idrefsDV.applyFacets1(facets, XSSimpleType.FACET_MINLENGTH, (short)0); -builtInTypes.put(IDREFS, idrefsDV); +builtInTypes.put(IDREFS, idrefsDV);*/ XSSimpleTypeDecl entityDV = new XSSimpleTypeDecl(ncnameDV, ENTITY , XSSimpleTypeDecl.DV_ENTITY, XSSimpleType.ORDERED_FALSE, false, false, false, true, XSConstants.ENTITY_DT); builtInTypes.put(ENTITY, entityDV); -facets.minLength = 1; +/*facets.minLength = 1; tempDV = new XSSimpleTypeDecl(null, URI_SCHEMAFORSCHEMA, (short)0, entityDV, true, null); XSSimpleTypeDecl entitiesDV = new XSSimpleTypeDecl(tempDV, ENTITIES, URI_SCHEMAFORSCHEMA, (short)0, false, null); entitiesDV.applyFacets1(facets, XSSimpleType.FACET_MINLENGTH, (short)0); -builtInTypes.put(ENTITIES, entitiesDV); +builtInTypes.put(ENTITIES, entitiesDV);*/ facets.whiteSpace = XSSimpleType.WS_COLLAPSE; XSSimpleTypeDecl nmtokenDV = new XSSimpleTypeDecl(tokenDV, NMTOKEN, URI_SCHEMAFORSCHEMA, (short)0, false, null, XSConstants.NMTOKEN_DT); nmtokenDV.applyFacets1(facets, XSSimpleType.FACET_WHITESPACE, (short)0, XSSimpleTypeDecl.SPECIAL_PATTERN_NMTOKEN); builtInTypes.put(NMTOKEN, nmtokenDV); -facets.minLength = 1; +/*facets.minLength = 1; tempDV = new XSSimpleTypeDecl(null, URI_SCHEMAFORSCHEMA, (short)0, nmtokenDV, true, null); XSSimpleTypeDecl nmtokensDV = new XSSimpleTypeDecl(tempDV, NMTOKENS, URI_SCHEMAFORSCHEMA, (short)0, false, null); nmtokensDV.applyFacets1(facets, XSSimpleType.FACET_MINLENGTH, (short)0); -builtInTypes.put(NMTOKENS, nmtokensDV); +builtInTypes.put(NMTOKENS, nmtokensDV);*/ } //createBuiltInTypes() /** 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=985524r1=985523r2=985524view=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 Sat Aug 14 16:16:36 2010 @@ -17,8 +17,10 @@ package org.apache.xerces.impl.dv.xs; +import org.apache.xerces.impl.dv.XSFacets; import org.apache.xerces.impl.dv.XSSimpleType; import org.apache.xerces.util.SymbolHash; +import org.apache.xerces.xs.XSConstants; /** * A special factory to create/return built-in schema DVs and create user-defined DVs @@ -47,6 +49,9 @@ public class Schema11DVFactoryImpl exten final String ERROR = error; final String DATETIMESTAMP = dateTimeStamp; final String DATETIME = dateTime; +final String ENTITIES = ENTITIES; +final String NMTOKENS = NMTOKENS; +final String IDREFS= IDREFS; createBuiltInTypes(fBuiltInTypes, XSSimpleTypeDecl.fAnyAtomicType); @@ -56,6 +61,26 @@ public class Schema11DVFactoryImpl exten // add error
svn commit: r985567 - /xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/Schema11DVFactoryImpl.java
Author: knoaman Date: Sat Aug 14 19:12:52 2010 New Revision: 985567 URL: http://svn.apache.org/viewvc?rev=985567view=rev Log: ENTITIES, IDREFS, NMTOKENS have anySimpleType as base in XML Schema 1.1 Modified: xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/Schema11DVFactoryImpl.java 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=985567r1=985566r2=985567view=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 Sat Aug 14 19:12:52 2010 @@ -50,8 +50,11 @@ public class Schema11DVFactoryImpl exten final String DATETIMESTAMP = dateTimeStamp; final String DATETIME = dateTime; final String ENTITIES = ENTITIES; +final String ENTITY= ENTITY; final String NMTOKENS = NMTOKENS; +final String NMTOKEN = NMTOKEN; final String IDREFS= IDREFS; +final String IDREF = IDREF; createBuiltInTypes(fBuiltInTypes, XSSimpleTypeDecl.fAnyAtomicType); @@ -67,17 +70,20 @@ public class Schema11DVFactoryImpl exten facets.minLength = 1; // add ENTITIES -final XSSimpleTypeDecl entitiesDV = new XSSimpleTypeDecl(XSSimpleTypeDecl.fAnyAtomicType, ENTITIES, URI_SCHEMAFORSCHEMA, (short)0, false, null); +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); fBuiltInTypes.put(ENTITIES, entitiesDV); // add NMTOKENS -final XSSimpleTypeDecl nmtokensDV = new XSSimpleTypeDecl(XSSimpleTypeDecl.fAnyAtomicType, NMTOKENS, URI_SCHEMAFORSCHEMA, (short)0, false, null); +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); fBuiltInTypes.put(NMTOKENS, nmtokensDV); // add IDREFS -final XSSimpleTypeDecl idrefsDV = new XSSimpleTypeDecl(XSSimpleTypeDecl.fAnyAtomicType, IDREFS, URI_SCHEMAFORSCHEMA, (short)0, false, null); +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); fBuiltInTypes.put(IDREFS, idrefsDV); - To unsubscribe, e-mail: commits-unsubscr...@xerces.apache.org For additional commands, e-mail: commits-h...@xerces.apache.org
svn commit: r961928 - /xerces/java/trunk/src/org/apache/xerces/impl/xpath/regex/RegularExpression.java
Author: knoaman Date: Thu Jul 8 20:43:46 2010 New Revision: 961928 URL: http://svn.apache.org/viewvc?rev=961928view=rev Log: Fix for Jira bug 1456 (https://issues.apache.org/jira/browse/XERCESJ-1456) Modified: xerces/java/trunk/src/org/apache/xerces/impl/xpath/regex/RegularExpression.java Modified: xerces/java/trunk/src/org/apache/xerces/impl/xpath/regex/RegularExpression.java URL: http://svn.apache.org/viewvc/xerces/java/trunk/src/org/apache/xerces/impl/xpath/regex/RegularExpression.java?rev=961928r1=961927r2=961928view=diff == --- xerces/java/trunk/src/org/apache/xerces/impl/xpath/regex/RegularExpression.java (original) +++ xerces/java/trunk/src/org/apache/xerces/impl/xpath/regex/RegularExpression.java Thu Jul 8 20:43:46 2010 @@ -1190,16 +1190,12 @@ public class RegularExpression implement { // Saves current position to avoid zero-width repeats. final int id = op.getData(); -int previousOffset = con.offsets[id]; -if (previousOffset == offset) { +if (con.closureContexts[id].contains(offset)) { returned = true; break; } -con.offsets[id] = offset; -if (offset previousOffset) { -op = op.next; -break; -} + +con.closureContexts[id].addOffset(offset); } // fall through @@ -1329,9 +1325,6 @@ public class RegularExpression implement switch (op.type) { case Op.CLOSURE: -con.offsets[op.getData()] = offset; -// fall through - same behavior as Op.Question - case Op.QUESTION: if (retValue 0) { op = op.next; @@ -1978,13 +1971,49 @@ public class RegularExpression implement } } +static final class ClosureContext { + +int[] offsets = new int[4]; +int currentIndex = 0; + +boolean contains(int offset) { +for (int i=0; icurrentIndex;++i) { +if (offsets[i] == offset) { +return true; +} +} +return false; +} + +void reset() { +currentIndex = 0; +} + +void addOffset(int offset) { +// We do not check for duplicates, caller is responsible for that +if (currentIndex == offsets.length) { +offsets = expandOffsets(); +} +offsets[currentIndex++] = offset; +} + +private int[] expandOffsets() { +final int len = offsets.length; +final int newLen = len 1; +int[] newOffsets = new int[newLen]; + +System.arraycopy(offsets, 0, newOffsets, 0, currentIndex); +return newOffsets; +} +} + static final class Context { int start; int limit; int length; Match match; boolean inuse = false; -int[] offsets; +ClosureContext[] closureContexts; private StringTarget stringTarget; private CharArrayTarget charArrayTarget; @@ -1999,9 +2028,17 @@ public class RegularExpression implement this.length = this.limit-this.start; setInUse(true); this.match = null; -if (this.offsets == null || this.offsets.length != nofclosures) -this.offsets = new int[nofclosures]; -for (int i = 0; i nofclosures; i ++) this.offsets[i] = -1; +if (this.closureContexts == null || this.closureContexts.length != nofclosures) { +this.closureContexts = new ClosureContext[nofclosures]; +} +for (int i = 0; i nofclosures; i ++) { +if (this.closureContexts[i] == null) { +this.closureContexts[i] = new ClosureContext(); +} +else { +this.closureContexts[i].reset(); +} +} } void reset(CharacterIterator target, int start, int limit, int nofclosures) { - To unsubscribe, e-mail: commits-unsubscr...@xerces.apache.org For additional commands, e-mail: commits-h...@xerces.apache.org
svn commit: r961930 - /xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xpath/regex/RegularExpression.java
Author: knoaman Date: Thu Jul 8 20:48:58 2010 New Revision: 961930 URL: http://svn.apache.org/viewvc?rev=961930view=rev Log: Fix for Jira bug 1456 (https://issues.apache.org/jira/browse/XERCESJ-1456) Modified: xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xpath/regex/RegularExpression.java 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=961930r1=961929r2=961930view=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 Jul 8 20:48:58 2010 @@ -1190,16 +1190,12 @@ public class RegularExpression implement { // Saves current position to avoid zero-width repeats. final int id = op.getData(); -int previousOffset = con.offsets[id]; -if (previousOffset == offset) { +if (con.closureContexts[id].contains(offset)) { returned = true; break; } -con.offsets[id] = offset; -if (offset previousOffset) { -op = op.next; -break; -} + +con.closureContexts[id].addOffset(offset); } // fall through @@ -1329,9 +1325,6 @@ public class RegularExpression implement switch (op.type) { case Op.CLOSURE: -con.offsets[op.getData()] = offset; -// fall through - same behavior as Op.Question - case Op.QUESTION: if (retValue 0) { op = op.next; @@ -1978,13 +1971,49 @@ public class RegularExpression implement } } +static final class ClosureContext { + +int[] offsets = new int[4]; +int currentIndex = 0; + +boolean contains(int offset) { +for (int i=0; icurrentIndex;++i) { +if (offsets[i] == offset) { +return true; +} +} +return false; +} + +void reset() { +currentIndex = 0; +} + +void addOffset(int offset) { +// We do not check for duplicates, caller is responsible for that +if (currentIndex == offsets.length) { +offsets = expandOffsets(); +} +offsets[currentIndex++] = offset; +} + +private int[] expandOffsets() { +final int len = offsets.length; +final int newLen = len 1; +int[] newOffsets = new int[newLen]; + +System.arraycopy(offsets, 0, newOffsets, 0, currentIndex); +return newOffsets; +} +} + static final class Context { int start; int limit; int length; Match match; boolean inuse = false; -int[] offsets; +ClosureContext[] closureContexts; private StringTarget stringTarget; private CharArrayTarget charArrayTarget; @@ -1999,9 +2028,17 @@ public class RegularExpression implement this.length = this.limit-this.start; setInUse(true); this.match = null; -if (this.offsets == null || this.offsets.length != nofclosures) -this.offsets = new int[nofclosures]; -for (int i = 0; i nofclosures; i ++) this.offsets[i] = -1; +if (this.closureContexts == null || this.closureContexts.length != nofclosures) { +this.closureContexts = new ClosureContext[nofclosures]; +} +for (int i = 0; i nofclosures; i ++) { +if (this.closureContexts[i] == null) { +this.closureContexts[i] = new ClosureContext(); +} +else { +this.closureContexts[i].reset(); +} +} } void reset(CharacterIterator target, int start, int limit, int nofclosures) { - To unsubscribe, e-mail: commits-unsubscr...@xerces.apache.org For additional commands, e-mail: commits-h...@xerces.apache.org
svn commit: r949753 - /xerces/java/branches/xml-schema-1.1-dev/docs/faq-xs.xml
Author: knoaman Date: Mon May 31 14:24:44 2010 New Revision: 949753 URL: http://svn.apache.org/viewvc?rev=949753view=rev Log: Update minimum JDK level for PsychoPath Modified: xerces/java/branches/xml-schema-1.1-dev/docs/faq-xs.xml Modified: xerces/java/branches/xml-schema-1.1-dev/docs/faq-xs.xml URL: http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/docs/faq-xs.xml?rev=949753r1=949752r2=949753view=diff == --- xerces/java/branches/xml-schema-1.1-dev/docs/faq-xs.xml (original) +++ xerces/java/branches/xml-schema-1.1-dev/docs/faq-xs.xml Mon May 31 14:24:44 2010 @@ -82,7 +82,7 @@ v.validate(new StreamSource(args[0])); Xerces uses the jump href=http://wiki.eclipse.org/PsychoPathXPathProcessor;Eclipse/PsychoPath XPath 2.0 engine/jump. /p p - Xerces-J bundles a JDK 1.3 compliant PsychoPath XPath 2.0 JAR. Users must be aware that, the PsychoPath XPath 2.0 JAR that's bundled + Xerces-J bundles a JDK 1.4 compliant PsychoPath XPath 2.0 JAR. Users must be aware that, the PsychoPath XPath 2.0 JAR that's bundled with Apache Xerces-J, has somewhat less XPath 2.0 language compliance for W3C XPath 2.0 language. For a better XPath 2.0 build, for using with Xerces XML Schema 1.1 processing, users may choose to download the latest PsychoPath XPath 2.0 JAR from following locations: /p - To unsubscribe, e-mail: commits-unsubscr...@xerces.apache.org For additional commands, e-mail: commits-h...@xerces.apache.org
svn commit: r948954 - /xerces/java/trunk/docs/releases.xml
Author: knoaman Date: Thu May 27 19:06:48 2010 New Revision: 948954 URL: http://svn.apache.org/viewvc?rev=948954view=rev Log: Update release information in preparation for Xerces-J 2.10.0 Modified: xerces/java/trunk/docs/releases.xml Modified: xerces/java/trunk/docs/releases.xml URL: http://svn.apache.org/viewvc/xerces/java/trunk/docs/releases.xml?rev=948954r1=948953r2=948954view=diff == --- xerces/java/trunk/docs/releases.xml (original) +++ xerces/java/trunk/docs/releases.xml Thu May 27 19:06:48 2010 @@ -18,6 +18,135 @@ !-- $Id$ -- !DOCTYPE releases SYSTEM 'dtd/releases.dtd' releases + release version='ParserName; 2.10.0' + desc +p + This release fixes several bugs which were present in Xerces-J 2.9.1. + It also includes support for many XML Schema 1.1 features, as well as + a few enhancements and performance improvements. +/p + /desc + changes +add + note + Added support for Element jump href=http://www.w3.org/TR/ElementTraversal/;Traversal/jump + API (org.w3c.dom.ElementTraversal). + /note + submitter name='Michael Glavassevich'/ +/add +add + note + Added support for StAXSource as an input to SchemaFactory (JAXP 1.4) + /note + submitter name='Michael Glavassevich'/ +/add +add + note + Added support for StAXSource/StAXResult as an input/output to the JAXP Validator (JAXP 1.4) + /note + submitter name='Michael Glavassevich'/ +/add +add + note + Added support for StreamResult as an output to the JAXP Validator (JAXP 1.4) + /note + submitter name='Michael Glavassevich'/ +/add +add + note + Added support for specifying the validation root (whether it be an element declaration + or a type definition). + /note + submitter name='Michael Glavassevich'/ +/add +add + note + Added support for matching multi-digit back references (regular expressions). + /note + submitter name='Khaled Noaman'/ +/add +add + note + Added support for XML Schema 1.1 (refer to documentation for a list of features supported). + /note + submitter name='Khaled Noaman, Mukul Gandhi, Hiranya Jayathilaka, John Chan, Ken Cai'/ +/add +update + note + Improved XML Schema API usability by using java.util.List, java.util.Map and utility methods. + /note + submitter name='Michael Glavassevich'/ +/update +update + note + Improved performance by eliminating the excessive calls to XMLSchemaValidator.findSchemaGrammar() + when handling local elements with no namespace. + /note + submitter name='Michael Glavassevich'/ +/update +update + note + Improved recovery from schema loading errors. + /note + submitter name='Sandy Gao'/ +/update +update + note + Improved performance of ElementImpl.getBaseURI when the depth of the node to the document + root is longer + /note + submitter name='Ludger Bünger'/ +/update +fix + note + Fixed problems with regular expression matching where the parser would hang or cause a + stack overflow exception. + /note + submitter name='Khaled Noaman'/ +/fix +fix + note + Fixed a problem where the DOMParserImpl repeatedly overwrote text node child of an element + (rather than appending) when there are multiple text nodes in input. + /note + submitter name='Michael Glavassevich'/ +/fix +fix + note + Fixed an infinite loop in XMLScanner which could allow allows remote attackers to cause a + denial of service. + /note + submitter name='Michael Glavassevich'/ +/fix +fix + note + Fixed a bug in XSDateTime where getXMLGregorianCalendar() loses precision for fractional digits + and inserts timezones where there are none. + /note + submitter name='Michael Glavassevich'/ +/fix +fix + note + Fixed a bug in DOM where static textNode on AttrImpl breaks thread-safety, mutations of independant + documents from within a mutation listener, and introduces potential memory leaks. + /note + submitter name='Ludger Bünger'/ +/fix +fix + note + Fixed a bug SoftReferenceSymbolTable which was causing an infinite loop due to cyclical reference + in SREntry linked list. + /note + submitter name='Anli Shundi'/ +/fix +fix + note + Fixed various bugs and made various improvements. + /note + submitter name='Michael Glavassevich, Khaled Noaman, Ludger Bünger'/ +/fix + /changes + /release release version='ParserName; 2.9.1' desc p - To unsubscribe, e-mail: commits-unsubscr...@xerces.apache.org For additional commands, e-mail: commits-h
svn commit: r948966 - /xerces/java/branches/xml-schema-1.1-dev/tools/cupv10k-runtime.LICENSE.txt
Author: knoaman Date: Thu May 27 20:01:10 2010 New Revision: 948966 URL: http://svn.apache.org/viewvc?rev=948966view=rev Log: Add license notice for cupv10k-runtime.jar Added: xerces/java/branches/xml-schema-1.1-dev/tools/cupv10k-runtime.LICENSE.txt (with props) Added: xerces/java/branches/xml-schema-1.1-dev/tools/cupv10k-runtime.LICENSE.txt URL: http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/tools/cupv10k-runtime.LICENSE.txt?rev=948966view=auto == --- xerces/java/branches/xml-schema-1.1-dev/tools/cupv10k-runtime.LICENSE.txt (added) +++ xerces/java/branches/xml-schema-1.1-dev/tools/cupv10k-runtime.LICENSE.txt Thu May 27 20:01:10 2010 @@ -0,0 +1,19 @@ +CUP Parser Generator Copyright Notice, License, and Disclaimer + +Copyright 1996-1999 by Scott Hudson, Frank Flannery, C. Scott Ananian + +Permission to use, copy, modify, and distribute this software and its +documentation for any purpose and without fee is hereby granted, provided +that the above copyright notice appear in all copies and that both +the copyright notice and this permission notice and warranty disclaimer +appear in supporting documentation, and that the names of the authors +or their employers not be used in advertising or publicity pertaining +to distribution of the software without specific, written prior permission. + +The authors and their employers disclaim all warranties with regard to +this software, including all implied warranties of merchantability +and fitness. In no event shall the authors or their employers be liable +for any special, indirect or consequential damages or any damages +whatsoever resulting from loss of use, data or profits, whether in an action +of contract, negligence or other tortious action, arising out of or +in connection with the use or performance of this software. \ No newline at end of file Propchange: xerces/java/branches/xml-schema-1.1-dev/tools/cupv10k-runtime.LICENSE.txt -- svn:eol-style = native Propchange: xerces/java/branches/xml-schema-1.1-dev/tools/cupv10k-runtime.LICENSE.txt -- svn:keywords = Author Date Id Revision - To unsubscribe, e-mail: commits-unsubscr...@xerces.apache.org For additional commands, e-mail: commits-h...@xerces.apache.org
svn commit: r948970 - /xerces/java/branches/xml-schema-1.1-dev/tools/cupv10k-runtime.LICENSE.txt
Author: knoaman Date: Thu May 27 20:02:58 2010 New Revision: 948970 URL: http://svn.apache.org/viewvc?rev=948970view=rev Log: Add a new line at the end of the file Modified: xerces/java/branches/xml-schema-1.1-dev/tools/cupv10k-runtime.LICENSE.txt Modified: xerces/java/branches/xml-schema-1.1-dev/tools/cupv10k-runtime.LICENSE.txt URL: http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/tools/cupv10k-runtime.LICENSE.txt?rev=948970r1=948969r2=948970view=diff == --- xerces/java/branches/xml-schema-1.1-dev/tools/cupv10k-runtime.LICENSE.txt (original) +++ xerces/java/branches/xml-schema-1.1-dev/tools/cupv10k-runtime.LICENSE.txt Thu May 27 20:02:58 2010 @@ -16,4 +16,4 @@ and fitness. In no event shall the autho for any special, indirect or consequential damages or any damages whatsoever resulting from loss of use, data or profits, whether in an action of contract, negligence or other tortious action, arising out of or -in connection with the use or performance of this software. \ No newline at end of file +in connection with the use or performance of this software. - To unsubscribe, e-mail: commits-unsubscr...@xerces.apache.org For additional commands, e-mail: commits-h...@xerces.apache.org
svn commit: r949004 - /xerces/java/branches/xml-schema-1.1-dev/docs/faq-xs.xml
Author: knoaman Date: Thu May 27 21:33:14 2010 New Revision: 949004 URL: http://svn.apache.org/viewvc?rev=949004view=rev Log: Update FAQ to explain how validate against XML Schema 1.1 Modified: xerces/java/branches/xml-schema-1.1-dev/docs/faq-xs.xml Modified: xerces/java/branches/xml-schema-1.1-dev/docs/faq-xs.xml URL: http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/docs/faq-xs.xml?rev=949004r1=949003r2=949004view=diff == --- xerces/java/branches/xml-schema-1.1-dev/docs/faq-xs.xml (original) +++ xerces/java/branches/xml-schema-1.1-dev/docs/faq-xs.xml Thu May 27 21:33:14 2010 @@ -21,9 +21,24 @@ faq title=Usage qHow do I validate against XML schema?/q a - pIn this release, schema validation has been integrated with the + pXML Schema 1.0 validation has been integrated with the regular SAXParser and DOMParser classes. No special classes are required to parse documents that use a schema./p + pFor XML Schema 1.1 validation, you'll need to use the JAXP + validation API, using the XSD 1.1 Schema factory. Here's an example: /p + source +System.setProperty( +javax.xml.validation.SchemaFactory:http://www.w3.org/XML/XMLSchema/v1.1;, +org.apache.xerces.jaxp.validation.XMLSchema11Factory); +SchemaFactory sf = SchemaFactory.newInstance( +http://www.w3.org/XML/XMLSchema/v1.1;); +Schema s = sf.newSchema(new StreamSource(args[1])); +Validator v = s.newValidator(); +v.validate(new StreamSource(args[0])); + /source + pYou can also refer to the JAXP sample, SourceValidator, where you + can validate xml documents against 1.1 schemas by specifying the -xsd11 + flag when running the sample./p pEach document that uses XML Schema grammars must specify the location of the grammars it uses by using an xsi:schemaLocation attribute if they use namespaces, and an xsi:noNamespaceSchemaLocation attribute - To unsubscribe, e-mail: commits-unsubscr...@xerces.apache.org For additional commands, e-mail: commits-h...@xerces.apache.org
svn commit: r948040 - /xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/XMLSchemaValidator.java
Author: knoaman Date: Tue May 25 13:43:56 2010 New Revision: 948040 URL: http://svn.apache.org/viewvc?rev=948040view=rev Log: Fix for Jira bug: https://issues.apache.org/jira/browse/XERCESJ-1439 Modified: xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/XMLSchemaValidator.java 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=948040r1=948039r2=948040view=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 Tue May 25 13:43:56 2010 @@ -3561,6 +3561,19 @@ public class XMLSchemaValidator } // if the attribute is not specified, then apply the value constraint if (!isSpecified constType != XSConstants.VC_NONE) { + +// Apply extra checking rules (ID/IDREF/ENTITY) +final XSSimpleType attDV = currDecl.fType; +final boolean facetChecking = fValidationState.needFacetChecking(); +try { +fValidationState.setFacetChecking(false); +attDV.validate(fValidationState, defaultValue); +} +catch (InvalidDatatypeValueException idve) { +reportSchemaError(idve.getKey(), idve.getArgs()); +} +fValidationState.setFacetChecking(facetChecking); + attName = new QName(null, currDecl.fName, currDecl.fName, currDecl.fTargetNamespace); String normalized = (defaultValue != null) ? defaultValue.stringValue() : ; - To unsubscribe, e-mail: commits-unsubscr...@xerces.apache.org For additional commands, e-mail: commits-h...@xerces.apache.org
svn commit: r946257 [1/2] - /xerces/java/trunk/src/org/apache/xerces/impl/xpath/regex/RegularExpression.java
Author: knoaman Date: Wed May 19 16:17:53 2010 New Revision: 946257 URL: http://svn.apache.org/viewvc?rev=946257view=rev Log: Fix for Regex problems reported in the following Jira bugs: - Jira 589 (https://issues.apache.org/jira/browse/XERCESJ-589) - Jira 1326 (https://issues.apache.org/jira/browse/XERCESJ-1326) - Jira 1357 (https://issues.apache.org/jira/browse/XERCESJ-1357) Modified: xerces/java/trunk/src/org/apache/xerces/impl/xpath/regex/RegularExpression.java - To unsubscribe, e-mail: commits-unsubscr...@xerces.apache.org For additional commands, e-mail: commits-h...@xerces.apache.org
svn commit: r946259 [1/2] - /xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xpath/regex/RegularExpression.java
Author: knoaman Date: Wed May 19 16:18:35 2010 New Revision: 946259 URL: http://svn.apache.org/viewvc?rev=946259view=rev Log: Fix for Regex problems reported in the following Jira bugs: - Jira 589 (https://issues.apache.org/jira/browse/XERCESJ-589) - Jira 1326 (https://issues.apache.org/jira/browse/XERCESJ-1326) - Jira 1357 (https://issues.apache.org/jira/browse/XERCESJ-1357) Modified: xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xpath/regex/RegularExpression.java - To unsubscribe, e-mail: commits-unsubscr...@xerces.apache.org For additional commands, e-mail: commits-h...@xerces.apache.org
svn commit: r938077 - in /xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs: SchemaGrammar.java SchemaSymbols.java traversers/XSDComplexTypeTraverser.java traversers/XSDSimpleTypeT
Author: knoaman Date: Mon Apr 26 15:01:13 2010 New Revision: 938077 URL: http://svn.apache.org/viewvc?rev=938077view=rev Log: anyAtomicType cannot be used as a base of simple type restriction. Jira bug: https://issues.apache.org/jira/browse/XERCESJ-1437 Modified: xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/SchemaGrammar.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/traversers/XSDComplexTypeTraverser.java xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/traversers/XSDSimpleTypeTraverser.java Modified: xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/SchemaGrammar.java URL: http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/SchemaGrammar.java?rev=938077r1=938076r2=938077view=diff == --- xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/SchemaGrammar.java (original) +++ xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/SchemaGrammar.java Mon Apr 26 15:01:13 2010 @@ -1367,6 +1367,7 @@ public class SchemaGrammar implements XS private final static BuiltinSchemaGrammar SG_Schema11NS = new BuiltinSchemaGrammar(GRAMMAR_XS, Constants.SCHEMA_VERSION_1_1); public final static XSSimpleType fAnySimpleType = (XSSimpleType)SG_SchemaNS.getGlobalTypeDecl(SchemaSymbols.ATTVAL_ANYSIMPLETYPE); +public final static XSSimpleType fAnyAtomicType = (XSSimpleType)SG_Schema11NS.getGlobalTypeDecl(SchemaSymbols.ATTVAL_ANYATOMICTYPE); // the grammars to hold components of the schema-instance namespace public final static BuiltinSchemaGrammar SG_XSI = new BuiltinSchemaGrammar(GRAMMAR_XSI, Constants.SCHEMA_VERSION_1_0); 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=938077r1=938076r2=938077view=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 Mon Apr 26 15:01:13 2010 @@ -163,6 +163,7 @@ public final class SchemaSymbols { public static final String ATTVAL_POUNDALL = #all; public static final String ATTVAL_FALSE_0= 0; public static final String ATTVAL_TRUE_1 = 1; +public static final String ATTVAL_ANYATOMICTYPE = anyAtomicType; public static final String ATTVAL_ANYSIMPLETYPE = anySimpleType; public static final String ATTVAL_ANYTYPE= anyType; public static final String ATTVAL_ANYURI = anyURI; 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=938077r1=938076r2=938077view=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 Mon Apr 26 15:01:13 2010 @@ -718,6 +718,13 @@ class XSDComplexTypeTraverser extends X baseValidator = dv; simpleContent = DOMUtil.getNextSiblingElement(simpleContent); } +// anySimpleType or anyAtomicType are not allowed as base type +else if (baseValidator == SchemaGrammar.fAnySimpleType || baseValidator == SchemaGrammar.fAnyAtomicType) { +fAttrChecker.returnAttrArray(simpleContentAttrValues, schemaDoc); +fAttrChecker.returnAttrArray(derivationTypeAttrValues, schemaDoc); +throw new ComplexTypeRecoverableError(cos-st-restricts.1.1, +new Object[]{baseValidator.getName(), genAnonTypeName(simpleContentElement)}, simpleContentElement); +} // this only happens when restricting a mixed/emptiable CT // but there is no simpleType, which is required 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=938077r1=938076r2=938077view=diff
svn commit: r934433 - /xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/traversers/XSDComplexTypeTraverser.java
Author: knoaman Date: Thu Apr 15 14:54:16 2010 New Revision: 934433 URL: http://svn.apache.org/viewvc?rev=934433view=rev Log: Check for assert elements only if we are dealing with XML Schema 1.1 Modified: xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/traversers/XSDComplexTypeTraverser.java 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=934433r1=934432r2=934433view=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 Apr 15 14:54:16 2010 @@ -775,7 +775,7 @@ class XSDComplexTypeTraverser extends X traverseAsserts(node, schemaDoc, grammar, fComplexTypeDecl); } else { -// a non assert element after attributes is an error +// either XML Schema 1.0 or a non assert element fAttrChecker.returnAttrArray(simpleContentAttrValues, schemaDoc); fAttrChecker.returnAttrArray(derivationTypeAttrValues, schemaDoc); throw new ComplexTypeRecoverableError( @@ -1615,8 +1615,7 @@ class XSDComplexTypeTraverser extends X } private boolean isAssert(Element e) { -String elementName = DOMUtil.getLocalName(e); -return elementName.equals(SchemaSymbols.ELT_ASSERT); +return (fSchemaHandler.fSchemaVersion == Constants.SCHEMA_VERSION_1_1 DOMUtil.getLocalName(e).equals(SchemaSymbols.ELT_ASSERT)); } /* - To unsubscribe, e-mail: commits-unsubscr...@xerces.apache.org For additional commands, e-mail: commits-h...@xerces.apache.org
svn commit: r934452 - in /xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs: XSAttributeGroupDecl.java traversers/XSDAbstractTraverser.java traversers/XSDComplexTypeTraverser.java
Author: knoaman Date: Thu Apr 15 15:31:22 2010 New Revision: 934452 URL: http://svn.apache.org/viewvc?rev=934452view=rev Log: Support multiple attributes of type ID - patch by Kun Xu (with a slight modification) Jira bug: https://issues.apache.org/jira/browse/XERCESJ-1440 Modified: xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/XSAttributeGroupDecl.java xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/traversers/XSDAbstractTraverser.java xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/traversers/XSDComplexTypeTraverser.java Modified: xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/XSAttributeGroupDecl.java URL: http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/XSAttributeGroupDecl.java?rev=934452r1=934451r2=934452view=diff == --- xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/XSAttributeGroupDecl.java (original) +++ xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/XSAttributeGroupDecl.java Thu Apr 15 15:31:22 2010 @@ -91,6 +91,33 @@ public class XSAttributeGroupDecl implem return null; } +public String addAttributeUse(XSAttributeUseImpl attrUse, boolean allowMultipleIds) { + +// if this attribute use is prohibited, then don't check whether it's +// of type ID +// +// XML Schema 1.1 allows multiple attributes of type ID, so no need to set +// fIDAttrName +if (attrUse.fUse != SchemaSymbols.USE_PROHIBITED !allowMultipleIds) { +if (attrUse.fAttrDecl.fType.isIDType()) { +// if there is already an attribute use of type ID, +// return its name (and don't add it to the list, to avoid +// interruption to instance validation. +if (fIDAttrName == null) +fIDAttrName = attrUse.fAttrDecl.fName; +else +return fIDAttrName; +} +} + +if (fAttrUseNum == fAttributeUses.length) { +fAttributeUses = resize(fAttributeUses, fAttrUseNum*2); +} +fAttributeUses[fAttrUseNum++] = attrUse; + +return null; +} + public void replaceAttributeUse(XSAttributeUse oldUse, XSAttributeUseImpl newUse) { for (int i=0; ifAttrUseNum; i++) { if (fAttributeUses[i] == oldUse) { Modified: xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/traversers/XSDAbstractTraverser.java URL: http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/traversers/XSDAbstractTraverser.java?rev=934452r1=934451r2=934452view=diff == --- xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/traversers/XSDAbstractTraverser.java (original) +++ xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/traversers/XSDAbstractTraverser.java Thu Apr 15 15:31:22 2010 @@ -795,6 +795,8 @@ abstract class XSDAbstractTraverser { enclosingParent); if (tempAttrUse == null) continue; if (tempAttrUse.fUse == SchemaSymbols.USE_PROHIBITED) { +// Revisit: not passing schema version information, since we do not check for +// attributes of type id when the attribute use is prohibited. attrGrp.addAttributeUse(tempAttrUse); continue; } @@ -802,9 +804,9 @@ abstract class XSDAbstractTraverser { tempAttrUse.fAttrDecl.getNamespace(), tempAttrUse.fAttrDecl.getName()); if (otherUse==null) { -String idName = attrGrp.addAttributeUse(tempAttrUse); -// Only applies to XML Schema 1.0 -if (fSchemaHandler.fSchemaVersion Constants.SCHEMA_VERSION_1_1 idName != null) { +String idName = attrGrp.addAttributeUse(tempAttrUse, fSchemaHandler.fSchemaVersion == Constants.SCHEMA_VERSION_1_1); +// For XML Schema 1.1, we return null +if (idName != null) { String code = (enclosingParent instanceof XSAttributeGroupDecl) ? ag-props-correct.3 : ct-props-correct.5; String name = enclosingParent.getName(); reportSchemaError(code, new Object[]{name, tempAttrUse.fAttrDecl.getName(), idName}, child); @@ -827,6 +829,8 @@ abstract class XSDAbstractTraverser { for (int i=0; iattrCount; i++) { oneAttrUse = (XSAttributeUseImpl)attrUseS.item(i); if (oneAttrUse.fUse == SchemaSymbols.USE_PROHIBITED
svn commit: r934498 - /xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/traversers/XSDElementTraverser.java
Author: knoaman Date: Thu Apr 15 17:42:33 2010 New Revision: 934498 URL: http://svn.apache.org/viewvc?rev=934498view=rev Log: Fix for jira bug 1442 https://issues.apache.org/jira/browse/XERCESJ-1442 Modified: xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/traversers/XSDElementTraverser.java 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=934498r1=934497r2=934498view=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 Apr 15 17:42:33 2010 @@ -299,7 +299,8 @@ class XSDElementTraverser extends XSDAbs if (targetNsAtt!=null) { // XML Schema 1.1, set the target namespace to be the value of the targetNamespace attribute if one is defined -element.fTargetNamespace = fSymbolTable.addSymbol(targetNsAtt); +targetNsAtt = fSymbolTable.addSymbol(targetNsAtt); +element.fTargetNamespace = targetNsAtt; } else if (formAtt != null) { if (formAtt.intValue() == SchemaSymbols.FORM_QUALIFIED) element.fTargetNamespace = schemaDoc.fTargetNamespace; - To unsubscribe, e-mail: commits-unsubscr...@xerces.apache.org For additional commands, e-mail: commits-h...@xerces.apache.org
svn commit: r934504 - /xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/traversers/XSDAttributeTraverser.java
Author: knoaman Date: Thu Apr 15 18:14:10 2010 New Revision: 934504 URL: http://svn.apache.org/viewvc?rev=934504view=rev Log: Fix for jira bug 1443 https://issues.apache.org/jira/browse/XERCESJ-1443 Modified: xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/traversers/XSDAttributeTraverser.java 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=934504r1=934503r2=934504view=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 Apr 15 18:14:10 2010 @@ -280,13 +280,16 @@ class XSDAttributeTraverser extends XSDA scope = XSAttributeDecl.SCOPE_GLOBAL; } else { +// For XML 1.0, we only store information about enclosing complex types +// For XML 1.1, we store information about enclosing complex types or attribute groups if (enclosingParent != null) { -if (fSchemaHandler.fSchemaVersion == Constants.SCHEMA_VERSION_1_1) { +if (enclosingParent instanceof XSComplexTypeDecl) { +enclCT = (XSComplexTypeDecl) enclosingParent; enclParent = enclosingParent; scope = XSAttributeDecl.SCOPE_LOCAL; } -else if (enclosingParent instanceof XSComplexTypeDecl) { -enclCT = (XSComplexTypeDecl) enclosingParent; +else if (fSchemaHandler.fSchemaVersion == Constants.SCHEMA_VERSION_1_1) { +enclParent = enclosingParent; scope = XSAttributeDecl.SCOPE_LOCAL; } } - To unsubscribe, e-mail: commits-unsubscr...@xerces.apache.org For additional commands, e-mail: commits-h...@xerces.apache.org
svn commit: r933633 - /xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/TypeValidatorHelper.java
Author: knoaman Date: Tue Apr 13 14:29:36 2010 New Revision: 933633 URL: http://svn.apache.org/viewvc?rev=933633view=rev Log: fractionDigits is not a valid facet for precisionDecimal. Patch by Kun Xu. Jira issue: https://issues.apache.org/jira/browse/XERCESJ-1438 Modified: xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/TypeValidatorHelper.java Modified: xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/TypeValidatorHelper.java URL: http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/TypeValidatorHelper.java?rev=933633r1=933632r2=933633view=diff == --- xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/TypeValidatorHelper.java (original) +++ xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/TypeValidatorHelper.java Tue Apr 13 14:29:36 2010 @@ -54,8 +54,8 @@ public abstract class TypeValidatorHelpe private static int FACETS_GROUP12 = FACETS_GROUP6 | XSSimpleTypeDecl.FACET_ASSERT; -private static int FACETS_GROUP13 = FACETS_GROUP11 | XSSimpleTypeDecl.FACET_MAXSCALE | -XSSimpleTypeDecl.FACET_MINSCALE; +private static int FACETS_GROUP13 = FACETS_GROUP4 | XSSimpleTypeDecl.FACET_TOTALDIGITS | +XSSimpleTypeDecl.FACET_ASSERT | XSSimpleTypeDecl.FACET_MAXSCALE | XSSimpleTypeDecl.FACET_MINSCALE; // Static data private static final TypeValidatorHelper fHelper1_0 = new TypeValidatorHelper1_0(); - To unsubscribe, e-mail: commits-unsubscr...@xerces.apache.org For additional commands, e-mail: commits-h...@xerces.apache.org
svn commit: r933357 - in /xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs: DoubleDV.java FloatDV.java
Author: knoaman Date: Mon Apr 12 18:49:51 2010 New Revision: 933357 URL: http://svn.apache.org/viewvc?rev=933357view=rev Log: Allow +INF for double and float in XML Schema 1.1. Patch by Kun Xu with a slight modification. Jira bug: https://issues.apache.org/jira/browse/XERCESJ-1436 Modified: xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/DoubleDV.java xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/FloatDV.java Modified: xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/DoubleDV.java URL: http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/DoubleDV.java?rev=933357r1=933356r2=933357view=diff == --- xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/DoubleDV.java (original) +++ xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/DoubleDV.java Mon Apr 12 18:49:51 2010 @@ -19,6 +19,7 @@ package org.apache.xerces.impl.dv.xs; import org.apache.xerces.impl.dv.InvalidDatatypeValueException; import org.apache.xerces.impl.dv.ValidationContext; +import org.apache.xerces.impl.dv.xs.TypeValidatorHelper.TypeValidatorHelper1_1; import org.apache.xerces.xs.datatypes.XSDouble; /** @@ -35,8 +36,8 @@ public class DoubleDV extends TypeValida //convert a String to Double form, we have to take care of cases specified in spec like INF, -INF and NaN public Object getActualValue(String content, ValidationContext context) throws InvalidDatatypeValueException { -try{ -return new XDouble(content); +try { +return new XDouble(content, context.getTypeValidatorHelper() instanceof TypeValidatorHelper1_1); } catch (NumberFormatException ex){ throw new InvalidDatatypeValueException(cvc-datatype-valid.1.2.1, new Object[]{content, double}); } @@ -75,11 +76,11 @@ public class DoubleDV extends TypeValida private static final class XDouble implements XSDouble { private final double value; -public XDouble(String s) throws NumberFormatException { +public XDouble(String s, boolean isSchema11) throws NumberFormatException { if (isPossibleFP(s)) { value = Double.parseDouble(s); } -else if ( s.equals(INF) ) { +else if ( s.equals(INF) || (isSchema11 s.equals(+INF))) { value = Double.POSITIVE_INFINITY; } else if ( s.equals(-INF) ) { Modified: xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/FloatDV.java URL: http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/FloatDV.java?rev=933357r1=933356r2=933357view=diff == --- xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/FloatDV.java (original) +++ xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/FloatDV.java Mon Apr 12 18:49:51 2010 @@ -19,6 +19,7 @@ package org.apache.xerces.impl.dv.xs; import org.apache.xerces.impl.dv.InvalidDatatypeValueException; import org.apache.xerces.impl.dv.ValidationContext; +import org.apache.xerces.impl.dv.xs.TypeValidatorHelper.TypeValidatorHelper1_1; import org.apache.xerces.xs.datatypes.XSFloat; /** @@ -35,8 +36,8 @@ public class FloatDV extends TypeValidat //convert a String to Float form, we have to take care of cases specified in spec like INF, -INF and NaN public Object getActualValue(String content, ValidationContext context) throws InvalidDatatypeValueException { -try{ -return new XFloat(content); +try { +return new XFloat(content, context.getTypeValidatorHelper() instanceof TypeValidatorHelper1_1); } catch (NumberFormatException ex){ throw new InvalidDatatypeValueException(cvc-datatype-valid.1.2.1, new Object[]{content, float}); } @@ -59,11 +60,11 @@ public class FloatDV extends TypeValidat private static final class XFloat implements XSFloat { private final float value; -public XFloat(String s) throws NumberFormatException { +public XFloat(String s, boolean isSchema11) throws NumberFormatException { if (DoubleDV.isPossibleFP(s)) { value = Float.parseFloat(s); } -else if ( s.equals(INF) ) { +else if ( s.equals(INF) || (isSchema11 s.equals(+INF))) { value = Float.POSITIVE_INFINITY; } else if ( s.equals(-INF) ) { - To unsubscribe, e-mail: commits-unsubscr...@xerces.apache.org For additional commands, e-mail: commits-h...@xerces.apache.org
svn commit: r909133 - /xerces/java/trunk/src/org/apache/xerces/impl/xpath/regex/RegularExpression.java
Author: knoaman Date: Thu Feb 11 20:31:12 2010 New Revision: 909133 URL: http://svn.apache.org/viewvc?rev=909133view=rev Log: Fix problem in Regex, in normal mode with multi-line option, when last character is a new line and we are matching a '^'. The match should fail. Modified: xerces/java/trunk/src/org/apache/xerces/impl/xpath/regex/RegularExpression.java Modified: xerces/java/trunk/src/org/apache/xerces/impl/xpath/regex/RegularExpression.java URL: http://svn.apache.org/viewvc/xerces/java/trunk/src/org/apache/xerces/impl/xpath/regex/RegularExpression.java?rev=909133r1=909132r2=909133view=diff == --- xerces/java/trunk/src/org/apache/xerces/impl/xpath/regex/RegularExpression.java (original) +++ xerces/java/trunk/src/org/apache/xerces/impl/xpath/regex/RegularExpression.java Thu Feb 11 20:31:12 2010 @@ -959,7 +959,7 @@ case '^': if (isSet(opts, MULTIPLE_LINES)) { if (!(offset == con.start - || offset con.start isEOLChar( target [ offset-1 ] ))) + || offset con.start offset con.limit isEOLChar( target [ offset-1 ] ))) return -1; } else { if (offset != con.start) @@ -1532,14 +1532,8 @@ */ private int matchString (Context con, Op op, int offset, int dx, int opts) { - - - String target = con.strTarget; - - - while (true) { if (op == null) return isSet(opts, XMLSCHEMA_MODE) offset != con.limit ? -1 : offset; @@ -1646,7 +1640,7 @@ case '^': if (isSet(opts, MULTIPLE_LINES)) { if (!(offset == con.start - || offset con.start isEOLChar( target .charAt( offset-1 ) ))) + || offset con.start offset con.limit isEOLChar( target .charAt( offset-1 ) ))) return -1; } else { if (offset != con.start) @@ -2258,7 +2252,7 @@ case '^': if (isSet(opts, MULTIPLE_LINES)) { if (!(offset == con.start - || offset con.start isEOLChar( target .setIndex( offset-1 ) ))) + || offset con.start offset con.limit isEOLChar( target .setIndex( offset-1 ) ))) return -1; } else { if (offset != con.start) - To unsubscribe, e-mail: commits-unsubscr...@xerces.apache.org For additional commands, e-mail: commits-h...@xerces.apache.org
svn commit: r909135 - /xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xpath/regex/RegularExpression.java
Author: knoaman Date: Thu Feb 11 20:32:18 2010 New Revision: 909135 URL: http://svn.apache.org/viewvc?rev=909135view=rev Log: Fix problem in Regex, in normal mode with multi-line option, when last character is a new line and we are matching a '^'. The match should fail. Modified: xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xpath/regex/RegularExpression.java 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=909135r1=909134r2=909135view=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 Feb 11 20:32:18 2010 @@ -959,7 +959,7 @@ case '^': if (isSet(opts, MULTIPLE_LINES)) { if (!(offset == con.start - || offset con.start isEOLChar( target [ offset-1 ] ))) + || offset con.start offset con.limit isEOLChar( target [ offset-1 ] ))) return -1; } else { if (offset != con.start) @@ -1646,7 +1646,7 @@ case '^': if (isSet(opts, MULTIPLE_LINES)) { if (!(offset == con.start - || offset con.start isEOLChar( target .charAt( offset-1 ) ))) + || offset con.start offset con.limit isEOLChar( target .charAt( offset-1 ) ))) return -1; } else { if (offset != con.start) @@ -2258,7 +2258,7 @@ case '^': if (isSet(opts, MULTIPLE_LINES)) { if (!(offset == con.start - || offset con.start isEOLChar( target .setIndex( offset-1 ) ))) + || offset con.start offset con.limit isEOLChar( target .setIndex( offset-1 ) ))) return -1; } else { if (offset != con.start) - To unsubscribe, e-mail: commits-unsubscr...@xerces.apache.org For additional commands, e-mail: commits-h...@xerces.apache.org
svn commit: r890348 - /xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/PrecisionDecimalDV.java
Author: knoaman Date: Mon Dec 14 14:45:05 2009 New Revision: 890348 URL: http://svn.apache.org/viewvc?rev=890348view=rev Log: Various fixes for precisionDecimal simple type Modified: xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/PrecisionDecimalDV.java Modified: xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/PrecisionDecimalDV.java URL: http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/PrecisionDecimalDV.java?rev=890348r1=890347r2=890348view=diff == --- xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/PrecisionDecimalDV.java (original) +++ xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/PrecisionDecimalDV.java Mon Dec 14 14:45:05 2009 @@ -30,9 +30,9 @@ * @version $Id$ */ class PrecisionDecimalDV extends TypeValidator { - + static class XPrecisionDecimal { - + // sign: 0 for absent; 1 for positive values; -1 for negative values (except in case of INF, -INF) int sign = 1; // total digits. = 1 @@ -42,19 +42,19 @@ // fraction digits when sign != 0 int fracDigits = 0; //precision -//int precision = 0; +int precision = 0; // the string representing the integer part String ivalue = ; // the string representing the fraction part String fvalue = ; int pvalue = 0; - - + XPrecisionDecimal(String content) throws NumberFormatException { if(content.equals(NaN)) { ivalue = content; sign = 0; +return; } if(content.equals(+INF) || content.equals(INF) || content.equals(-INF)) { ivalue = content.charAt(0) == '+' ? content.substring(1) : content; @@ -62,16 +62,17 @@ } initD(content); } - + void initD(String content) throws NumberFormatException { int len = content.length(); -if (len == 0) +if (len == 0) { throw new NumberFormatException(); - +} + // these 4 variables are used to indicate where the integre/fraction // parts start/end. int intStart = 0, intEnd = 0, fracStart = 0, fracEnd = 0; - + // Deal with leading sign symbol if present if (content.charAt(0) == '+') { // skip '+', so intStart should be 1 @@ -81,246 +82,278 @@ intStart = 1; sign = -1; } - + // skip leading zeroes in integer part int actualIntStart = intStart; while (actualIntStart len content.charAt(actualIntStart) == '0') { actualIntStart++; } - + // Find the ending position of the integer part for (intEnd = actualIntStart; intEnd len TypeValidator.isDigit(content.charAt(intEnd)); intEnd++); - + // Not reached the end yet if (intEnd len) { // the remaining part is not .DDD or EDDD or eDDD, error -if (content.charAt(intEnd) != '.' content.charAt(intEnd) != 'E' content.charAt(intEnd) != 'e') +if (content.charAt(intEnd) != '.' content.charAt(intEnd) != 'E' content.charAt(intEnd) != 'e') { throw new NumberFormatException(); - -if(content.charAt(intEnd) == '.') { +} + +if (content.charAt(intEnd) == '.') { // fraction part starts after '.', and ends at the end of the input fracStart = intEnd + 1; - + // find location of E or e (if present) // Find the ending position of the fracion part for (fracEnd = fracStart; -fracEnd len TypeValidator.isDigit(content.charAt(fracEnd)); -fracEnd++); + fracEnd len TypeValidator.isDigit(content.charAt(fracEnd)); + fracEnd++); + +fracDigits = fracEnd - fracStart; +if (fracDigits 0) { +fvalue = content.substring(fracStart, fracEnd); +} +if (fracEnd len) { +if (content.charAt(fracEnd) != 'E' content.charAt(fracEnd) != 'e') { +throw new NumberFormatException(); +} +if (content.charAt(fracEnd + 1) == '+') { +fracEnd++; +} +pvalue = Integer.parseInt
svn commit: r890358 - in /xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl: dv/ dv/xs/ msg/ xs/ xs/traversers/
Author: knoaman Date: Mon Dec 14 15:04:26 2009 New Revision: 890358 URL: http://svn.apache.org/viewvc?rev=890358view=rev Log: Add support for maxScale and minScale (precisionDecimal simple type) - patch by Ken Cai. Modified: xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/XSFacets.java xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/TypeValidator.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/msg/XMLSchemaMessages.properties 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/traversers/XSAttributeChecker.java xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/traversers/XSDAbstractTraverser.java Modified: xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/XSFacets.java URL: http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/XSFacets.java?rev=890358r1=890357r2=890358view=diff == --- xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/XSFacets.java (original) +++ xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/XSFacets.java Mon Dec 14 15:04:26 2009 @@ -38,7 +38,17 @@ * value of length facet. */ public int length; + +/** + * value of maxScale facet. + */ +public int maxScale; +/** + * value of minScale facet. + */ +public int minScale; + /** * value of minLength facet. */ @@ -124,6 +134,8 @@ public XSAnnotation maxExclusiveAnnotation; public XSAnnotation minInclusiveAnnotation; public XSAnnotation minExclusiveAnnotation; +public XSAnnotation maxScaleAnnotation; //XML Schema 1.1 +public XSAnnotation minScaleAnnotation; //XML Schema 1.1 public XSAnnotation explicitTimezoneAnnotation; //XML schema 1.1 // the annotations of the assertions are stored in XSAssertImpl objects @@ -143,6 +155,8 @@ minInclusiveAnnotation = null; minExclusiveAnnotation = null; assertFacets = null; +maxScaleAnnotation = null;//XML Schema 1.1 +minScaleAnnotation = null;//XML Schema 1.1 explicitTimezoneAnnotation = null; //XML Schema 1.1 } } Modified: xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/TypeValidator.java URL: http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/TypeValidator.java?rev=890358r1=890357r2=890358view=diff == --- xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/TypeValidator.java (original) +++ xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/TypeValidator.java Mon Dec 14 15:04:26 2009 @@ -102,6 +102,12 @@ return isDigit(ch) ? ch - '0' : -1; } +//get the number of precision of the value +//the parameters are in compiled form (from getActualValue) +public int getPrecision(Object value){ +return 0; +} + public boolean hasTimeZone(Object value){ return false; } 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=890358r1=890357r2=890358view=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 Mon Dec 14 15:04:26 2009 @@ -283,6 +283,8 @@ private int fMaxLength = -1; private int fTotalDigits = -1; private int fFractionDigits = -1; +private int fMaxScale; //for XML Schema 1.1 +private int fMinScale; //for XML Schema 1.1 private Vector fPattern; private Vector fPatternStr; private Vector fEnumeration; @@ -312,6 +314,8 @@ public XSAnnotation maxExclusiveAnnotation; public XSAnnotation minInclusiveAnnotation; public XSAnnotation minExclusiveAnnotation; +public XSAnnotation maxScaleAnnotation; +public XSAnnotation minScaleAnnotation; public XSAnnotation explicitTimezoneAnnotation; // facets as objects @@ -420,6 +424,8 @@ fPatternType = fBase.fPatternType; fFixedFacet = fBase.fFixedFacet; fFacetsDefined = fBase.fFacetsDefined; +fMaxScale = fBase.fMaxScale; +fMinScale = fBase.fMinScale
svn commit: r890366 - /xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/XSSimpleTypeDecl.java
Author: knoaman Date: Mon Dec 14 15:15:09 2009 New Revision: 890366 URL: http://svn.apache.org/viewvc?rev=890366view=rev Log: Previous commit overwrote some existing code Modified: xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/XSSimpleTypeDecl.java 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=890366r1=890365r2=890366view=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 Mon Dec 14 15:15:09 2009 @@ -3391,6 +3391,15 @@ minInclusiveAnnotation); count++; } +if ((fFacetsDefined FACET_EXPLICITTIMEZONE) != 0) { +facets[count] = +new XSFacetImpl ( +FACET_EXPLICITTIMEZONE, +ET_FACET_STRING[fExplicitTimezone], +(fFixedFacet FACET_EXPLICITTIMEZONE) != 0, +explicitTimezoneAnnotation); +count++; +} if ((fFacetsDefined FACET_MAXSCALE) != 0) { facets[count] = new XSFacetImpl ( - To unsubscribe, e-mail: commits-unsubscr...@xerces.apache.org For additional commands, e-mail: commits-h...@xerces.apache.org
svn commit: r889652 - /xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/traversers/XSDTypeAlternativeTraverser.java
Author: knoaman Date: Fri Dec 11 15:26:14 2009 New Revision: 889652 URL: http://svn.apache.org/viewvc?rev=889652view=rev Log: Fix for CTA - We were always falling back to the element declaration's type, even if the type alternative was validly derived from the type of the element. Modified: xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/traversers/XSDTypeAlternativeTraverser.java Modified: xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/traversers/XSDTypeAlternativeTraverser.java URL: http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/traversers/XSDTypeAlternativeTraverser.java?rev=889652r1=889651r2=889652view=diff == --- xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/traversers/XSDTypeAlternativeTraverser.java (original) +++ xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/traversers/XSDTypeAlternativeTraverser.java Fri Dec 11 15:26:14 2009 @@ -169,9 +169,9 @@ e-props-correct.7, new Object[] { element.getName(), alternativeType.getName(), element.fType.getName()}, altElement); +// fall back to element declaration's type +alternativeType = element.fType; } -// fall back to element declaration's type -alternativeType = element.fType; } // not expecting any more children - To unsubscribe, e-mail: commits-unsubscr...@xerces.apache.org For additional commands, e-mail: commits-h...@xerces.apache.org
svn commit: r889357 - in /xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl: msg/XMLSchemaMessages.properties xs/traversers/XSDTypeAlternativeTraverser.java
Author: knoaman Date: Thu Dec 10 18:33:26 2009 New Revision: 889357 URL: http://svn.apache.org/viewvc?rev=889357view=rev Log: Make sure that the type of the CTA is either xs:error or is validly derived from the type of the element. Modified: xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/msg/XMLSchemaMessages.properties xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/traversers/XSDTypeAlternativeTraverser.java Modified: xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/msg/XMLSchemaMessages.properties URL: http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/msg/XMLSchemaMessages.properties?rev=889357r1=889356r2=889357view=diff == --- xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/msg/XMLSchemaMessages.properties (original) +++ xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/msg/XMLSchemaMessages.properties Thu Dec 10 18:33:26 2009 @@ -229,6 +229,7 @@ e-props-correct.4 = e-props-correct.4: The '{'type definition'}' of element ''{0}'' is not validly derived from the '{'type definition'}' of the substitutionHead ''{1}'', or the '{'substitution group exclusions'}' property of ''{1}'' does not allow this derivation. e-props-correct.5 = e-props-correct.5: A '{'value constraint'}' must not be present on element ''{0}'', because the element''s '{'type definition'}' or '{'type definition'}'''s '{'content type'}' is ID, or is derived from ID. e-props-correct.6 = e-props-correct.6: Circular substitution group detected for element ''{0}''. +e-props-correct.7 = e-props-correct.7: Type alternative ''{1}'' is not xs:error or is not validly derived from the type definition, ''{2}'', of element ''{0}''. fractionDigits-valid-restriction = fractionDigits-valid-restriction: In the definition of {2}, the value ''{0}'' for the facet ''fractionDigits'' is invalid, because it must be = the value for ''fractionDigits'' which was set to ''{1}'' in one of the ancestor types. fractionDigits-totalDigits = fractionDigits-totalDigits: In the definition of {2}, the value ''{0}'' for the facet ''fractionDigits'' is invalid, because the value must be = the value for ''totalDigits'' which is ''{1}''. length-minLength-maxLength.1.1 = length-minLength-maxLength.1.1: For type {0}, it is an error for the value of length ''{1}'' to be less than the value of minLength ''{2}''. Modified: xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/traversers/XSDTypeAlternativeTraverser.java URL: http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/traversers/XSDTypeAlternativeTraverser.java?rev=889357r1=889356r2=889357view=diff == --- xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/traversers/XSDTypeAlternativeTraverser.java (original) +++ xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/traversers/XSDTypeAlternativeTraverser.java Thu Dec 10 18:33:26 2009 @@ -17,11 +17,14 @@ package org.apache.xerces.impl.xs.traversers; +import org.apache.xerces.impl.Constants; +import org.apache.xerces.impl.dv.XSSimpleType; import org.apache.xerces.impl.xpath.XPath20; import org.apache.xerces.impl.xpath.XPathException; import org.apache.xerces.impl.xs.SchemaGrammar; import org.apache.xerces.impl.xs.SchemaSymbols; import org.apache.xerces.impl.xs.XSAnnotationImpl; +import org.apache.xerces.impl.xs.XSComplexTypeDecl; import org.apache.xerces.impl.xs.XSElementDecl; import org.apache.xerces.impl.xs.alternative.Test; import org.apache.xerces.impl.xs.alternative.XSTypeAlternativeImpl; @@ -54,6 +57,12 @@ * @version $Id$ */ class XSDTypeAlternativeTraverser extends XSDAbstractTraverser { + +private static final XSSimpleType fErrorType; +static { +SchemaGrammar grammar = SchemaGrammar.getS4SGrammar(Constants.SCHEMA_VERSION_1_1); +fErrorType = (XSSimpleType)grammar.getGlobalTypeDecl(error); +} XSDTypeAlternativeTraverser (XSDHandler handler, XSAttributeChecker attrChecker) { @@ -141,10 +150,28 @@ if (typeAtt == null !hasAnonType) { reportSchemaError(src-type-alternative.3.12.13.2, null, altElement); } - + // fall back to the element declaration's type if (alternativeType == null) { -alternativeType= element.fType; +alternativeType = element.fType; +} +// Element Properties Correct +// 7.1 T is validly substitutable for E.{type definition}, subject to +// the blocking keywords of E.{disallowed substitutions}. +// 7.2 T is the type xs:error +else if (alternativeType != fErrorType
svn commit: r889362 - /xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/XMLSchemaValidator.java
Author: knoaman Date: Thu Dec 10 18:46:04 2009 New Revision: 889362 URL: http://svn.apache.org/viewvc?rev=889362view=rev Log: Fix a problem with CTA checking when handling root elements. Modified: xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/XMLSchemaValidator.java 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=889362r1=889361r2=889362view=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 Dec 10 18:46:04 2009 @@ -2168,7 +2168,32 @@ processRootTypeQName(fRootTypeQName); } } - + +// if there was no processor stipulated type +if (fCurrentType == null) { +// try again to get the element decl: +// case 1: find declaration for root element +// case 2: find declaration for element from another namespace +if (fCurrentElemDecl == null) { +// try to find schema grammar by different means.. +SchemaGrammar sGrammar = +findSchemaGrammar( +XSDDescription.CONTEXT_ELEMENT, +element.uri, +null, +element, +attributes); +if (sGrammar != null) { +fCurrentElemDecl = sGrammar.getGlobalElementDecl(element.localpart); +} +} + +if (fCurrentElemDecl != null) { +// then get the type +fCurrentType = fCurrentElemDecl.fType; +} +} + //process type alternatives if (fTypeAlternativesChecking fCurrentElemDecl != null) { boolean typeSelected = false; @@ -2196,31 +2221,6 @@ } } } - -// if there was no processor stipulated type -if (fCurrentType == null) { -// try again to get the element decl: -// case 1: find declaration for root element -// case 2: find declaration for element from another namespace -if (fCurrentElemDecl == null) { -// try to find schema grammar by different means.. -SchemaGrammar sGrammar = -findSchemaGrammar( -XSDDescription.CONTEXT_ELEMENT, -element.uri, -null, -element, -attributes); -if (sGrammar != null) { -fCurrentElemDecl = sGrammar.getGlobalElementDecl(element.localpart); -} -} - -if (fCurrentElemDecl != null) { -// then get the type -fCurrentType = fCurrentElemDecl.fType; -} -} // check if we should be ignoring xsi:type on this element if (fElementDepth == fIgnoreXSITypeDepth fCurrentElemDecl == null) { - To unsubscribe, e-mail: commits-unsubscr...@xerces.apache.org For additional commands, e-mail: commits-h...@xerces.apache.org
svn commit: r889369 - /xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xpath/XPath20.java
Author: knoaman Date: Thu Dec 10 19:00:55 2009 New Revision: 889369 URL: http://svn.apache.org/viewvc?rev=889369view=rev Log: Use the Schema 1.1 DV factory Modified: xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xpath/XPath20.java Modified: xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xpath/XPath20.java URL: http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xpath/XPath20.java?rev=889369r1=889368r2=889369view=diff == --- xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xpath/XPath20.java (original) +++ xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xpath/XPath20.java Thu Dec 10 19:00:55 2009 @@ -81,6 +81,13 @@ public static final int TYPE_UNTYPED= 2;//for attributes (untypedAtomic) public static final int TYPE_OTHER = 3;//for everything else which should have some valid type +private static final String SCHEMA11_FACTORY_CLASS = org.apache.xerces.impl.dv.xs.Schema11DVFactoryImpl; +protected static SchemaDVFactory dvFactory; + +static { +dvFactory = SchemaDVFactory.getInstance(SCHEMA11_FACTORY_CLASS); +} + public abstract boolean evaluate(QName element, XMLAttributes attributes) throws Exception; public Object getValue(XMLAttributes attributes) throws Exception { @@ -120,12 +127,11 @@ } public Object getValue(XMLAttributes attributes) throws Exception { -SchemaDVFactory validator = SchemaDVFactory.getInstance(); XSSimpleType type; if (isNumeric) { -type = validator.getBuiltInType(double); +type = dvFactory.getBuiltInType(double); } else { -type = validator.getBuiltInType(string); +type = dvFactory.getBuiltInType(string); } return type.validate(value, null, null); } @@ -217,12 +223,11 @@ int type2 = child2.getType(); Object obj1, obj2; XSSimpleTypeDecl simpleType; -SchemaDVFactory validator = SchemaDVFactory.getInstance(); if (type1 == TYPE_UNTYPED type2 == TYPE_DOUBLE) { // attribute and numeral String attrValue = child1.getValue(attributes).toString(); -simpleType = (XSSimpleTypeDecl) validator.getBuiltInType(double); +simpleType = (XSSimpleTypeDecl) dvFactory.getBuiltInType(double); //cast the attribute value into double as per the XPath 2.0 general comparison rules obj1 = simpleType.validate(attrValue, null, null); obj2 = child2.getValue(attributes); @@ -231,7 +236,7 @@ } else if (type1 == TYPE_UNTYPED type2 == TYPE_STRING) { // attribute and string String attrValue = child1.getValue(attributes).toString(); -simpleType = (XSSimpleTypeDecl) validator.getBuiltInType(string); +simpleType = (XSSimpleTypeDecl) dvFactory.getBuiltInType(string); //cast the attribute value into string as per the XPath 2.0 general comparison rules obj1 = simpleType.validate(attrValue, null, null); obj2 = child2.getValue(attributes); @@ -240,7 +245,7 @@ } else if (type1 == TYPE_DOUBLE type2 == TYPE_UNTYPED) { // numeral and attribute String attrValue = child2.getValue(attributes).toString(); -simpleType = (XSSimpleTypeDecl) validator.getBuiltInType(double); +simpleType = (XSSimpleTypeDecl) dvFactory.getBuiltInType(double); obj1 = child1.getValue(attributes); //cast the attribute value into double as per the XPath 2.0 general comparison rules obj2 = simpleType.validate(attrValue, null, null); @@ -249,7 +254,7 @@ } else if (type1 == TYPE_STRING type2 == TYPE_UNTYPED) { // string and attribute String attrValue = child2.getValue(attributes).toString(); -simpleType = (XSSimpleTypeDecl) validator.getBuiltInType(string); +simpleType = (XSSimpleTypeDecl) dvFactory.getBuiltInType(string); obj1 = child1.getValue(attributes); //cast the attribute value into string as per the XPath 2.0 general comparison rules obj2 = simpleType.validate(attrValue, null, null); @@ -259,7 +264,7 @@ // attr and attr String attrVal1 = child1.getValue(attributes).toString(); String attrVal2 = child2.getValue(attributes).toString(); -simpleType = (XSSimpleTypeDecl) validator.getBuiltInType(string); +simpleType = (XSSimpleTypeDecl) dvFactory.getBuiltInType(string); //cast the both attribute values into string as per the XPath 2.0 general comparison rules obj1 = simpleType.validate(attrVal1, null, null); obj2 = simpleType.validate
svn commit: r888552 - in /xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces: impl/dv/xs/ impl/xs/ impl/xs/traversers/ xs/
Author: knoaman Date: Tue Dec 8 20:01:29 2009 New Revision: 888552 URL: http://svn.apache.org/viewvc?rev=888552view=rev Log: Store {context} property in type definitions Modified: 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/dv/xs/XSSimpleTypeDelegate.java xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/XSComplexTypeDecl.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/XSDSimpleTypeTraverser.java xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/traversers/XSDTypeAlternativeTraverser.java xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/xs/XSTypeDefinition.java 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=888552r1=888551r2=888552view=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 Tue Dec 8 20:01:29 2009 @@ -44,6 +44,7 @@ import org.apache.xerces.xs.XSFacet; import org.apache.xerces.xs.XSMultiValueFacet; import org.apache.xerces.xs.XSNamespaceItem; +import org.apache.xerces.xs.XSObject; import org.apache.xerces.xs.XSObjectList; import org.apache.xerces.xs.XSSimpleTypeDefinition; import org.apache.xerces.xs.XSTypeDefinition; @@ -333,6 +334,9 @@ // The namespace schema information item corresponding to the target namespace // of the simple type definition, if it is globally declared; or null otherwise. private XSNamespaceItem fNamespaceItem = null; + +// context +XSObject fContext = null; // default constructor public XSSimpleTypeDecl(){} @@ -3124,6 +3128,8 @@ fAnnotations = null; fFacets = null; +fContext = null; + // REVISIT: reset for fundamental facets } @@ -3137,6 +3143,17 @@ public void setNamespaceItem(XSNamespaceItem namespaceItem) { fNamespaceItem = namespaceItem; } + +/** + * + */ +public void setContext(XSObject context) { +fContext = context; +} + +public XSObject getContext() { +return fContext; +} /** * @see java.lang.Object#toString() Modified: xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/XSSimpleTypeDelegate.java URL: http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/XSSimpleTypeDelegate.java?rev=888552r1=888551r2=888552view=diff == --- xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/XSSimpleTypeDelegate.java (original) +++ xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/XSSimpleTypeDelegate.java Tue Dec 8 20:01:29 2009 @@ -26,6 +26,7 @@ import org.apache.xerces.impl.dv.XSSimpleType; import org.apache.xerces.xs.StringList; import org.apache.xerces.xs.XSNamespaceItem; +import org.apache.xerces.xs.XSObject; import org.apache.xerces.xs.XSObjectList; import org.apache.xerces.xs.XSSimpleTypeDefinition; import org.apache.xerces.xs.XSTypeDefinition; @@ -205,6 +206,10 @@ return type.validate(content, context, validatedInfo); } +public XSObject getContext() { +return type.getContext(); +} + public String toString() { return type.toString(); } Modified: xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/XSComplexTypeDecl.java URL: http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/XSComplexTypeDecl.java?rev=888552r1=888551r2=888552view=diff == --- xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/XSComplexTypeDecl.java (original) +++ xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/XSComplexTypeDecl.java Tue Dec 8 20:01:29 2009 @@ -26,6 +26,7 @@ import org.apache.xerces.xs.XSComplexTypeDefinition; import org.apache.xerces.xs.XSConstants; import org.apache.xerces.xs.XSNamespaceItem; +import org.apache.xerces.xs.XSObject; import
svn commit: r886273 - in /xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl: dv/ dv/xs/ msg/ xs/ xs/traversers/
Author: knoaman Date: Wed Dec 2 19:18:54 2009 New Revision: 886273 URL: http://svn.apache.org/viewvc?rev=886273view=rev Log: Add support for dateTimeStamp simple type and explicitTimezone facet. Patch by Ken Cai with minor modifications by Khaled Noaman. Added: xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/DateTimeStampDV.java (with props) Modified: xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/XSFacets.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/dv/xs/Schema11DVFactoryImpl.java xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/TypeValidator.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/msg/XMLSchemaMessages.properties 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/traversers/XSAttributeChecker.java xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/traversers/XSDAbstractTraverser.java Modified: xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/XSFacets.java URL: http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/XSFacets.java?rev=886273r1=886272r2=886273view=diff == --- xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/XSFacets.java (original) +++ xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/XSFacets.java Wed Dec 2 19:18:54 2009 @@ -53,6 +53,11 @@ * value of whiteSpace facet. */ public short whiteSpace; + +/** + * value of explicitTimezone facet. + */ +public short explicitTimezone; /** * value of totalDigits facet. @@ -119,6 +124,7 @@ public XSAnnotation maxExclusiveAnnotation; public XSAnnotation minInclusiveAnnotation; public XSAnnotation minExclusiveAnnotation; +public XSAnnotation explicitTimezoneAnnotation; //XML schema 1.1 // the annotations of the assertions are stored in XSAssertImpl objects // stored in the 'assertFacets' Vector. @@ -137,5 +143,6 @@ minInclusiveAnnotation = null; minExclusiveAnnotation = null; assertFacets = null; +explicitTimezoneAnnotation = null; //XML Schema 1.1 } } 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=886273r1=886272r2=886273view=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 Wed Dec 2 19:18:54 2009 @@ -45,7 +45,20 @@ public static final short WS_REPLACE = 1; /** collapse the white spaces */ public static final short WS_COLLAPSE = 2; - + +/** + * constants defined for the value of 'explicitTimezone' facet. + * see a href='http://www.w3.org/TR/xmlschema11-2/#rf-explicitTimezone' XML Schema + * Part 2: Datatypes /a + */ + +// optional the explicit timezone +public static final short ET_OPTIONAL = 0; +// required the explicit timezone +public static final short ET_REQUIRED = 1; +// prohibited the explicit timezone +public static final short ET_PROHIBITED = 2; + /** * Constant defined for the primitive built-in simple tpyes. * see a href='http://www.w3.org/TR/xmlschema-2/#built-in-primitive-datatypes' Added: xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/DateTimeStampDV.java URL: http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/DateTimeStampDV.java?rev=886273view=auto == --- xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/DateTimeStampDV.java (added) +++ xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/DateTimeStampDV.java Wed Dec 2 19:18:54 2009 @@ -0,0 +1,46 @@ +/* + * 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
svn commit: r886274 - /xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/AbstractDateTimeDV.java
Author: knoaman Date: Wed Dec 2 19:19:31 2009 New Revision: 886274 URL: http://svn.apache.org/viewvc?rev=886274view=rev Log: Add support for dateTimeStamp simple type and explicitTimezone facet. Patch by Ken Cai with minor modifications by Khaled Noaman. Modified: xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/AbstractDateTimeDV.java Modified: xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/AbstractDateTimeDV.java URL: http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/AbstractDateTimeDV.java?rev=886274r1=886273r2=886274view=diff == --- xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/AbstractDateTimeDV.java (original) +++ xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/AbstractDateTimeDV.java Wed Dec 2 19:19:31 2009 @@ -89,6 +89,10 @@ ((DateTimeData)value2), true); }//compare() + public boolean hasTimeZone(Object value){ + return ((DateTimeData)value).hasTimeZone(); + } + /** * Compare algorithm described in dateDime (3.2.7). * Duration datatype overwrites this method - To unsubscribe, e-mail: commits-unsubscr...@xerces.apache.org For additional commands, e-mail: commits-h...@xerces.apache.org
svn commit: r885821 - in /xerces/java/branches/xml-schema-1.1-dev: samples/simpletype/ samples/xni/ src/org/apache/xerces/impl/dv/xs/ src/org/apache/xerces/xs/
Author: knoaman Date: Tue Dec 1 16:24:10 2009 New Revision: 885821 URL: http://svn.apache.org/viewvc?rev=885821view=rev Log: Revert back to using short for facets to maintain backward compatibility Modified: xerces/java/branches/xml-schema-1.1-dev/samples/simpletype/SimpleTypeUsage.java xerces/java/branches/xml-schema-1.1-dev/samples/xni/PSVIWriter.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/dv/xs/XSSimpleTypeDelegate.java xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/xs/XSFacet.java xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/xs/XSMultiValueFacet.java xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/xs/XSSimpleTypeDefinition.java Modified: xerces/java/branches/xml-schema-1.1-dev/samples/simpletype/SimpleTypeUsage.java URL: http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/samples/simpletype/SimpleTypeUsage.java?rev=885821r1=885820r2=885821view=diff == --- xerces/java/branches/xml-schema-1.1-dev/samples/simpletype/SimpleTypeUsage.java (original) +++ xerces/java/branches/xml-schema-1.1-dev/samples/simpletype/SimpleTypeUsage.java Tue Dec 1 16:24:10 2009 @@ -191,7 +191,7 @@ // 'facets' property // gives bit combination of the constants defined in XSSimpleType interface. -int facets = simpleType.getDefinedFacets() ; +short facets = simpleType.getDefinedFacets() ; printFacets(facets); //'final' property @@ -270,7 +270,7 @@ }//printCardinality() -void printFacets(int facets){ +void printFacets(short facets){ System.err.println('facets' present \t\t: ); Modified: xerces/java/branches/xml-schema-1.1-dev/samples/xni/PSVIWriter.java URL: http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/samples/xni/PSVIWriter.java?rev=885821r1=885820r2=885821view=diff == --- xerces/java/branches/xml-schema-1.1-dev/samples/xni/PSVIWriter.java (original) +++ xerces/java/branches/xml-schema-1.1-dev/samples/xni/PSVIWriter.java Tue Dec 1 16:24:10 2009 @@ -2118,7 +2118,7 @@ } } -private String translateFacetKind(int kind) { +private String translateFacetKind(short kind) { switch (kind) { case XSSimpleTypeDefinition.FACET_WHITESPACE : return SchemaSymbols.ELT_WHITESPACE; 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=885821r1=885820r2=885821view=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 Tue Dec 1 16:24:10 2009 @@ -263,8 +263,8 @@ private short fVariety = -1; private short fValidationDV = -1; -private int fFacetsDefined = 0; -private int fFixedFacet = 0; +private short fFacetsDefined = 0; +private short fFixedFacet = 0; //for constraining facets private short fWhiteSpace = 0; @@ -2161,7 +2161,7 @@ * @param facetName The name of the facet. * @return True if the facet is defined, false otherwise. */ -public boolean isDefinedFacet(int facetName) { +public boolean isDefinedFacet(short facetName) { if ((fFacetsDefined facetName) != 0) return true; if (fPatternType != SPECIAL_PATTERN_NONE) @@ -2175,11 +2175,11 @@ * [facets]: all facets defined on this type. The value is a bit * combination of FACET_XXX constants of all defined facets. */ -public int getDefinedFacets() { +public short getDefinedFacets() { if (fPatternType != SPECIAL_PATTERN_NONE) -return fFacetsDefined | FACET_PATTERN; +return (short)(fFacetsDefined | FACET_PATTERN); if (fValidationDV == DV_INTEGER) -return fFacetsDefined | FACET_PATTERN | FACET_FRACTIONDIGITS; +return (short)(fFacetsDefined | FACET_PATTERN | FACET_FRACTIONDIGITS); return fFacetsDefined; } @@ -2189,7 +2189,7 @@ * @param facetName The name of the facet. * @return True if the facet is fixed, false otherwise. */ -public boolean isFixedFacet(int facetName) { +public boolean isFixedFacet(short facetName) { if ((fFixedFacet facetName) != 0) return true; if (fValidationDV == DV_INTEGER) @@ -2200,9 +2200,9 @@ /** * [facets]: all defined facets for this type which are fixed. */ -public
svn commit: r884565 [2/2] - in /xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces: dom/ impl/ impl/dv/xs/ impl/xs/
Modified: xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/XSModelImpl.java URL: http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/XSModelImpl.java?rev=884565r1=884564r2=884565view=diff == --- xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/XSModelImpl.java (original) +++ xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/XSModelImpl.java Thu Nov 26 14:28:33 2009 @@ -42,6 +42,7 @@ import org.apache.xerces.xs.XSNamespaceItem; import org.apache.xerces.xs.XSNamespaceItemList; import org.apache.xerces.xs.XSNotationDeclaration; +import org.apache.xerces.xs.XSObject; import org.apache.xerces.xs.XSObjectList; import org.apache.xerces.xs.XSTypeDefinition; @@ -193,7 +194,7 @@ fSubGroupMap = buildSubGroups(s4sVersion); } -private SymbolHash buildSubGroups(short s4sVersion) { +private SymbolHash buildSubGroups_Org(short s4sVersion) { SubstitutionGroupHandler sgHandler = new SubstitutionGroupHandler(null); for (int i = 0 ; i fGrammarCount; i++) { sgHandler.addSubstitutionGroup(fGrammarList[i].getSubstitutionGroups()); @@ -213,6 +214,50 @@ return subGroupMap; } +private SymbolHash buildSubGroups(short s4sVersion) { +SubstitutionGroupHandler sgHandler = new SubstitutionGroupHandler(null); +for (int i = 0 ; i fGrammarCount; i++) { + sgHandler.addSubstitutionGroup(fGrammarList[i].getSubstitutionGroups()); +} + +final XSObjectListImpl elements = getGlobalElements(); +final int len = elements.getLength(); +final SymbolHash subGroupMap = new SymbolHash(len*2); +XSElementDecl head; +XSElementDeclaration[] subGroup; +for (int i = 0; i len; i++) { +head = (XSElementDecl)elements.item(i); +subGroup = sgHandler.getSubstitutionGroup(head, s4sVersion); +subGroupMap.put(head, subGroup.length 0 ? +new XSObjectListImpl(subGroup, subGroup.length) : XSObjectListImpl.EMPTY_LIST); +} +return subGroupMap; +} + +private XSObjectListImpl getGlobalElements() { +final SymbolHash[] tables = new SymbolHash[fGrammarCount]; +int length = 0; + +for (int i = 0; i fGrammarCount; i++) { +tables[i] = fGrammarList[i].fAllGlobalElemDecls; +length += tables[i].getLength(); +} + +if (length == 0) { +return XSObjectListImpl.EMPTY_LIST; +} + +final XSObject[] components = new XSObject[length]; + +int start = 0; +for (int i = 0; i fGrammarCount; i++) { +tables[i].getValues(components, start); +start += tables[i].getLength(); +} + +return new XSObjectListImpl(components, length); +} + /** * Convenience method. Returns a list of all namespaces that belong to * this schema. @@ -392,6 +437,25 @@ } /** + * Convenience method. Returns a top-level simple or complex type + * definition. + * @param name The name of the definition. + * @param namespace The namespace of the definition, otherwise null. + * @param loc The schema location where the component was defined + * @return An codeXSTypeDefinition/code or null if such definition + * does not exist. + */ +public XSTypeDefinition getTypeDefinition(String name, + String namespace, + String loc) { +SchemaGrammar sg = (SchemaGrammar)fGrammarMap.get(null2EmptyString(namespace)); +if (sg == null) { +return null; +} +return sg.getGlobalTypeDecl(name, loc); +} + +/** * Convenience method. Returns a top-level attribute declaration. * @param name The name of the declaration. * @param namespace The namespace of the definition, otherwise null. @@ -408,6 +472,24 @@ } /** + * Convenience method. Returns a top-level attribute declaration. + * @param name The name of the declaration. + * @param namespace The namespace of the definition, otherwise null. + * @param loc The schema location where the component was defined + * @return A top-level attribute declaration or null if such declaration + * does not exist. + */ +public XSAttributeDeclaration getAttributeDeclaration(String name, + String namespace, + String loc) { +SchemaGrammar sg = (SchemaGrammar)fGrammarMap.get(null2EmptyString(namespace)); +if (sg == null) { +return null; +} +return sg.getGlobalAttributeDecl(name, loc); +} + +/**
svn commit: r883487 - /xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/dom/
Author: knoaman Date: Mon Nov 23 20:28:10 2009 New Revision: 883487 URL: http://svn.apache.org/viewvc?rev=883487view=rev Log: Various DOM changes - Keep 1.1 branch up to date with Xerces-J trunk Modified: xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/dom/AttributeMap.java xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/dom/DOMImplementationListImpl.java xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/dom/DOMImplementationSourceImpl.java xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/dom/DOMNormalizer.java xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/dom/DOMXSImplementationSourceImpl.java xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/dom/DeepNodeListImpl.java xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/dom/DeferredDocumentImpl.java xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/dom/NamedNodeMapImpl.java Modified: xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/dom/AttributeMap.java URL: http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/dom/AttributeMap.java?rev=883487r1=883486r2=883487view=diff == --- xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/dom/AttributeMap.java (original) +++ xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/dom/AttributeMap.java Mon Nov 23 20:28:10 2009 @@ -17,7 +17,8 @@ package org.apache.xerces.dom; -import java.util.Vector; +import java.util.ArrayList; +import java.util.List; import org.w3c.dom.DOMException; import org.w3c.dom.Node; @@ -105,8 +106,8 @@ int i = findNamePoint(argn.getNodeName(),0); AttrImpl previous = null; if (i = 0) { -previous = (AttrImpl) nodes.elementAt(i); -nodes.setElementAt(arg,i); +previous = (AttrImpl) nodes.get(i); +nodes.set(i, arg); previous.ownerNode = ownerNode.ownerDocument(); previous.isOwned(false); // make sure it won't be mistaken with defaults in case it's reused @@ -114,9 +115,9 @@ } else { i = -1 - i; // Insert point (may be end of list) if (null == nodes) { -nodes = new Vector(5, 10); +nodes = new ArrayList(5); } -nodes.insertElementAt(arg, i); +nodes.add(i, arg); } // notify document @@ -174,8 +175,8 @@ int i = findNamePoint(argn.getNamespaceURI(), argn.getLocalName()); AttrImpl previous = null; if (i = 0) { -previous = (AttrImpl) nodes.elementAt(i); -nodes.setElementAt(arg,i); +previous = (AttrImpl) nodes.get(i); +nodes.set(i, arg); previous.ownerNode = ownerNode.ownerDocument(); previous.isOwned(false); // make sure it won't be mistaken with defaults in case it's reused @@ -185,14 +186,14 @@ // nodeName so we know where to insert. i = findNamePoint(arg.getNodeName(),0); if (i =0) { -previous = (AttrImpl) nodes.elementAt(i); -nodes.insertElementAt(arg,i); +previous = (AttrImpl) nodes.get(i); +nodes.add(i, arg); } else { i = -1 - i; // Insert point (may be end of list) if (null == nodes) { -nodes = new Vector(5, 10); +nodes = new ArrayList(5); } -nodes.insertElementAt(arg, i); +nodes.add(i, arg); } } // changed(true); @@ -253,8 +254,9 @@ int index = -1; if (nodes != null) { -for (int i = 0; i nodes.size(); i++) { -if (nodes.elementAt(i) == item) { +final int size = nodes.size(); +for (int i = 0; i size; ++i) { +if (nodes.get(i) == item) { index = i; break; } @@ -287,7 +289,7 @@ } } -return remove((AttrImpl)nodes.elementAt(i), i, true); +return remove((AttrImpl)nodes.get(i), i, true); } // internalRemoveNamedItem(String,boolean):Node @@ -321,16 +323,16 @@ clone.isOwned(true); clone.isSpecified(false); -nodes.setElementAt(clone, index); +nodes.set(index, clone); if (attr.isIdAttribute()) { ownerDocument.putIdentifier(clone.getNodeValue(), (ElementImpl)ownerNode); } } else { -nodes.removeElementAt(index); +nodes.remove(index
svn commit: r883491 - in /xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dtd: DTDGrammar.java XMLDTDDescription.java XMLDTDProcessor.java
Author: knoaman Date: Mon Nov 23 20:32:14 2009 New Revision: 883491 URL: http://svn.apache.org/viewvc?rev=883491view=rev Log: Use ArrayList and HashMap instead of Vector and HashTable - Keep 1.1 branch up to date with Xerces-J trunk Modified: xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dtd/DTDGrammar.java xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dtd/XMLDTDDescription.java xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dtd/XMLDTDProcessor.java Modified: xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dtd/DTDGrammar.java URL: http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dtd/DTDGrammar.java?rev=883491r1=883490r2=883491view=diff == --- xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dtd/DTDGrammar.java (original) +++ xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dtd/DTDGrammar.java Mon Nov 23 20:32:14 2009 @@ -17,8 +17,8 @@ package org.apache.xerces.impl.dtd; +import java.util.ArrayList; import java.util.Hashtable; -import java.util.Vector; import org.apache.xerces.impl.dtd.models.CMAny; import org.apache.xerces.impl.dtd.models.CMBinOp; @@ -790,16 +790,17 @@ public void endDTD(Augmentations augs) throws XNIException { fIsImmutable = true; // make sure our description contains useful stuff... -if(fGrammarDescription.getRootName() == null) { +if (fGrammarDescription.getRootName() == null) { // we don't know what the root is; so use possibleRoots... int chunk, index = 0; String currName = null; -Vector elements = new Vector(); -for (int i=0; i fElementDeclCount; i++) { +final int size = fElementDeclCount; +ArrayList elements = new ArrayList(size); +for (int i = 0; i size; ++i) { chunk = i CHUNK_SHIFT; index = i CHUNK_MASK; currName = fElementDeclName[chunk][index].rawname; -elements.addElement(currName); +elements.add(currName); } fGrammarDescription.setPossibleRoots(elements); } Modified: xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dtd/XMLDTDDescription.java URL: http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dtd/XMLDTDDescription.java?rev=883491r1=883490r2=883491view=diff == --- xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dtd/XMLDTDDescription.java (original) +++ xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dtd/XMLDTDDescription.java Mon Nov 23 20:32:14 2009 @@ -17,6 +17,7 @@ package org.apache.xerces.impl.dtd; +import java.util.ArrayList; import java.util.Vector; import org.apache.xerces.util.XMLResourceIdentifierImpl; @@ -43,7 +44,7 @@ // if we don't know the root name, this stores all elements that // could serve; fPossibleRoots and fRootName cannot both be non-null -protected Vector fPossibleRoots = null; +protected ArrayList fPossibleRoots = null; // Constructors: public XMLDTDDescription(XMLResourceIdentifier id, String rootName) { @@ -85,11 +86,16 @@ fRootName = rootName; fPossibleRoots = null; } + +/** Set possible roots **/ +public void setPossibleRoots(ArrayList possibleRoots) { +fPossibleRoots = possibleRoots; +} /** Set possible roots **/ public void setPossibleRoots(Vector possibleRoots) { -fPossibleRoots = possibleRoots; -} +fPossibleRoots = (possibleRoots != null) ? new ArrayList(possibleRoots) : null; +} /** * Compares this grammar with the given grammar. Currently, we compare @@ -105,49 +111,58 @@ * @return True if they are equal, else false */ public boolean equals(Object desc) { -if(!(desc instanceof XMLGrammarDescription)) return false; +if (!(desc instanceof XMLGrammarDescription)) return false; if (!getGrammarType().equals(((XMLGrammarDescription)desc).getGrammarType())) { return false; } // assume it's a DTDDescription XMLDTDDescription dtdDesc = (XMLDTDDescription)desc; -if(fRootName != null) { -if((dtdDesc.fRootName) != null !dtdDesc.fRootName.equals(fRootName)) { +if (fRootName != null) { +if ((dtdDesc.fRootName) != null !dtdDesc.fRootName.equals(fRootName)) { return false; -} else if(dtdDesc.fPossibleRoots != null !dtdDesc.fPossibleRoots.contains(fRootName)) { +} +else if (dtdDesc.fPossibleRoots != null
svn commit: r883493 - in /xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces: util/ xpointer/
Author: knoaman Date: Mon Nov 23 20:39:18 2009 New Revision: 883493 URL: http://svn.apache.org/viewvc?rev=883493view=rev Log: Make some classes final and use some different data structures - Keep 1.1 branch up to date with Xerces-J trunk Modified: xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/util/AugmentationsImpl.java xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/xpointer/ElementSchemePointer.java xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/xpointer/ShortHandPointer.java xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/xpointer/XPointerErrorHandler.java xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/xpointer/XPointerHandler.java xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/xpointer/XPointerMessageFormatter.java Modified: xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/util/AugmentationsImpl.java URL: http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/util/AugmentationsImpl.java?rev=883493r1=883492r2=883493view=diff == --- xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/util/AugmentationsImpl.java (original) +++ xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/util/AugmentationsImpl.java Mon Nov 23 20:39:18 2009 @@ -17,8 +17,11 @@ package org.apache.xerces.util; +import java.util.Collections; import java.util.Enumeration; -import java.util.Hashtable; +import java.util.HashMap; +import java.util.Iterator; +import java.util.Map; import org.apache.xerces.xni.Augmentations; @@ -57,7 +60,6 @@ return oldValue; } - /** * Get information identified by a key from the Augmentations structure * @@ -70,7 +72,6 @@ return fAugmentationsContainer.getItem(key); } - /** * Remove additional info from the Augmentations structure * @@ -99,7 +100,7 @@ return fAugmentationsContainer.toString(); } -abstract class AugmentationsItemsContainer { +static abstract class AugmentationsItemsContainer { abstract public Object putItem(Object key, Object item); abstract public Object getItem(Object key); abstract public Object removeItem(Object key); @@ -109,7 +110,8 @@ abstract public AugmentationsItemsContainer expand(); } -class SmallContainer extends AugmentationsItemsContainer { +final static class SmallContainer extends AugmentationsItemsContainer { + final static int SIZE_LIMIT = 10; final Object[] fAugmentations = new Object[SIZE_LIMIT*2]; int fNumEntries = 0; @@ -209,7 +211,8 @@ return buff.toString(); } -class SmallContainerKeyEnumeration implements Enumeration { +final class SmallContainerKeyEnumeration implements Enumeration { + Object [] enumArray = new Object[fNumEntries]; int next = 0; @@ -237,8 +240,9 @@ } } -class LargeContainer extends AugmentationsItemsContainer { -final Hashtable fAugmentations = new Hashtable(); +final static class LargeContainer extends AugmentationsItemsContainer { + +private final HashMap fAugmentations = new HashMap(); public Object getItem(Object key) { return fAugmentations.get(key); @@ -253,7 +257,7 @@ } public Enumeration keys() { -return fAugmentations.keys(); +return Collections.enumeration(fAugmentations.keySet()); } public void clear() { @@ -271,16 +275,14 @@ public String toString() { StringBuffer buff = new StringBuffer(); buff.append(LargeContainer); -Enumeration keys = fAugmentations.keys(); - -while (keys.hasMoreElements()) { -Object key = keys.nextElement(); +Iterator entries = fAugmentations.entrySet().iterator(); +while (entries.hasNext()) { +Map.Entry entry = (Map.Entry) entries.next(); buff.append(\nkey == ); -buff.append(key); +buff.append(entry.getKey()); buff.append(; value == ); -buff.append(fAugmentations.get(key)); +buff.append(entry.getValue()); } - return buff.toString(); } } Modified: xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/xpointer/ElementSchemePointer.java URL: http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/xpointer/ElementSchemePointer.java?rev=883493r1=883492r2=883493view=diff == --- xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/xpointer/ElementSchemePointer.java
svn commit: r883496 - /xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/validation/ValidationManager.java
Author: knoaman Date: Mon Nov 23 20:46:00 2009 New Revision: 883496 URL: http://svn.apache.org/viewvc?rev=883496view=rev Log: Use ArrayList of Vector - Keep 1.1 branch up to date with Xerces-J trunk Modified: xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/validation/ValidationManager.java Modified: xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/validation/ValidationManager.java URL: http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/validation/ValidationManager.java?rev=883496r1=883495r2=883496view=diff == --- xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/validation/ValidationManager.java (original) +++ xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/validation/ValidationManager.java Mon Nov 23 20:46:00 2009 @@ -17,7 +17,7 @@ package org.apache.xerces.impl.validation; -import java.util.Vector; +import java.util.ArrayList; /** * ValidationManager is a coordinator property for validators in the @@ -33,7 +33,7 @@ */ public class ValidationManager { -protected final Vector fVSs = new Vector(); +protected final ArrayList fVSs = new ArrayList(); protected boolean fGrammarFound = false; // used by the DTD validator to tell other components that it has a @@ -46,7 +46,7 @@ * the validation manager. */ public final void addValidationState(ValidationState vs) { -fVSs.addElement(vs); +fVSs.add(vs); } /** @@ -54,7 +54,7 @@ */ public final void setEntityState(EntityState state) { for (int i = fVSs.size()-1; i = 0; i--) { -((ValidationState)fVSs.elementAt(i)).setEntityState(state); +((ValidationState)fVSs.get(i)).setEntityState(state); } } @@ -75,8 +75,8 @@ } // isCachedDTD(): boolean -public final void reset (){ -fVSs.removeAllElements(); +public final void reset () { +fVSs.clear(); fGrammarFound = false; fCachedDTD = false; } - To unsubscribe, e-mail: commits-unsubscr...@xerces.apache.org For additional commands, e-mail: commits-h...@xerces.apache.org
svn commit: r883497 - /xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/util/SymbolHash.java
Author: knoaman Date: Mon Nov 23 20:49:53 2009 New Revision: 883497 URL: http://svn.apache.org/viewvc?rev=883497view=rev Log: Return key/value pairs of all entries in the map - Keep 1.1 branch up to date with Xerces-J trunk Modified: xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/util/SymbolHash.java Modified: xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/util/SymbolHash.java URL: http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/util/SymbolHash.java?rev=883497r1=883496r2=883497view=diff == --- xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/util/SymbolHash.java (original) +++ xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/util/SymbolHash.java Mon Nov 23 20:49:53 2009 @@ -133,7 +133,22 @@ } return fNum; } - + +/** + * Return key/value pairs of all entries in the map + */ +public Object[] getEntries() { +Object[] entries = new Object[fNum 1]; +for (int i=0, j=0; ifTableSize jfNum 1; i++) { +for (Entry entry = fBuckets[i]; entry != null; entry = entry.next) { +entries[j] = entry.key; +entries[++j] = entry.value; +j++; +} +} +return entries; +} + /** * Make a clone of this object. */ - To unsubscribe, e-mail: commits-unsubscr...@xerces.apache.org For additional commands, e-mail: commits-h...@xerces.apache.org
svn propchange: r883496 - svn:log
Author: knoaman Revision: 883496 Modified property: svn:log Modified: svn:log at Mon Nov 23 20:53:07 2009 -- --- svn:log (original) +++ svn:log Mon Nov 23 20:53:07 2009 @@ -1 +1 @@ -Use ArrayList of Vector - Keep 1.1 branch up to date with Xerces-J trunk +Use ArrayList instead of Vector - Keep 1.1 branch up to date with Xerces-J trunk - To unsubscribe, e-mail: commits-unsubscr...@xerces.apache.org For additional commands, e-mail: commits-h...@xerces.apache.org
svn commit: r835407 - /xerces/java/trunk/src/org/apache/xerces/impl/xpath/regex/RegexParser.java
Author: knoaman Date: Thu Nov 12 15:05:45 2009 New Revision: 835407 URL: http://svn.apache.org/viewvc?rev=835407view=rev Log: Allow character class subtraction in the normal mode Modified: xerces/java/trunk/src/org/apache/xerces/impl/xpath/regex/RegexParser.java Modified: xerces/java/trunk/src/org/apache/xerces/impl/xpath/regex/RegexParser.java URL: http://svn.apache.org/viewvc/xerces/java/trunk/src/org/apache/xerces/impl/xpath/regex/RegexParser.java?rev=835407r1=835406r2=835407view=diff == --- xerces/java/trunk/src/org/apache/xerces/impl/xpath/regex/RegexParser.java (original) +++ xerces/java/trunk/src/org/apache/xerces/impl/xpath/regex/RegexParser.java Thu Nov 12 15:05:45 2009 @@ -177,8 +177,9 @@ break; case '-': -if (this.isSet(RegularExpression.XMLSCHEMA_MODE) - this.offset this.regexlen this.regex.charAt(this.offset) == '[') { +// Allow character class subtraction (regardless of whether we are in +// XML Schema mode or not) +if (this.offset this.regexlen this.regex.charAt(this.offset) == '[') { this.offset++; ret = T_XMLSCHEMA_CC_SUBTRACTION; } else @@ -887,7 +888,6 @@ while ((type = this.read()) != T_EOF) { if (type == T_CHAR this.chardata == ']' !firstloop) break; -firstloop = false; int c = this.chardata; boolean end = false; if (type == T_BACKSOLIDUS) { @@ -937,6 +937,24 @@ throw this.ex(parser.cc.1, nameend); this.offset = nameend+2; } +else if (type == T_XMLSCHEMA_CC_SUBTRACTION !firstloop) { +if (nrange) { +nrange = false; +if (useNrange) { +tok = (RangeToken) Token.complementRanges(tok); +} +else { +base.subtractRanges(tok); +tok = base; +} +} +RangeToken range2 = this.parseCharacterClass(false); +tok.subtractRanges(range2); +if (this.read() != T_CHAR || this.chardata != ']') { +throw this.ex(parser.cc.5, this.offset); +} +break; // Exit this loop +} this.next(); if (!end) { // if not shorthands... if (this.read() != T_CHAR || this.chardata != '-') { // Here is no '-'. @@ -946,7 +964,11 @@ else { addCaseInsensitiveChar(tok, c); } -} else { +} +else if (type == T_XMLSCHEMA_CC_SUBTRACTION) { +throw this.ex(parser.cc.8, this.offset-1); +} +else { this.next(); // Skips '-' if ((type = this.read()) == T_EOF) throw this.ex(parser.cc.2, this.offset); if (type == T_CHAR this.chardata == ']') { @@ -959,9 +981,13 @@ tok.addRange('-', '-'); } else { int rangeend = this.chardata; -if (type == T_BACKSOLIDUS) +if (type == T_BACKSOLIDUS) { rangeend = this.decodeEscaped(); +} this.next(); +if (c rangeend) { +throw this.ex(parser.ope.3, this.offset-1); +} if (!this.isSet(RegularExpression.IGNORE_CASE) || (c 0x rangeend 0x)) { tok.addRange(c, rangeend); @@ -973,22 +999,21 @@ } } if (this.isSet(RegularExpression.SPECIAL_COMMA) - this.read() == T_CHAR this.chardata == ',') + this.read() == T_CHAR this.chardata == ',') { this.next(); +} +firstloop = false; } -if (this.read() == T_EOF) +if (this.read() == T_EOF) { throw this.ex(parser.cc.2, this.offset); +} + if (!useNrange nrange) { base.subtractRanges(tok); tok = base; } tok.sortRanges(); tok.compactRanges(); -//tok.dumpRanges(); -/* -if (this.isSet(RegularExpression.IGNORE_CASE)) -tok = RangeToken.createCaseInsensitiveToken(tok); -*/ this.setContext(S_NORMAL); this.next();// Skips
svn commit: r835408 - /xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xpath/regex/RegexParser.java
Author: knoaman Date: Thu Nov 12 15:06:18 2009 New Revision: 835408 URL: http://svn.apache.org/viewvc?rev=835408view=rev Log: Allow character class subtraction in the normal mode Modified: xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xpath/regex/RegexParser.java Modified: xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xpath/regex/RegexParser.java URL: http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xpath/regex/RegexParser.java?rev=835408r1=835407r2=835408view=diff == --- xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xpath/regex/RegexParser.java (original) +++ xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xpath/regex/RegexParser.java Thu Nov 12 15:06:18 2009 @@ -177,8 +177,9 @@ break; case '-': -if (this.isSet(RegularExpression.XMLSCHEMA_MODE) - this.offset this.regexlen this.regex.charAt(this.offset) == '[') { +// Allow character class subtraction (regardless of whether we are in +// XML Schema mode or not) +if (this.offset this.regexlen this.regex.charAt(this.offset) == '[') { this.offset++; ret = T_XMLSCHEMA_CC_SUBTRACTION; } else @@ -887,7 +888,6 @@ while ((type = this.read()) != T_EOF) { if (type == T_CHAR this.chardata == ']' !firstloop) break; -firstloop = false; int c = this.chardata; boolean end = false; if (type == T_BACKSOLIDUS) { @@ -937,6 +937,24 @@ throw this.ex(parser.cc.1, nameend); this.offset = nameend+2; } +else if (type == T_XMLSCHEMA_CC_SUBTRACTION !firstloop) { +if (nrange) { +nrange = false; +if (useNrange) { +tok = (RangeToken) Token.complementRanges(tok); +} +else { +base.subtractRanges(tok); +tok = base; +} +} +RangeToken range2 = this.parseCharacterClass(false); +tok.subtractRanges(range2); +if (this.read() != T_CHAR || this.chardata != ']') { +throw this.ex(parser.cc.5, this.offset); +} +break; // Exit this loop +} this.next(); if (!end) { // if not shorthands... if (this.read() != T_CHAR || this.chardata != '-') { // Here is no '-'. @@ -946,7 +964,11 @@ else { addCaseInsensitiveChar(tok, c); } -} else { +} +else if (type == T_XMLSCHEMA_CC_SUBTRACTION) { +throw this.ex(parser.cc.8, this.offset-1); +} +else { this.next(); // Skips '-' if ((type = this.read()) == T_EOF) throw this.ex(parser.cc.2, this.offset); if (type == T_CHAR this.chardata == ']') { @@ -959,9 +981,13 @@ tok.addRange('-', '-'); } else { int rangeend = this.chardata; -if (type == T_BACKSOLIDUS) +if (type == T_BACKSOLIDUS) { rangeend = this.decodeEscaped(); +} this.next(); +if (c rangeend) { +throw this.ex(parser.ope.3, this.offset-1); +} if (!this.isSet(RegularExpression.IGNORE_CASE) || (c 0x rangeend 0x)) { tok.addRange(c, rangeend); @@ -973,22 +999,21 @@ } } if (this.isSet(RegularExpression.SPECIAL_COMMA) - this.read() == T_CHAR this.chardata == ',') + this.read() == T_CHAR this.chardata == ',') { this.next(); +} +firstloop = false; } -if (this.read() == T_EOF) +if (this.read() == T_EOF) { throw this.ex(parser.cc.2, this.offset); +} + if (!useNrange nrange) { base.subtractRanges(tok); tok = base; } tok.sortRanges(); tok.compactRanges(); -//tok.dumpRanges(); -/* -if (this.isSet(RegularExpression.IGNORE_CASE)) -tok = RangeToken.createCaseInsensitiveToken(tok); -*/ this.setContext
svn commit: r834488 - in /xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xpath/regex: CaseInsensitiveMap.java RegexParser.java
Author: knoaman Date: Tue Nov 10 14:59:43 2009 New Revision: 834488 URL: http://svn.apache.org/viewvc?rev=834488view=rev Log: A further fix for JIRA Issue #1389: http://issues.apache.org/jira/browse/XERCESJ-1389. [Case insensitive matching] Added: xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xpath/regex/CaseInsensitiveMap.java (with props) Modified: xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xpath/regex/RegexParser.java Added: xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xpath/regex/CaseInsensitiveMap.java URL: http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xpath/regex/CaseInsensitiveMap.java?rev=834488view=auto == --- xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xpath/regex/CaseInsensitiveMap.java (added) +++ xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xpath/regex/CaseInsensitiveMap.java Tue Nov 10 14:59:43 2009 @@ -0,0 +1,171 @@ +/* + * 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$ + */ +public class CaseInsensitiveMap { + +private static int CHUNK_SHIFT = 10; /* 2^10 = 1k */ +private static int CHUNK_SIZE = (1CHUNK_SHIFT); +private static int CHUNK_MASK = (CHUNK_SIZE-1); +private static int INITIAL_CHUNK_COUNT = 64; /* up to 0x */ + +private static int[][][] caseInsensitiveMap; +private static Boolean mapBuilt = Boolean.FALSE; + +private static int LOWER_CASE_MATCH = 1; +private static int UPPER_CASE_MATCH = 2; + +/** + * Return a list of code point characters (not including the input value) + * that can be substituted in a case insensitive match + */ +static public int[] get(int codePoint) { +if (mapBuilt == Boolean.FALSE) { +synchronized (mapBuilt) { +if (mapBuilt == Boolean.FALSE) { +buildCaseInsensitiveMap(); +} +} // synchronized +} // if mapBuilt + +return (codePoint 0x1) ? getMapping(codePoint) : null; +} + +private static int[] getMapping(int codePoint) { +int chunk = codePoint CHUNK_SHIFT; +int offset = codePoint CHUNK_MASK; + +return caseInsensitiveMap[chunk][offset]; +} + +private static void buildCaseInsensitiveMap() { +caseInsensitiveMap = new int[INITIAL_CHUNK_COUNT][][]; +for (int i=0; iINITIAL_CHUNK_COUNT; i++) { +caseInsensitiveMap[i] = new int[CHUNK_SIZE][]; +} + +int lc, uc; +for (int i=0; i0x1; i++) { +lc = Character.toLowerCase(i); +uc = Character.toUpperCase(i); + +// lower/upper case value is not the same as code point +if (lc != uc || lc != i) { +int[] map = new int[2]; +int index = 0; + +if (lc != i) { +map[index++] = lc; +map[index++] = LOWER_CASE_MATCH; +int[] lcMap = getMapping(lc); +if (lcMap != null) { +map = updateMap(i, map, lc, lcMap, LOWER_CASE_MATCH); +} +} + +if (uc != i) { +if (index == map.length) { +map = expandMap(map, 2); +} +map[index++] = uc; +map[index++] = UPPER_CASE_MATCH; +int[] ucMap = getMapping(uc); +if (ucMap != null) { +map = updateMap(i, map, uc, ucMap, UPPER_CASE_MATCH); +} +} + +set(i, map); +} +} + +mapBuilt = Boolean.TRUE; +} + +private static int[] expandMap(int[] srcMap, int expandBy) { +final int oldLen = srcMap.length; +int[] newMap = new int[oldLen + expandBy]; + +System.arraycopy(srcMap, 0, newMap, 0, oldLen
svn commit: r827769 - /xerces/java/trunk/src/org/apache/xerces/impl/xpath/regex/RangeToken.java
Author: knoaman Date: Tue Oct 20 19:47:53 2009 New Revision: 827769 URL: http://svn.apache.org/viewvc?rev=827769view=rev Log: Fix a problem with range tokens where lower case characters where not added (in a case insensitive mode) Modified: xerces/java/trunk/src/org/apache/xerces/impl/xpath/regex/RangeToken.java Modified: xerces/java/trunk/src/org/apache/xerces/impl/xpath/regex/RangeToken.java URL: http://svn.apache.org/viewvc/xerces/java/trunk/src/org/apache/xerces/impl/xpath/regex/RangeToken.java?rev=827769r1=827768r2=827769view=diff == --- xerces/java/trunk/src/org/apache/xerces/impl/xpath/regex/RangeToken.java (original) +++ xerces/java/trunk/src/org/apache/xerces/impl/xpath/regex/RangeToken.java Tue Oct 20 19:47:53 2009 @@ -462,7 +462,7 @@ if (ch 0x) lowers.addRange(ch, ch); else { -char uch = Character.toUpperCase((char)ch); +char uch = Character.toLowerCase((char)ch); lowers.addRange(uch, uch); } } - To unsubscribe, e-mail: commits-unsubscr...@xerces.apache.org For additional commands, e-mail: commits-h...@xerces.apache.org
svn commit: r821796 - /xerces/java/trunk/src/org/apache/xerces/impl/xs/traversers/XSDHandler.java
Author: knoaman Date: Mon Oct 5 13:34:13 2009 New Revision: 821796 URL: http://svn.apache.org/viewvc?rev=821796view=rev Log: Fix for error when processing redefined schemas that redefine others Modified: xerces/java/trunk/src/org/apache/xerces/impl/xs/traversers/XSDHandler.java Modified: xerces/java/trunk/src/org/apache/xerces/impl/xs/traversers/XSDHandler.java URL: http://svn.apache.org/viewvc/xerces/java/trunk/src/org/apache/xerces/impl/xs/traversers/XSDHandler.java?rev=821796r1=821795r2=821796view=diff == --- xerces/java/trunk/src/org/apache/xerces/impl/xs/traversers/XSDHandler.java (original) +++ xerces/java/trunk/src/org/apache/xerces/impl/xs/traversers/XSDHandler.java Mon Oct 5 13:34:13 2009 @@ -263,6 +263,19 @@ private Hashtable fUnparsedIdentityConstraintRegistrySub = new Hashtable(); private Hashtable fUnparsedNotationRegistrySub = new Hashtable(); private Hashtable fUnparsedTypeRegistrySub = new Hashtable(); + +// Stores XSDocumentInfo (keyed by component name), to check for duplicate +// components declared withing the same xsd document +private Hashtable fUnparsedRegistriesExt[] = new Hashtable[] { +null, +new Hashtable(), // ATTRIBUTE_TYPE +new Hashtable(), // ATTRIBUTEGROUP_TYPE +new Hashtable(), // ELEMENT_TYPE +new Hashtable(), // GROUP_TYPE +new Hashtable(), // IDENTITYCONSTRAINT_TYPE +new Hashtable(), // NOTATION_TYPE +new Hashtable(), // TYPEDECL_TYPE +}; // this is keyed with a documentNode (or the schemaRoot nodes // contained in the XSDocumentInfo objects) and its value is the @@ -3371,7 +3384,11 @@ fUnparsedIdentityConstraintRegistrySub.clear(); fUnparsedNotationRegistrySub.clear(); fUnparsedTypeRegistrySub.clear(); - + +for (int i=1; i= TYPEDECL_TYPE; i++) { +fUnparsedRegistriesExt[i].clear(); +} + fXSDocumentInfoRegistry.clear(); fDependencyMap.clear(); fDoc2XSDocumentMap.clear(); @@ -3625,7 +3642,7 @@ fParent[fLocalElemStackPos] = parent; fLocalElemNamespaceContext[fLocalElemStackPos++] = schemaDoc.fNamespaceSupport.getEffectiveLocalContext(); } // end fillInLocalElemInfo(...) - + /** This method makes sure that * if this component is being redefined that it lives in the * right schema. It then renames the component correctly. If it @@ -3646,6 +3663,9 @@ if (fNamespaceGrowth !fTolerateDuplicates) { checkForDuplicateNames(qName, declType, currComp); } +// just add it in! +registry.put(qName, currComp); +registry_sub.put(qName, currSchema); } else { Element collidingElem = (Element)objElem; @@ -3707,15 +3727,16 @@ // we've just got a flat-out collision (we tolerate duplicate // declarations, only if they are defined in different schema // documents) -if (!fTolerateDuplicates || registry_sub.get(qName) == currSchema) { +if (!fTolerateDuplicates || fUnparsedRegistriesExt[declType].get(qName) == currSchema) { reportSchemaError(sch-props-correct.2, new Object []{qName}, currComp); } } } -// we always add it in (override previous info, if any)! -registry.put(qName, currComp); -registry_sub.put(qName, currSchema); +// store the lastest current document info +if (fTolerateDuplicates) { +fUnparsedRegistriesExt[declType].put(qName, currSchema); +} } // checkForDuplicateNames(String, Hashtable, Element, XSDocumentInfo):void - To unsubscribe, e-mail: commits-unsubscr...@xerces.apache.org For additional commands, e-mail: commits-h...@xerces.apache.org
svn commit: r821797 - /xerces/java/trunk/src/org/apache/xerces/impl/xs/traversers/XSDHandler.java
Author: knoaman Date: Mon Oct 5 13:38:05 2009 New Revision: 821797 URL: http://svn.apache.org/viewvc?rev=821797view=rev Log: Fix typo Modified: xerces/java/trunk/src/org/apache/xerces/impl/xs/traversers/XSDHandler.java Modified: xerces/java/trunk/src/org/apache/xerces/impl/xs/traversers/XSDHandler.java URL: http://svn.apache.org/viewvc/xerces/java/trunk/src/org/apache/xerces/impl/xs/traversers/XSDHandler.java?rev=821797r1=821796r2=821797view=diff == --- xerces/java/trunk/src/org/apache/xerces/impl/xs/traversers/XSDHandler.java (original) +++ xerces/java/trunk/src/org/apache/xerces/impl/xs/traversers/XSDHandler.java Mon Oct 5 13:38:05 2009 @@ -265,7 +265,7 @@ private Hashtable fUnparsedTypeRegistrySub = new Hashtable(); // Stores XSDocumentInfo (keyed by component name), to check for duplicate -// components declared withing the same xsd document +// components declared within the same xsd document private Hashtable fUnparsedRegistriesExt[] = new Hashtable[] { null, new Hashtable(), // ATTRIBUTE_TYPE - To unsubscribe, e-mail: commits-unsubscr...@xerces.apache.org For additional commands, e-mail: commits-h...@xerces.apache.org
svn commit: r819653 - in /xerces/java/trunk/src/org/apache/xerces: impl/xs/ impl/xs/traversers/ util/
Author: knoaman Date: Mon Sep 28 17:29:56 2009 New Revision: 819653 URL: http://svn.apache.org/viewvc?rev=819653view=rev Log: Fix for defect 611261 Modified: xerces/java/trunk/src/org/apache/xerces/impl/xs/SchemaGrammar.java xerces/java/trunk/src/org/apache/xerces/impl/xs/XSModelImpl.java xerces/java/trunk/src/org/apache/xerces/impl/xs/traversers/XSDAttributeGroupTraverser.java xerces/java/trunk/src/org/apache/xerces/impl/xs/traversers/XSDAttributeTraverser.java xerces/java/trunk/src/org/apache/xerces/impl/xs/traversers/XSDComplexTypeTraverser.java xerces/java/trunk/src/org/apache/xerces/impl/xs/traversers/XSDElementTraverser.java xerces/java/trunk/src/org/apache/xerces/impl/xs/traversers/XSDGroupTraverser.java xerces/java/trunk/src/org/apache/xerces/impl/xs/traversers/XSDHandler.java xerces/java/trunk/src/org/apache/xerces/impl/xs/traversers/XSDKeyrefTraverser.java xerces/java/trunk/src/org/apache/xerces/impl/xs/traversers/XSDNotationTraverser.java xerces/java/trunk/src/org/apache/xerces/impl/xs/traversers/XSDSimpleTypeTraverser.java xerces/java/trunk/src/org/apache/xerces/impl/xs/traversers/XSDUniqueOrKeyTraverser.java xerces/java/trunk/src/org/apache/xerces/util/SymbolHash.java Modified: xerces/java/trunk/src/org/apache/xerces/impl/xs/SchemaGrammar.java URL: http://svn.apache.org/viewvc/xerces/java/trunk/src/org/apache/xerces/impl/xs/SchemaGrammar.java?rev=819653r1=819652r2=819653view=diff == --- xerces/java/trunk/src/org/apache/xerces/impl/xs/SchemaGrammar.java (original) +++ xerces/java/trunk/src/org/apache/xerces/impl/xs/SchemaGrammar.java Mon Sep 28 17:29:56 2009 @@ -98,6 +98,11 @@ SymbolHash fGlobalNotationDeclsExt; SymbolHash fGlobalIDConstraintDeclsExt; SymbolHash fGlobalTypeDeclsExt; + +// A global map of all global element declarations - used for substitution group computation +// (handy when sharing components by reference, since we might end up with duplicate components +// that are not added to either of the global element declarations above) +SymbolHash fAllGlobalElemDecls; // the XMLGrammarDescription member XSDDescription fGrammarDescription = null; @@ -156,6 +161,9 @@ fGlobalNotationDeclsExt = new SymbolHash(); fGlobalIDConstraintDeclsExt = new SymbolHash(); fGlobalTypeDeclsExt = new SymbolHash(); + +// All global elements table +fAllGlobalElemDecls = new SymbolHash(); // if we are parsing S4S, put built-in types in first // they might get overwritten by the types from S4S, but that's @@ -189,6 +197,9 @@ fGlobalNotationDeclsExt = grammar.fGlobalNotationDeclsExt.makeClone(); fGlobalIDConstraintDeclsExt = grammar.fGlobalIDConstraintDeclsExt.makeClone(); fGlobalTypeDeclsExt = grammar.fGlobalTypeDeclsExt.makeClone(); + +// All global elements table +fAllGlobalElemDecls = grammar.fAllGlobalElemDecls.makeClone(); // Annotations associated with the root schema of this targetNamespace fNumAnnotations = grammar.fNumAnnotations; @@ -292,6 +303,9 @@ fGlobalNotationDeclsExt = new SymbolHash(1); fGlobalIDConstraintDeclsExt = new SymbolHash(1); fGlobalTypeDeclsExt = new SymbolHash(1); + +// all global element decls table +fAllGlobalElemDecls = new SymbolHash(1); // get all built-in types fGlobalTypeDecls = schemaFactory.getBuiltInTypes(); @@ -335,6 +349,9 @@ fGlobalNotationDeclsExt = new SymbolHash(1); fGlobalIDConstraintDeclsExt = new SymbolHash(1); fGlobalTypeDeclsExt = new SymbolHash(1); + +// no all global element decls +fAllGlobalElemDecls = new SymbolHash(1); // 4 attributes, so initialize the size as 4*2 = 8 fGlobalAttrDecls = new SymbolHash(8); @@ -403,6 +420,9 @@ public void addGlobalElementDecl(XSElementDecl decl, String location) { // ignore } +public void addGlobalElementDeclAll(XSElementDecl decl) { +// ignore +} public void addGlobalGroupDecl(XSGroupDecl decl) { // ignore } @@ -498,6 +518,9 @@ fGlobalIDConstraintDeclsExt = new SymbolHash(1); fGlobalTypeDeclsExt = new SymbolHash(1); +// all global element declarations +fAllGlobalElemDecls = new SymbolHash(6); + // get all built-in types fGlobalTypeDecls = SG_SchemaNS.fGlobalTypeDecls; @@ -511,6 +534,14 @@ fGlobalElemDecls.put(documentationDecl.fName, documentationDecl); fGlobalElemDecls.put(appinfoDecl.fName
svn propchange: r819653 - svn:log
Author: knoaman Revision: 819653 Modified property: svn:log Modified: svn:log at Mon Sep 28 17:44:16 2009 -- --- svn:log (original) +++ svn:log Mon Sep 28 17:44:16 2009 @@ -1 +1 @@ -Fix for defect 611261 +Fix for potential NPEs when processing substitution groups? - To unsubscribe, e-mail: commits-unsubscr...@xerces.apache.org For additional commands, e-mail: commits-h...@xerces.apache.org
svn commit: r807392 - /xerces/java/trunk/src/org/apache/xerces/impl/xs/traversers/XSDComplexTypeTraverser.java
Author: knoaman Date: Mon Aug 24 21:44:35 2009 New Revision: 807392 URL: http://svn.apache.org/viewvc?rev=807392view=rev Log: Fix typo. Wrong variable name was used. Modified: xerces/java/trunk/src/org/apache/xerces/impl/xs/traversers/XSDComplexTypeTraverser.java Modified: xerces/java/trunk/src/org/apache/xerces/impl/xs/traversers/XSDComplexTypeTraverser.java URL: http://svn.apache.org/viewvc/xerces/java/trunk/src/org/apache/xerces/impl/xs/traversers/XSDComplexTypeTraverser.java?rev=807392r1=807391r2=807392view=diff == --- xerces/java/trunk/src/org/apache/xerces/impl/xs/traversers/XSDComplexTypeTraverser.java (original) +++ xerces/java/trunk/src/org/apache/xerces/impl/xs/traversers/XSDComplexTypeTraverser.java Mon Aug 24 21:44:35 2009 @@ -205,7 +205,7 @@ grammar.addGlobalComplexTypeDecl(type, loc); } else { -if (type instanceof XSComplexTypeDecl) { +if (type2 instanceof XSComplexTypeDecl) { type = (XSComplexTypeDecl) type2; } } - To unsubscribe, e-mail: commits-unsubscr...@xerces.apache.org For additional commands, e-mail: commits-h...@xerces.apache.org
svn commit: r805527 - /xerces/java/trunk/src/org/apache/xerces/impl/xs/traversers/XSDHandler.java
Author: knoaman Date: Tue Aug 18 18:28:54 2009 New Revision: 805527 URL: http://svn.apache.org/viewvc?rev=805527view=rev Log: When parsing a schema, return the grammar object when the schema root is null (it's null by default, but could be non-null in the case of namespace growth) Modified: xerces/java/trunk/src/org/apache/xerces/impl/xs/traversers/XSDHandler.java Modified: xerces/java/trunk/src/org/apache/xerces/impl/xs/traversers/XSDHandler.java URL: http://svn.apache.org/viewvc/xerces/java/trunk/src/org/apache/xerces/impl/xs/traversers/XSDHandler.java?rev=805527r1=805526r2=805527view=diff == --- xerces/java/trunk/src/org/apache/xerces/impl/xs/traversers/XSDHandler.java (original) +++ xerces/java/trunk/src/org/apache/xerces/impl/xs/traversers/XSDHandler.java Tue Aug 18 18:28:54 2009 @@ -551,7 +551,7 @@ if (is instanceof XSInputSource) { return fGrammarBucket.getGrammar(desc.getTargetNamespace()); } -return null; +return grammar; } if (referType == XSDDescription.CONTEXT_PREPARSE) { - To unsubscribe, e-mail: commits-unsubscr...@xerces.apache.org For additional commands, e-mail: commits-h...@xerces.apache.org
svn commit: r799450 - /xerces/java/trunk/src/org/apache/xerces/impl/xpath/regex/RegexParser.java
Author: knoaman Date: Thu Jul 30 21:35:19 2009 New Revision: 799450 URL: http://svn.apache.org/viewvc?rev=799450view=rev Log: Allow back references with multiple digits Modified: xerces/java/trunk/src/org/apache/xerces/impl/xpath/regex/RegexParser.java Modified: xerces/java/trunk/src/org/apache/xerces/impl/xpath/regex/RegexParser.java URL: http://svn.apache.org/viewvc/xerces/java/trunk/src/org/apache/xerces/impl/xpath/regex/RegexParser.java?rev=799450r1=799449r2=799450view=diff == --- xerces/java/trunk/src/org/apache/xerces/impl/xpath/regex/RegexParser.java (original) +++ xerces/java/trunk/src/org/apache/xerces/impl/xpath/regex/RegexParser.java Thu Jul 30 21:35:19 2009 @@ -76,6 +76,7 @@ static protected final int S_INBRACKETS = 1; static protected final int S_INXBRACKETS = 2; int context = S_NORMAL; +int parenOpened = 1; int parennumber = 1; boolean hasBackReferences; Vector references = null; @@ -115,6 +116,7 @@ this.offset = 0; this.setContext(S_NORMAL); this.parennumber = 1; +this.parenOpened = 1; this.hasBackReferences = false; this.regex = regex; if (this.isSet(RegularExpression.EXTENDED_COMMENT)) @@ -438,9 +440,10 @@ } Token processParen() throws ParseException { this.next(); -int p = this.parennumber++; +int p = this.parenOpened++; Token tok = Token.createParen(this.parseRegex(), p); if (this.read() != T_RPAREN) throw ex(parser.factor.1, this.offset-1); +this.parennumber++; this.next();// Skips ')' return tok; } @@ -460,9 +463,31 @@ int ch = this.regex.charAt(this.offset); if ('1' = ch ch = '9') { refno = ch-'0'; +int finalRefno = refno; + +if (this.parennumber = refno) +throw ex(parser.parse.2, this.offset); + +while (this.offset + 1 this.regexlen) { +ch = this.regex.charAt(this.offset + 1); +if ('1' = ch ch = '9') { +refno = (refno * 10) + (ch - '0'); +if (refno this.parennumber) { +finalRefno= refno; +++this.offset; +} +else { +break; +} +} +else { +break; +} +} + this.hasBackReferences = true; if (this.references == null) this.references = new Vector(); -this.references.addElement(new ReferencePosition(refno, this.offset)); +this.references.addElement(new ReferencePosition(finalRefno, this.offset)); this.offset ++; if (this.regex.charAt(this.offset) != ')') throw ex(parser.factor.1, this.offset); this.offset ++; @@ -571,10 +596,33 @@ } Token processBackreference() throws ParseException { int refnum = this.chardata-'0'; -Token tok = Token.createBackReference(refnum); +int finalRefnum = refnum; + +if (this.parennumber = refnum) +throw ex(parser.parse.2, this.offset-2); + +while (this.offset this.regexlen) { +final int ch = this.regex.charAt(this.offset); +if ('1' = ch ch = '9') { +refnum = (refnum * 10) + (ch - '0'); +if (refnum this.parennumber) { +++this.offset; +finalRefnum = refnum; +this.chardata = ch; +} +else { +break; +} +} +else { +break; +} +} + +Token tok = Token.createBackReference(finalRefnum); this.hasBackReferences = true; if (this.references == null) this.references = new Vector(); -this.references.addElement(new ReferencePosition(refnum, this.offset-2)); +this.references.addElement(new ReferencePosition(finalRefnum, this.offset-2)); this.next(); return tok; } - To unsubscribe, e-mail: commits-unsubscr...@xerces.apache.org For additional commands, e-mail: commits-h...@xerces.apache.org
svn commit: r789785 - in /xerces/java/trunk/src/org/apache/xerces: impl/xs/SchemaGrammar.java impl/xs/traversers/XSDHandler.java impl/xs/util/ObjectListImpl.java impl/xs/util/XSInputSource.java util/S
Author: knoaman Date: Tue Jun 30 15:10:26 2009 New Revision: 789785 URL: http://svn.apache.org/viewvc?rev=789785view=rev Log: [Internal] Allow for component sharing Added: xerces/java/trunk/src/org/apache/xerces/impl/xs/util/ObjectListImpl.java (with props) xerces/java/trunk/src/org/apache/xerces/impl/xs/util/XSInputSource.java (with props) Modified: xerces/java/trunk/src/org/apache/xerces/impl/xs/SchemaGrammar.java xerces/java/trunk/src/org/apache/xerces/impl/xs/traversers/XSDHandler.java xerces/java/trunk/src/org/apache/xerces/util/SymbolHash.java Modified: xerces/java/trunk/src/org/apache/xerces/impl/xs/SchemaGrammar.java URL: http://svn.apache.org/viewvc/xerces/java/trunk/src/org/apache/xerces/impl/xs/SchemaGrammar.java?rev=789785r1=789784r2=789785view=diff == --- xerces/java/trunk/src/org/apache/xerces/impl/xs/SchemaGrammar.java (original) +++ xerces/java/trunk/src/org/apache/xerces/impl/xs/SchemaGrammar.java Tue Jun 30 15:10:26 2009 @@ -26,6 +26,7 @@ import org.apache.xerces.impl.dv.XSSimpleType; import org.apache.xerces.impl.dv.xs.XSSimpleTypeDecl; import org.apache.xerces.impl.xs.identity.IdentityConstraint; +import org.apache.xerces.impl.xs.util.ObjectListImpl; import org.apache.xerces.impl.xs.util.SimpleLocator; import org.apache.xerces.impl.xs.util.StringListImpl; import org.apache.xerces.impl.xs.util.XSNamedMap4Types; @@ -54,6 +55,7 @@ import org.apache.xerces.xs.XSParticle; import org.apache.xerces.xs.XSTypeDefinition; import org.apache.xerces.xs.XSWildcard; +import org.apache.xerces.xs.datatypes.ObjectList; import org.xml.sax.SAXException; /** @@ -784,10 +786,11 @@ } public void addGlobalAttributeDecl(XSAttributeDecl decl, String location) { -//addGlobalAttributeDecl(decl); if (location != null) { fGlobalAttrDeclsExt.put(location+,+ decl.fName, decl); -decl.setNamespaceItem(this); +if (decl.getNamespaceItem() == null) { +decl.setNamespaceItem(this); +} } } @@ -800,10 +803,11 @@ } public void addGlobalAttributeGroupDecl(XSAttributeGroupDecl decl, String location) { -//addGlobalAttributeGroupDecl(decl); if (location != null) { fGlobalAttrGrpDeclsExt.put(location+,+decl.fName, decl); -decl.setNamespaceItem(this); +if (decl.getNamespaceItem() == null) { +decl.setNamespaceItem(this); +} } } @@ -824,10 +828,11 @@ } public void addGlobalElementDecl(XSElementDecl decl, String location) { -//addGlobalElementDecl(decl); if (location != null) { fGlobalElemDeclsExt.put(location+,+decl.fName, decl); -decl.setNamespaceItem(this); +if (decl.getNamespaceItem() == null) { +decl.setNamespaceItem(this); +} } } @@ -840,10 +845,11 @@ } public void addGlobalGroupDecl(XSGroupDecl decl, String location) { -//addGlobalGroupDecl(decl); if (location != null) { fGlobalGroupDeclsExt.put(location+,+decl.fName, decl); -decl.setNamespaceItem(this); +if (decl.getNamespaceItem() == null) { +decl.setNamespaceItem(this); +} } } @@ -856,10 +862,11 @@ } public void addGlobalNotationDecl(XSNotationDecl decl, String location) { -//addGlobalNotationDecl(decl); if (location != null) { fGlobalNotationDeclsExt.put(location+,+decl.fName, decl); -decl.setNamespaceItem(this); +if (decl.getNamespaceItem() == null) { +decl.setNamespaceItem(this); +} } } @@ -877,14 +884,15 @@ } public void addGlobalTypeDecl(XSTypeDefinition decl, String location) { -//addGlobalTypeDecl(decl); if (location != null) { fGlobalTypeDeclsExt.put(location+,+decl.getName(), decl); -if (decl instanceof XSComplexTypeDecl) { -((XSComplexTypeDecl) decl).setNamespaceItem(this); -} -else if (decl instanceof XSSimpleTypeDecl) { -((XSSimpleTypeDecl) decl).setNamespaceItem(this); +if (decl.getNamespaceItem() == null) { +if (decl instanceof XSComplexTypeDecl) { +((XSComplexTypeDecl) decl).setNamespaceItem(this); +} +else if (decl instanceof XSSimpleTypeDecl) { +((XSSimpleTypeDecl) decl).setNamespaceItem(this); +} } } } @@ -898,10 +906,11 @@ } public void addGlobalComplexTypeDecl(XSComplexTypeDecl decl, String location) { -//addGlobalComplexTypeDecl(decl); if (location != null) { fGlobalTypeDeclsExt.put(location+,+decl.getName
svn commit: r779777 - in /xerces/java/trunk/src/org/apache/xerces/impl/xs: ./ traversers/
Author: knoaman Date: Thu May 28 21:19:11 2009 New Revision: 779777 URL: http://svn.apache.org/viewvc?rev=779777view=rev Log: Allow for namespace growth - for now we use the same grammar instance and we do not override any global declarations Modified: xerces/java/trunk/src/org/apache/xerces/impl/xs/SchemaGrammar.java xerces/java/trunk/src/org/apache/xerces/impl/xs/traversers/XSDAttributeGroupTraverser.java xerces/java/trunk/src/org/apache/xerces/impl/xs/traversers/XSDAttributeTraverser.java xerces/java/trunk/src/org/apache/xerces/impl/xs/traversers/XSDComplexTypeTraverser.java xerces/java/trunk/src/org/apache/xerces/impl/xs/traversers/XSDElementTraverser.java xerces/java/trunk/src/org/apache/xerces/impl/xs/traversers/XSDGroupTraverser.java xerces/java/trunk/src/org/apache/xerces/impl/xs/traversers/XSDHandler.java xerces/java/trunk/src/org/apache/xerces/impl/xs/traversers/XSDKeyrefTraverser.java xerces/java/trunk/src/org/apache/xerces/impl/xs/traversers/XSDNotationTraverser.java xerces/java/trunk/src/org/apache/xerces/impl/xs/traversers/XSDSimpleTypeTraverser.java xerces/java/trunk/src/org/apache/xerces/impl/xs/traversers/XSDUniqueOrKeyTraverser.java Modified: xerces/java/trunk/src/org/apache/xerces/impl/xs/SchemaGrammar.java URL: http://svn.apache.org/viewvc/xerces/java/trunk/src/org/apache/xerces/impl/xs/SchemaGrammar.java?rev=779777r1=779776r2=779777view=diff == --- xerces/java/trunk/src/org/apache/xerces/impl/xs/SchemaGrammar.java (original) +++ xerces/java/trunk/src/org/apache/xerces/impl/xs/SchemaGrammar.java Thu May 28 21:19:11 2009 @@ -784,9 +784,10 @@ } public void addGlobalAttributeDecl(XSAttributeDecl decl, String location) { -addGlobalAttributeDecl(decl); +//addGlobalAttributeDecl(decl); if (location != null) { fGlobalAttrDeclsExt.put(location+,+ decl.fName, decl); +decl.setNamespaceItem(this); } } @@ -799,9 +800,10 @@ } public void addGlobalAttributeGroupDecl(XSAttributeGroupDecl decl, String location) { -addGlobalAttributeGroupDecl(decl); +//addGlobalAttributeGroupDecl(decl); if (location != null) { fGlobalAttrGrpDeclsExt.put(location+,+decl.fName, decl); +decl.setNamespaceItem(this); } } @@ -822,9 +824,10 @@ } public void addGlobalElementDecl(XSElementDecl decl, String location) { -addGlobalElementDecl(decl); +//addGlobalElementDecl(decl); if (location != null) { fGlobalElemDeclsExt.put(location+,+decl.fName, decl); +decl.setNamespaceItem(this); } } @@ -837,9 +840,10 @@ } public void addGlobalGroupDecl(XSGroupDecl decl, String location) { -addGlobalGroupDecl(decl); +//addGlobalGroupDecl(decl); if (location != null) { fGlobalGroupDeclsExt.put(location+,+decl.fName, decl); +decl.setNamespaceItem(this); } } @@ -852,9 +856,10 @@ } public void addGlobalNotationDecl(XSNotationDecl decl, String location) { -addGlobalNotationDecl(decl); +//addGlobalNotationDecl(decl); if (location != null) { fGlobalNotationDeclsExt.put(location+,+decl.fName, decl); +decl.setNamespaceItem(this); } } @@ -872,9 +877,15 @@ } public void addGlobalTypeDecl(XSTypeDefinition decl, String location) { -addGlobalTypeDecl(decl); +//addGlobalTypeDecl(decl); if (location != null) { fGlobalTypeDeclsExt.put(location+,+decl.getName(), decl); +if (decl instanceof XSComplexTypeDecl) { +((XSComplexTypeDecl) decl).setNamespaceItem(this); +} +else if (decl instanceof XSSimpleTypeDecl) { +((XSSimpleTypeDecl) decl).setNamespaceItem(this); +} } } @@ -887,9 +898,10 @@ } public void addGlobalComplexTypeDecl(XSComplexTypeDecl decl, String location) { -addGlobalComplexTypeDecl(decl); +//addGlobalComplexTypeDecl(decl); if (location != null) { fGlobalTypeDeclsExt.put(location+,+decl.getName(), decl); +decl.setNamespaceItem(this); } } @@ -904,9 +916,12 @@ } public void addGlobalSimpleTypeDecl(XSSimpleType decl, String location) { -addGlobalSimpleTypeDecl(decl); +//addGlobalSimpleTypeDecl(decl); if (location != null) { fGlobalTypeDeclsExt.put(location+,+decl.getName(), decl); +if (decl instanceof XSSimpleTypeDecl) { +((XSSimpleTypeDecl) decl).setNamespaceItem(this); +} } } @@ -919,7 +934,7 @@ } public final void addIDConstraintDecl(XSElementDecl elmDecl, IdentityConstraint decl, String
svn commit: r736401 - in /xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs: models/CMBuilder.java models/XSEmptyCM.java traversers/XSDComplexTypeTraverser.java
Author: knoaman Date: Wed Jan 21 12:16:52 2009 New Revision: 736401 URL: http://svn.apache.org/viewvc?rev=736401view=rev Log: [Jira bug 1347] https://issues.apache.org/jira/browse/XERCESJ-1347 XML Schema 1.1 - openContent/defaultOpenContent. Patch by John Chan. Modified: xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/models/CMBuilder.java xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/models/XSEmptyCM.java xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/traversers/XSDComplexTypeTraverser.java Modified: xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/models/CMBuilder.java URL: http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/models/CMBuilder.java?rev=736401r1=736400r2=736401view=diff == --- xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/models/CMBuilder.java (original) +++ xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/models/CMBuilder.java Wed Jan 21 12:16:52 2009 @@ -115,8 +115,15 @@ // if the validator returned is null, it means there is nothing in // the content model, so we return the empty content model. -if (cmValidator == null) -cmValidator = fEmptyCM; +if (cmValidator == null) { +XSOpenContentDecl oc = (XSOpenContentDecl)typeDecl.getOpenContent(); +if (oc == null) { +cmValidator = fEmptyCM; +} +else { +cmValidator = new XSEmptyCM(oc); +} +} return cmValidator; } Modified: xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/models/XSEmptyCM.java URL: http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/models/XSEmptyCM.java?rev=736401r1=736400r2=736401view=diff == --- xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/models/XSEmptyCM.java (original) +++ xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/models/XSEmptyCM.java Wed Jan 21 12:16:52 2009 @@ -23,6 +23,8 @@ import org.apache.xerces.impl.xs.SubstitutionGroupHandler; import org.apache.xerces.impl.xs.XMLSchemaException; import org.apache.xerces.impl.xs.XSConstraints; +import org.apache.xerces.impl.xs.XSOpenContentDecl; +import org.apache.xerces.impl.xs.XSWildcardDecl; import org.apache.xerces.xni.QName; /** @@ -51,6 +53,21 @@ // // Data // +private XSOpenContentDecl fOpenContent = null; + +// +// Constructors +// + +// Only one instance of an XSEmptyCM with no openContent will be created. +public XSEmptyCM(){ +} + +// This constructor will be called when the complexType is empty but +// contains openContent wildcard +public XSEmptyCM(XSOpenContentDecl openContent) { +fOpenContent = openContent; +} // // XSCMValidator methods @@ -83,6 +100,12 @@ return null; } +if (fOpenContent != null) { +if (allowExpandedName(fOpenContent.fWildcard, elementName, subGroupHandler, grammar)) { +return fOpenContent; +} +} + currentState[0] = XSCMValidator.FIRST_ERROR; return null; } @@ -95,7 +118,6 @@ * @return true if the last state was a valid final state */ public boolean endContentModel (int[] currentState){ -boolean isFinal = false; int state = currentState[0]; // restore content model state: @@ -136,4 +158,18 @@ public boolean isCompactedForUPA() { return false; } + +private boolean allowExpandedName(XSWildcardDecl wildcard, +QName curElem, +SubstitutionGroupHandler subGroupHandler, +SchemaGrammar grammar) { +if (wildcard.allowQName(curElem)) { +if (wildcard.fDisallowedDefined grammar.getElementDeclaration(curElem.localpart) != null) { +return false; +} +return true; +} +return false; +} + } // class XSEmptyCM 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=736401r1=736400r2=736401view=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 Wed Jan 21 12:16:52 2009
svn commit: r736072 - in /xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/traversers: XSDHandler.java XSDocumentInfo.java
Author: knoaman Date: Tue Jan 20 11:21:02 2009 New Revision: 736072 URL: http://svn.apache.org/viewvc?rev=736072view=rev Log: Fix for defaultAttributes Modified: 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/XSDocumentInfo.java 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=736072r1=736071r2=736072view=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 Tue Jan 20 11:21:02 2009 @@ -1232,7 +1232,7 @@ // if XML Schema 1.1, set default attribute group if (fSchemaVersion == Constants.SCHEMA_VERSION_1_1) { // Check that we have a 'defaultAttributes' and that we have not already processed it -if (currSchemaDoc.fDefaultAttributes != null currSchemaDoc.fDefaultAGroup != null) { +if (currSchemaDoc.fDefaultAttributes != null currSchemaDoc.fDefaultAGroup == null) { currSchemaDoc.fDefaultAGroup = (XSAttributeGroupDecl) getGlobalDecl( currSchemaDoc, XSDHandler.ATTRIBUTEGROUP_TYPE, currSchemaDoc.fDefaultAttributes, currRoot); } 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=736072r1=736071r2=736072view=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 Tue Jan 20 11:21:02 2009 @@ -110,6 +110,11 @@ if (schemaRoot != null) { Element root = schemaRoot; + +// set namespace support +fValidationContext.setNamespaceSupport(fNamespaceSupport); +fValidationContext.setSymbolTable(symbolTable); + fSchemaAttrs = attrChecker.checkAttributes(root, true, this); // schemaAttrs == null means it's not an xsd:schema element // throw an exception, but we don't know the document systemId, @@ -132,11 +137,12 @@ fNamespaceSupportRoot = new SchemaNamespaceSupport(fNamespaceSupport); -fDefaultAttributes = (QName) fSchemaAttrs[XSAttributeChecker.ATTIDX_DEFAULTATTRAPPLY]; +fDefaultAttributes = (QName) fSchemaAttrs[XSAttributeChecker.ATTIDX_DEFAULTATTRIBUTES]; //set namespace support -fValidationContext.setNamespaceSupport(fNamespaceSupport); -fValidationContext.setSymbolTable(symbolTable); +//fValidationContext.setNamespaceSupport(fNamespaceSupport); +//fValidationContext.setSymbolTable(symbolTable); + // pass null as the schema document, so that the namespace // context is not popped. - To unsubscribe, e-mail: commits-unsubscr...@xerces.apache.org For additional commands, e-mail: commits-h...@xerces.apache.org
svn commit: r736209 - /xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/XSElementDecl.java
Author: knoaman Date: Tue Jan 20 20:43:17 2009 New Revision: 736209 URL: http://svn.apache.org/viewvc?rev=736209view=rev Log: Use the proper add method Modified: xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/XSElementDecl.java Modified: xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/XSElementDecl.java URL: http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/XSElementDecl.java?rev=736209r1=736208r2=736209view=diff == --- xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/XSElementDecl.java (original) +++ xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/XSElementDecl.java Tue Jan 20 20:43:17 2009 @@ -405,7 +405,7 @@ if (fAnnotations == XSObjectListImpl.EMPTY_LIST) { fAnnotations = new XSObjectListImpl(); } -((XSObjectListImpl)fAnnotations).add(annotation); +((XSObjectListImpl)fAnnotations).addXSObject(annotation); } /** - To unsubscribe, e-mail: commits-unsubscr...@xerces.apache.org For additional commands, e-mail: commits-h...@xerces.apache.org
svn commit: r736210 - /xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/traversers/XSDHandler.java
Author: knoaman Date: Tue Jan 20 20:44:43 2009 New Revision: 736210 URL: http://svn.apache.org/viewvc?rev=736210view=rev Log: Reset the structures used to handle identity constraints with a 'ref' attribute Modified: xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/traversers/XSDHandler.java 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=736210r1=736209r2=736210view=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 Tue Jan 20 20:44:43 2009 @@ -2193,6 +2193,15 @@ fKeyrefsMapXSDocumentInfo[i] = null; } fKeyrefStackPos = 0; + +// and do same for idc referrals +for (int i = 0; i fICReferralStackPos; i++) { +fICReferrals[i] = null; +fICReferralsMapXSDocumentInfo[i] = null; +fICReferralElems[i] = null; +fICReferralNamespaceContext[i] = null; +} +fICReferralStackPos = 0; // create traversers if necessary if (fAttributeChecker == null) { - To unsubscribe, e-mail: commits-unsubscr...@xerces.apache.org For additional commands, e-mail: commits-h...@xerces.apache.org
svn commit: r735851 [2/2] - in /xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl: ./ dv/xs/ xs/ xs/models/ xs/traversers/ xs/util/
Modified: xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/models/CMBuilder.java URL: http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/models/CMBuilder.java?rev=735851r1=735850r2=735851view=diff == --- xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/models/CMBuilder.java (original) +++ xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/models/CMBuilder.java Mon Jan 19 14:26:51 2009 @@ -129,7 +129,7 @@ XSModelGroupImpl group = (XSModelGroupImpl)particle.fValue; // create an all content model. the parameter indicates whether // the all itself is optional -XSAllCM allContent = new XSAllCM(particle.fMinOccurs == 0, group.fParticleCount); +XSAllCM allContent = new XSAllCM(particle.fMinOccurs == 0, group.fParticleCount, fSchemaVersion); for (int i = 0; i group.fParticleCount; i++) { // add the element decl to the all content model allContent.addElement((XSElementDecl)group.fParticles[i].fValue, Modified: xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/models/XS11AllCM.java URL: http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/models/XS11AllCM.java?rev=735851r1=735850r2=735851view=diff == --- xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/models/XS11AllCM.java (original) +++ xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/models/XS11AllCM.java Mon Jan 19 14:26:51 2009 @@ -19,6 +19,7 @@ import java.util.Vector; +import org.apache.xerces.impl.Constants; import org.apache.xerces.impl.xs.SchemaGrammar; import org.apache.xerces.impl.xs.SubstitutionGroupHandler; import org.apache.xerces.impl.xs.XMLSchemaException; @@ -120,7 +121,7 @@ Object matchingDecl = null; for (int i = 0; i fNumElements; i++) { -matchingDecl = subGroupHandler.getMatchingElemDecl(elementName, (XSElementDecl)fAllDecls[i]); +matchingDecl = subGroupHandler.getMatchingElemDecl(elementName, (XSElementDecl)fAllDecls[i], Constants.SCHEMA_VERSION_1_1); if (matchingDecl != null) return matchingDecl; } @@ -138,7 +139,7 @@ // convinient method: to find a matching element decl XSElementDecl findMatchingElemDecl(QName elementName, SubstitutionGroupHandler subGroupHandler) { for (int i = 0; i fNumElements; i++) { -final XSElementDecl matchingDecl = subGroupHandler.getMatchingElemDecl(elementName, (XSElementDecl)fAllDecls[i]); +final XSElementDecl matchingDecl = subGroupHandler.getMatchingElemDecl(elementName, (XSElementDecl)fAllDecls[i], Constants.SCHEMA_VERSION_1_1); if (matchingDecl != null) { return matchingDecl; } @@ -196,7 +197,7 @@ if (currentState[i + 1] == fDeclsOccurs[declMaxOccurs]) { continue; } -Object matchingDecl = subGroupHandler.getMatchingElemDecl(elementName, (XSElementDecl)fAllDecls[i]); +Object matchingDecl = subGroupHandler.getMatchingElemDecl(elementName, (XSElementDecl)fAllDecls[i], Constants.SCHEMA_VERSION_1_1); if (matchingDecl != null) { // found the decl, mark this element as seen. ++currentState[i + 1]; Modified: xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/models/XSAllCM.java URL: http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/models/XSAllCM.java?rev=735851r1=735850r2=735851view=diff == --- xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/models/XSAllCM.java (original) +++ xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/models/XSAllCM.java Mon Jan 19 14:26:51 2009 @@ -19,6 +19,7 @@ import java.util.Vector; +import org.apache.xerces.impl.Constants; import org.apache.xerces.impl.xs.SchemaGrammar; import org.apache.xerces.impl.xs.SubstitutionGroupHandler; import org.apache.xerces.impl.xs.XMLSchemaException; @@ -54,15 +55,17 @@ private final boolean fIsOptionalElement[]; private final boolean fHasOptionalContent; private int fNumElements = 0; +private short fSchemaVersion; // // Constructors // -public XSAllCM (boolean hasOptionalContent, int size) { +public XSAllCM (boolean hasOptionalContent, int size, short schemaVersion) { fHasOptionalContent = hasOptionalContent; fAllElements = new XSElementDecl[size]; fIsOptionalElement = new boolean[size]; +fSchemaVersion = schemaVersion; }
svn commit: r735853 - /xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/BaseSchemaDVFactory.java
Author: knoaman Date: Mon Jan 19 14:29:03 2009 New Revision: 735853 URL: http://svn.apache.org/viewvc?rev=735853view=rev Log: Handle XML Schema Grammar: 1.0 vs. 1.1 Added: xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/BaseSchemaDVFactory.java (with props) Added: xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/BaseSchemaDVFactory.java URL: http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/BaseSchemaDVFactory.java?rev=735853view=auto == --- xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/BaseSchemaDVFactory.java (added) +++ xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/BaseSchemaDVFactory.java Mon Jan 19 14:29:03 2009 @@ -0,0 +1,321 @@ +/* + * 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.dv.xs; + +import org.apache.xerces.impl.dv.SchemaDVFactory; +import org.apache.xerces.impl.dv.XSFacets; +import org.apache.xerces.impl.dv.XSSimpleType; +import org.apache.xerces.impl.xs.XSDeclarationPool; +import org.apache.xerces.util.SymbolHash; +import org.apache.xerces.xs.XSConstants; +import org.apache.xerces.xs.XSObjectList; + +/** + * the base factory to create/return built-in schema DVs and create user-defined DVs + * + * @xerces.internal + * + * @author Neeraj Bajaj, Sun Microsystems, inc. + * @author Sandy Gao, IBM + * @author Khaled Noaman, IBM + * + * @version $Id$ + */ +public abstract class BaseSchemaDVFactory extends SchemaDVFactory { + +static final String URI_SCHEMAFORSCHEMA = http://www.w3.org/2001/XMLSchema;; + +protected XSDeclarationPool fDeclPool = null; + +// create common built-in types +protected static void createBuiltInTypes(SymbolHash builtInTypes, XSSimpleTypeDecl baseAtomicType) { +// all schema simple type names +final String ANYSIMPLETYPE = anySimpleType; +final String ANYURI= anyURI; +final String BASE64BINARY = base64Binary; +final String BOOLEAN = boolean; +final String BYTE = byte; +final String DATE = date; +final String DATETIME = dateTime; +final String DAY = gDay; +final String DECIMAL = decimal; +final String DOUBLE= double; +final String DURATION = duration; +final String ENTITY= ENTITY; +final String ENTITIES = ENTITIES; +final String FLOAT = float; +final String HEXBINARY = hexBinary; +final String ID= ID; +final String IDREF = IDREF; +final String IDREFS= IDREFS; +final String INT = int; +final String INTEGER = integer; +final String LONG = long; +final String NAME = Name; +final String NEGATIVEINTEGER = negativeInteger; +final String MONTH = gMonth; +final String MONTHDAY = gMonthDay; +final String NCNAME= NCName; +final String NMTOKEN = NMTOKEN; +final String NMTOKENS = NMTOKENS; +final String LANGUAGE = language; +final String NONNEGATIVEINTEGER= nonNegativeInteger; +final String NONPOSITIVEINTEGER= nonPositiveInteger; +final String NORMALIZEDSTRING = normalizedString; +final String NOTATION = NOTATION; +final String POSITIVEINTEGER = positiveInteger; +final String QNAME = QName; +final String SHORT = short; +final String STRING= string; +final String TIME = time; +final String TOKEN = token; +final String UNSIGNEDBYTE = unsignedByte; +final String UNSIGNEDINT = unsignedInt; +final String UNSIGNEDLONG = unsignedLong; +final String UNSIGNEDSHORT = unsignedShort; +final String YEAR
svn commit: r735854 - /xerces/java/branches/xml-schema-1.1-dev/tests/schema/config/BaseTest.java
Author: knoaman Date: Mon Jan 19 14:29:50 2009 New Revision: 735854 URL: http://svn.apache.org/viewvc?rev=735854view=rev Log: Handle XML Schema Grammar: 1.0 vs. 1.1 Modified: xerces/java/branches/xml-schema-1.1-dev/tests/schema/config/BaseTest.java Modified: xerces/java/branches/xml-schema-1.1-dev/tests/schema/config/BaseTest.java URL: http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/tests/schema/config/BaseTest.java?rev=735854r1=735853r2=735854view=diff == --- xerces/java/branches/xml-schema-1.1-dev/tests/schema/config/BaseTest.java (original) +++ xerces/java/branches/xml-schema-1.1-dev/tests/schema/config/BaseTest.java Mon Jan 19 14:29:50 2009 @@ -243,7 +243,7 @@ } protected void assertAnyType(XSTypeDefinition type) { -assertEquals(Type is supposed to be anyType, SchemaGrammar.fAnyType, -type); +assertTrue(Type is supposed to be anyType, SchemaGrammar.isAnyType(type)); } + } - To unsubscribe, e-mail: commits-unsubscr...@xerces.apache.org For additional commands, e-mail: commits-h...@xerces.apache.org
svn commit: r735898 - in /xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl: dv/xs/XSSimpleTypeDecl.java xs/traversers/XSDSimpleTypeTraverser.java
Author: knoaman Date: Mon Jan 19 17:09:45 2009 New Revision: 735898 URL: http://svn.apache.org/viewvc?rev=735898view=rev Log: Do not expand union simple types - Thanks to John K Chan. Modified: 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/xs/traversers/XSDSimpleTypeTraverser.java 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=735898r1=735897r2=735898view=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 Mon Jan 19 17:09:45 2009 @@ -1900,7 +1900,11 @@ (fMemberTypes[i].fFacetsDefined != 0 fMemberTypes[i].fFacetsDefined != FACET_WHITESPACE)) { fMemberTypes[i].checkFacets(validatedInfo); } -validatedInfo.memberType = fMemberTypes[i]; + +if (fMemberTypes[i].fVariety != VARIETY_UNION) { +validatedInfo.memberType = fMemberTypes[i]; +} + return aValue; } catch(InvalidDatatypeValueException invalidValue) { } @@ -2348,27 +2352,36 @@ this.fOrdered = ORDERED_PARTIAL; return; } -// we need to process the first member type before entering the loop -short ancestorId = getPrimitiveDV(fMemberTypes[0].fValidationDV); -boolean commonAnc = ancestorId != DV_ANYSIMPLETYPE; -boolean allFalse = fMemberTypes[0].fOrdered == ORDERED_FALSE; -// for the other member types, check whether the value is false -// and whether they have the same ancestor as the first one -for (int i = 1; i fMemberTypes.length (commonAnc || allFalse); i++) { -if (commonAnc) -commonAnc = ancestorId == getPrimitiveDV(fMemberTypes[i].fValidationDV); -if (allFalse) -allFalse = fMemberTypes[i].fOrdered == ORDERED_FALSE; -} -if (commonAnc) { -// REVISIT: all member types should have the same ordered value -// just use the first one. Can we assume this? -this.fOrdered = fMemberTypes[0].fOrdered; -} else if (allFalse) { -this.fOrdered = ORDERED_FALSE; -} else { + +short firstMemberOrderVal = fMemberTypes[0].fOrdered; +// if any one of the memberTypes have partial order, set the order of this union to partial +if (firstMemberOrderVal==ORDERED_PARTIAL) { this.fOrdered = ORDERED_PARTIAL; +return; } + +// if any of the memberTypes are of different order, set the order of this union to partial +short ancestorId = getPrimitiveDV(getFirstExpandedSimpleTypeValidationDV(fMemberTypes[0])); +boolean commonAnc = true; +for (int i=1; ifMemberTypes.length; i++) { +if (fMemberTypes[i].fOrdered != firstMemberOrderVal) { +this.fOrdered = ORDERED_PARTIAL; +return; +} +if (commonAnc) { +commonAnc = (getPrimitiveDV(getFirstExpandedSimpleTypeValidationDV(fMemberTypes[i])) == ancestorId); +} +} + +// if all the memberTypes are false order, set the order of this union to false +if (firstMemberOrderVal == ORDERED_FALSE) { +this.fOrdered = ORDERED_FALSE; +return; +} + +// all the memberTypes are total order +// if they're from the same primitive type, set the order of this union to total, otherwise partial +this.fOrdered = commonAnc ? ORDERED_TOTAL : ORDERED_PARTIAL; } }//setOrdered @@ -2419,11 +2432,11 @@ short ancestorId = 0 ; if(memberTypes.length 0){ -ancestorId = getPrimitiveDV(memberTypes[0].fValidationDV); +ancestorId = getPrimitiveDV(getFirstExpandedSimpleTypeValidationDV(memberTypes[0])); } for(int i = 0 ; i memberTypes.length ; i++){ -if(!memberTypes[i].getBounded() || (ancestorId != getPrimitiveDV(memberTypes[i].fValidationDV)) ){ +if(!memberTypes[i].getBounded() || (ancestorId != getPrimitiveDV(getFirstExpandedSimpleTypeValidationDV(memberTypes[i
svn commit: r730488 - in /xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl: msg/ xs/ xs/identity/ xs/traversers/
Author: knoaman Date: Wed Dec 31 13:58:19 2008 New Revision: 730488 URL: http://svn.apache.org/viewvc?rev=730488view=rev Log: [Jira bug 1344] https://issues.apache.org/jira/browse/XERCESJ-1344 XML Schema 1.1 - Revised Identity Constraints. Patch by John Chan. Modified: xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/msg/XMLSchemaMessages.properties 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/XSElementDecl.java xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/identity/Field.java xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/identity/IdentityConstraint.java xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/identity/KeyRef.java xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/identity/UniqueOrKey.java xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/identity/ValueStore.java xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/traversers/XSAttributeChecker.java xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/traversers/XSDAbstractIDConstraintTraverser.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/XSDKeyrefTraverser.java xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/traversers/XSDUniqueOrKeyTraverser.java Modified: xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/msg/XMLSchemaMessages.properties URL: http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/msg/XMLSchemaMessages.properties?rev=730488r1=730487r2=730488view=diff == --- xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/msg/XMLSchemaMessages.properties (original) +++ xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/msg/XMLSchemaMessages.properties Wed Dec 31 13:58:19 2008 @@ -128,6 +128,8 @@ src-element.4.3.1 = src-element.4.3.1: Since element ''{0}'' contains the 'targetNamespace' attribute and schema does not have a 'targetNamespace' attribute or its value is different from the value of 'targetNamespace' of ''{0}'', ''{0}'' must have a complexType as an ancestor. src-element.4.3.2 = src-element.4.3.2: Since element ''{0}'' contains the 'targetNamespace' attribute and schema does not have a 'targetNamespace' attribute or its value is different from the value of 'targetNamespace' of ''{0}'', there must be a restriction ancestor between ''{0}'' and the nearest complexType ancestor, and the value of the 'base' attribute of restriction does not match the name of 'xs:anyType'. src-element.5 = src-element.5: Element ''{0}'' has a type alternative with a missing ''test'' attribute. Only the last type alternative in the type table is allowed to be without a ''test'' attribute. +src-identity-constraint.1 = src-identity-constraint.1: One of ''ref'' or ''name'' must be present in an identity constraint declaration. +src-identity-constraint.5 = src-identity-constraint.5: The identity-constraint category of the identity-constraint definition resolved to by the actual value of the ''ref'' attribute does not match the name of the element information item ''{0}''. src-import.1.1 = src-import.1.1: The namespace attribute ''{0}'' of an import element information item must not be the same as the targetNamespace of the schema it exists in. src-import.1.2 = src-import.1.2: If the namespace attribute is not present on an import element information item then the enclosing schema must have a targetNamespace. src-import.2 = src-import.2: The root element of document ''{0}'' has to have the namespace name ''http://www.w3.org/2001/XMLSchema'' and the local name ''schema''. 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=730488r1=730487r2=730488view=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 Wed Dec 31 13:58:19 2008 @@ -3597,6 +3597,7 @@ protected IdentityConstraint fIdentityConstraint; protected int fFieldCount = 0; protected Field[] fFields
svn propchange: r693686 - svn:log
Author: knoaman Revision: 693686 Modified property: svn:log Modified: svn:log at Thu Nov 6 09:41:52 2008 -- --- svn:log (original) +++ svn:log Thu Nov 6 09:41:52 2008 @@ -1 +1 @@ -Partial implementation of assert - recognize assert for simple type declarations. Submitted by Mukul Ghandi +Partial implementation of assert - recognize assert for simple type declarations. Submitted by Mukul Gandhi - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
svn commit: r710089 - in /xerces/java/trunk/src/org/apache/xerces/impl: ./ dv/xs/ xs/ xs/util/
Author: knoaman Date: Mon Nov 3 08:01:16 2008 New Revision: 710089 URL: http://svn.apache.org/viewvc?rev=710089view=rev Log: Add support for QT types Added: xerces/java/trunk/src/org/apache/xerces/impl/dv/xs/BaseSchemaDVFactory.java (with props) xerces/java/trunk/src/org/apache/xerces/impl/dv/xs/ExtendedSchemaDVFactoryImpl.java (with props) Modified: xerces/java/trunk/src/org/apache/xerces/impl/Constants.java xerces/java/trunk/src/org/apache/xerces/impl/dv/xs/SchemaDVFactoryImpl.java xerces/java/trunk/src/org/apache/xerces/impl/xs/SchemaGrammar.java xerces/java/trunk/src/org/apache/xerces/impl/xs/XSModelImpl.java xerces/java/trunk/src/org/apache/xerces/impl/xs/util/XSGrammarPool.java Modified: xerces/java/trunk/src/org/apache/xerces/impl/Constants.java URL: http://svn.apache.org/viewvc/xerces/java/trunk/src/org/apache/xerces/impl/Constants.java?rev=710089r1=710088r2=710089view=diff == --- xerces/java/trunk/src/org/apache/xerces/impl/Constants.java (original) +++ xerces/java/trunk/src/org/apache/xerces/impl/Constants.java Mon Nov 3 08:01:16 2008 @@ -453,6 +453,8 @@ // Constant to enable Schema 1.1 support public final static boolean SCHEMA_1_1_SUPPORT = false; +public final static short SCHEMA_VERSION_1_0 = 1; +public final static short SCHEMA_VERSION_1_0_EXTENDED = 2; // private Added: xerces/java/trunk/src/org/apache/xerces/impl/dv/xs/BaseSchemaDVFactory.java URL: http://svn.apache.org/viewvc/xerces/java/trunk/src/org/apache/xerces/impl/dv/xs/BaseSchemaDVFactory.java?rev=710089view=auto == --- xerces/java/trunk/src/org/apache/xerces/impl/dv/xs/BaseSchemaDVFactory.java (added) +++ xerces/java/trunk/src/org/apache/xerces/impl/dv/xs/BaseSchemaDVFactory.java Mon Nov 3 08:01:16 2008 @@ -0,0 +1,321 @@ +/* + * 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.dv.xs; + +import org.apache.xerces.impl.dv.SchemaDVFactory; +import org.apache.xerces.impl.dv.XSFacets; +import org.apache.xerces.impl.dv.XSSimpleType; +import org.apache.xerces.impl.xs.XSDeclarationPool; +import org.apache.xerces.util.SymbolHash; +import org.apache.xerces.xs.XSConstants; +import org.apache.xerces.xs.XSObjectList; + +/** + * the base factory to create/return built-in schema DVs and create user-defined DVs + * + * @xerces.internal + * + * @author Neeraj Bajaj, Sun Microsystems, inc. + * @author Sandy Gao, IBM + * @author Khaled Noaman, IBM + * + * @version $Id$ + */ +public abstract class BaseSchemaDVFactory extends SchemaDVFactory { + +static final String URI_SCHEMAFORSCHEMA = http://www.w3.org/2001/XMLSchema;; + +protected XSDeclarationPool fDeclPool = null; + +// create common built-in types +protected static void createBuiltInTypes(SymbolHash builtInTypes, XSSimpleTypeDecl baseAtomicType) { +// all schema simple type names +final String ANYSIMPLETYPE = anySimpleType; +final String ANYURI= anyURI; +final String BASE64BINARY = base64Binary; +final String BOOLEAN = boolean; +final String BYTE = byte; +final String DATE = date; +final String DATETIME = dateTime; +final String DAY = gDay; +final String DECIMAL = decimal; +final String DOUBLE= double; +final String DURATION = duration; +final String ENTITY= ENTITY; +final String ENTITIES = ENTITIES; +final String FLOAT = float; +final String HEXBINARY = hexBinary; +final String ID= ID; +final String IDREF = IDREF; +final String IDREFS= IDREFS; +final String INT = int; +final String INTEGER = integer; +final String LONG = long; +final String NAME = Name; +final String NEGATIVEINTEGER = negativeInteger; +final
svn commit: r710097 - in /xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces: impl/xs/ impl/xs/traversers/ xs/
Author: knoaman Date: Mon Nov 3 08:31:51 2008 New Revision: 710097 URL: http://svn.apache.org/viewvc?rev=710097view=rev Log: Add traversal support for assertions on complex types - patch by Mukul Ghandi Modified: 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/XSComplexTypeDecl.java xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/traversers/XSAttributeChecker.java xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/traversers/XSDAbstractTraverser.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/xs/XSAssert.java xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/xs/XSComplexTypeDefinition.java 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=710097r1=710096r2=710097view=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 Mon Nov 3 08:31:51 2008 @@ -51,6 +51,7 @@ // all possible schema element names public static final String ELT_ALL= all.intern(); public static final String ELT_ASSERT = assert.intern(); +public static final String ELT_ASSERTION = assertion.intern(); public static final String ELT_ALTERNATIVE= alternative.intern(); public static final String ELT_ANNOTATION = annotation.intern(); public static final String ELT_ANY= any.intern(); Modified: xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/XSComplexTypeDecl.java URL: http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/XSComplexTypeDecl.java?rev=710097r1=710096r2=710097view=diff == --- xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/XSComplexTypeDecl.java (original) +++ xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/XSComplexTypeDecl.java Mon Nov 3 08:31:51 2008 @@ -95,6 +95,9 @@ // the open content XSOpenContentDecl fOpenContent = null; + +// list of assertions affiliated with this type +XSObjectListImpl fAssertions = null; // DOM Level 3 TypeInfo Derivation Method constants static final int DERIVATION_ANY = 0; @@ -169,6 +172,10 @@ fMiscFlags |= CT_IS_ANONYMOUS; } +public void setAssertions(XSObjectListImpl assertions) { + fAssertions = assertions; +} + public XSCMValidator getContentModel(CMBuilder cmBuilder) { return getContentModel(cmBuilder, false); } @@ -559,6 +566,10 @@ fAnnotations.clear(); } fAnnotations = null; +if (fAssertions != null) { + fAssertions.clear(); +} +fAssertions = null; } /** @@ -737,5 +748,9 @@ public XSOpenContent getOpenContent() { return fOpenContent; } + +public XSObjectList getAssertions() { +return (fAssertions != null) ? fAssertions : XSObjectListImpl.EMPTY_LIST; +} } // class XSComplexTypeDecl Modified: xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/traversers/XSAttributeChecker.java URL: http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/traversers/XSAttributeChecker.java?rev=710097r1=710096r2=710097view=diff == --- xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/traversers/XSAttributeChecker.java (original) +++ xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/traversers/XSAttributeChecker.java Mon Nov 3 08:31:51 2008 @@ -1212,6 +1212,8 @@ // xpathDefaultNamespace = (anyURI | (##defaultNamespace | ##targetNamespace | ##local)) attrList.put(SchemaSymbols.ATT_XPATH_DEFAULT_NS, allAttrs[ATT_DEFAULT_XPATH_NS_N]); fEleAttrs11MapL.put(SchemaSymbols.ELT_ASSERT, attrList); +// for element assertion - local // mukul +fEleAttrs11MapL.put(SchemaSymbols.ELT_ASSERTION, attrList); // for element defaultOpenContent - global attrList = Container.getContainer(3); Modified: xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/traversers/XSDAbstractTraverser.java URL: http://svn.apache.org
svn commit: r710098 - in /xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs: XSComplexTypeDecl.java traversers/XSDComplexTypeTraverser.java
Author: knoaman Date: Mon Nov 3 08:36:45 2008 New Revision: 710098 URL: http://svn.apache.org/viewvc?rev=710098view=rev Log: Fix indentation Modified: xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/XSComplexTypeDecl.java xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/traversers/XSDComplexTypeTraverser.java Modified: xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/XSComplexTypeDecl.java URL: http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/XSComplexTypeDecl.java?rev=710098r1=710097r2=710098view=diff == --- xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/XSComplexTypeDecl.java (original) +++ xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/XSComplexTypeDecl.java Mon Nov 3 08:36:45 2008 @@ -173,7 +173,7 @@ } public void setAssertions(XSObjectListImpl assertions) { - fAssertions = assertions; +fAssertions = assertions; } public XSCMValidator getContentModel(CMBuilder cmBuilder) { @@ -567,7 +567,7 @@ } fAnnotations = null; if (fAssertions != null) { - fAssertions.clear(); +fAssertions.clear(); } fAssertions = null; } 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=710098r1=710097r2=710098view=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 Mon Nov 3 08:36:45 2008 @@ -639,8 +639,8 @@ // Traverse any attributes // --- if (attrOrAssertNode != null) { - if (isAttrOrAttrGroup(attrOrAssertNode)) { - Element node=traverseAttrsAndAttrGrps(attrOrAssertNode,fAttrGrp, +if (isAttrOrAttrGroup(attrOrAssertNode)) { +Element node=traverseAttrsAndAttrGrps(attrOrAssertNode,fAttrGrp, schemaDoc,grammar,fComplexTypeDecl); if (node != null) { @@ -658,11 +658,11 @@ } } } - else if (isAssert(attrOrAssertNode)) { +else if (isAssert(attrOrAssertNode)) { traverseAsserts(attrOrAssertNode, schemaDoc, grammar, fComplexTypeDecl); - } - else { +} +else { fAttrChecker.returnAttrArray(simpleContentAttrValues, schemaDoc); fAttrChecker.returnAttrArray(derivationTypeAttrValues, schemaDoc); throw new ComplexTypeRecoverableError(s4s-elt-invalid-content.1, @@ -711,7 +711,7 @@ } else { // a non assert element after attributes is an error fAttrChecker.returnAttrArray(simpleContentAttrValues, schemaDoc); - fAttrChecker.returnAttrArray(derivationTypeAttrValues, schemaDoc); + fAttrChecker.returnAttrArray(derivationTypeAttrValues, schemaDoc); throw new ComplexTypeRecoverableError( s4s-elt-invalid-content.1, new Object[] { fName, @@ -1472,7 +1472,7 @@ traverseAsserts(sibling, schemaDoc, grammar, enclosingCT); } else { // a non assert element after assert is an error - fAttrChecker.returnAttrArray(attrValues, schemaDoc); +fAttrChecker.returnAttrArray(attrValues, schemaDoc); throw new ComplexTypeRecoverableError( s4s-elt-invalid-content.1, new Object[] { fName, DOMUtil.getLocalName(sibling) }, sibling); @@ -1579,7 +1579,7 @@ } private void contentRestore() { - fAssertions = (XSAssertImpl[])fGlobalStore[--fGlobalStorePos]; +fAssertions = (XSAssertImpl[])fGlobalStore[--fGlobalStorePos]; fOpenContent = (XSOpenContentDecl)fGlobalStore[--fGlobalStorePos]; fAnnotations = (XSAnnotationImpl [])fGlobalStore[--fGlobalStorePos]; fXSSimpleType = (XSSimpleType)fGlobalStore[--fGlobalStorePos]; @@ -1627,7 +1627,7
svn commit: r710187 - in /xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs: ./ traversers/
Author: knoaman Date: Mon Nov 3 14:08:57 2008 New Revision: 710187 URL: http://svn.apache.org/viewvc?rev=710187view=rev Log: XML Schema 1.1 - implement XML Schema Structure changes to ID/IDRef and related types - patch by John K Chan Modified: 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/traversers/XSDAbstractTraverser.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 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=710187r1=710186r2=710187view=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 Mon Nov 3 14:08:57 2008 @@ -2871,7 +2871,10 @@ } else { // 5 Let [Definition:] the wild IDs be the set of all attribute information item to which clause 3.2 applied and whose validation resulted in a context-determined declaration of mustFind or no context-determined declaration at all, and whose [local name] and [namespace name] resolve (as defined by QName resolution (Instance) (3.15.4)) to an attribute declaration whose {type definition} is or is derived from ID. Then all of the following must be true: // 5.1 There must be no more than one item in wild IDs. -if (currDecl.fType.getTypeCategory() == XSTypeDefinition.SIMPLE_TYPE + // + // Only applies to XML Schema 1.0 +if (fSchemaVersion Constants.SCHEMA_VERSION_1_1 + currDecl.fType.getTypeCategory() == XSTypeDefinition.SIMPLE_TYPE ((XSSimpleType) currDecl.fType).isIDType()) { if (wildcardIDName != null) { reportSchemaError( @@ -2887,6 +2890,9 @@ } // end of for (all attributes) // 5.2 If wild IDs is non-empty, there must not be any attribute uses among the {attribute uses} whose {attribute declaration}'s {type definition} is or is derived from ID. +// +// Only applies to XML Schema 1.0 +// Since we do not set the wildcardIDName if it's 1.1, no need to explicitly check for the version if (!isSimple attrGrp.fIDAttrName != null wildcardIDName != null) { reportSchemaError( cvc-complex-type.5.2, Modified: xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/traversers/XSDAbstractTraverser.java URL: http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/traversers/XSDAbstractTraverser.java?rev=710187r1=710186r2=710187view=diff == --- xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/traversers/XSDAbstractTraverser.java (original) +++ xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/traversers/XSDAbstractTraverser.java Mon Nov 3 14:08:57 2008 @@ -644,7 +644,8 @@ if (attrGrp.getAttributeUse(tempAttrUse.fAttrDecl.getNamespace(), tempAttrUse.fAttrDecl.getName())==null) { String idName = attrGrp.addAttributeUse(tempAttrUse); -if (idName != null) { +// Only applies to XML Schema 1.0 +if (fSchemaHandler.fSchemaVersion Constants.SCHEMA_VERSION_1_1 idName != null) { String code = (enclosingCT == null) ? ag-props-correct.3 : ct-props-correct.5; String name = (enclosingCT == null) ? attrGrp.fName : enclosingCT.getName(); reportSchemaError(code, new Object[]{name, tempAttrUse.fAttrDecl.getName(), idName}, child); @@ -670,7 +671,8 @@ if (existingAttrUse == attrGrp.getAttributeUse(oneAttrUse.fAttrDecl.getNamespace(), oneAttrUse.fAttrDecl.getName())) { String idName = attrGrp.addAttributeUse(oneAttrUse); -if (idName != null) { +// Only applies to XML Schema 1.0 +if (fSchemaHandler.fSchemaVersion Constants.SCHEMA_VERSION_1_1 idName != null
svn commit: r707475 [2/2] - in /xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl: msg/ xs/ xs/models/ xs/traversers/
Modified: xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/models/XSDFACM.java URL: http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/models/XSDFACM.java?rev=707475r1=707474r2=707475view=diff == --- xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/models/XSDFACM.java (original) +++ xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/models/XSDFACM.java Thu Oct 23 14:12:24 2008 @@ -23,6 +23,7 @@ import org.apache.xerces.impl.Constants; import org.apache.xerces.impl.dtd.models.CMNode; import org.apache.xerces.impl.dtd.models.CMStateSet; +import org.apache.xerces.impl.xs.SchemaGrammar; import org.apache.xerces.impl.xs.SchemaSymbols; import org.apache.xerces.impl.xs.SubstitutionGroupHandler; import org.apache.xerces.impl.xs.XMLSchemaException; @@ -268,7 +269,7 @@ * * @exception RuntimeException thrown on error */ -public Object oneTransition(QName curElem, int[] state, SubstitutionGroupHandler subGroupHandler) { +public Object oneTransition(QName curElem, int[] state, SubstitutionGroupHandler subGroupHandler, SchemaGrammar grammar) { int curState = state[0]; if(curState == XSCMValidator.FIRST_ERROR || curState == XSCMValidator.SUBSEQUENT_ERROR) { @@ -282,14 +283,13 @@ } // apply open content - suffix mode else if (state[3] == STATE_SUFFIX) { -if (fOpenContent.fWildcard.allowQName(curElem)) { +if (allowExpandedName(fOpenContent.fWildcard, curElem, subGroupHandler, grammar)) {//if (fOpenContent.fWildcard.allowQName(curElem)) { return fOpenContent; } -else { -state[1] = curState; -state[0] = XSCMValidator.FIRST_ERROR; -return findMatchingDecl(curElem, subGroupHandler); -} + +state[1] = curState; +state[0] = XSCMValidator.FIRST_ERROR; +return findMatchingDecl(curElem, subGroupHandler); } int nextState = 0; @@ -309,15 +309,21 @@ } } else if (type == XSParticleDecl.PARTICLE_WILDCARD) { -if (((XSWildcardDecl)fElemMap[elemIndex]).allowNamespace(curElem.uri)) { +// XML Schema 1.0 +if (fSchemaVersion Constants.SCHEMA_VERSION_1_1) { +if (((XSWildcardDecl)fElemMap[elemIndex]).allowNamespace(curElem.uri)) { +matchingDecl = fElemMap[elemIndex]; +break; +} +} +// XML Schema 1.1 +else if (allowExpandedName((XSWildcardDecl)fElemMap[elemIndex], curElem, subGroupHandler, grammar)) { matchingDecl = fElemMap[elemIndex]; -// XML Schema 1.1 - and element has precedence over a wildcard +// Element has precedence over a wildcard // if no occurences or we reached minOccurs, keep looking for // and element declaration -if (fSchemaVersion == Constants.SCHEMA_VERSION_1_1) { -if (fCountingStates == null || fCountingStates[curState] == null || state[2] == fCountingStates[curState].minOccurs) { -toMatchElementDecl = true; -} +if (fCountingStates == null || fCountingStates[curState] == null || state[2] == fCountingStates[curState].minOccurs) { +toMatchElementDecl = true; } break; } @@ -348,30 +354,8 @@ if (matchingDecl == null) { // XML Schema 1.1 // Validate against Open Content -if (fOpenContent != null) { -// if suffix mode, we should have reached a final state -if (fOpenContent.fMode == XSOpenContentDecl.MODE_SUFFIX) { -if (fFinalStateFlags[curState]) { -if (fCountingStates != null) { -Occurence o = fCountingStates[curState]; -if (o != null state[2] o.minOccurs) { -// not enough loops on the current state to be considered final. -state[1] = state[0]; -state[0] = XSCMValidator.FIRST_ERROR; -return findMatchingDecl(curElem, subGroupHandler); -} -} -state[3] = STATE_SUFFIX; -} -else { -state[1] = state[0]; -state[0] = XSCMValidator.FIRST_ERROR; -return
svn commit: r702620 - in /xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs: ./ traversers/
Author: knoaman Date: Tue Oct 7 13:36:30 2008 New Revision: 702620 URL: http://svn.apache.org/viewvc?rev=702620view=rev Log: Refactor wildcard constraint checking. Move isSubsetOf, performIntersectionWith and perfromUnionWith to XSConstraints. Modified: xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/XS10Constraints.java xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/XS11Constraints.java xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/XSAttributeGroupDecl.java xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/XSConstraints.java xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/XSWildcardDecl.java xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/traversers/XSDAbstractTraverser.java xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/traversers/XSDComplexTypeTraverser.java Modified: xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/XS10Constraints.java URL: http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/XS10Constraints.java?rev=702620r1=702619r2=702620view=diff == --- xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/XS10Constraints.java (original) +++ xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/XS10Constraints.java Tue Oct 7 13:36:30 2008 @@ -25,7 +25,7 @@ * @author Sandy Gao, IBM * @author Khaled Noaman, IBM * - * @version $Id:$ + * @version $Id$ * */ class XS10Constraints extends XSConstraints { @@ -54,7 +54,7 @@ public boolean overlapUPA(XSWildcardDecl wildcard1, XSWildcardDecl wildcard2) { // if the intersection of the two wildcard is not empty list -XSWildcardDecl intersect = wildcard1.performIntersectionWith(wildcard2, wildcard1.fProcessContents); +XSWildcardDecl intersect = performIntersectionWith(wildcard1, wildcard2, wildcard1.fProcessContents); if (intersect == null || intersect.fType != XSWildcardDecl.NSCONSTRAINT_LIST || intersect.fNamespaceList.length != 0) { Modified: xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/XS11Constraints.java URL: http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/XS11Constraints.java?rev=702620r1=702619r2=702620view=diff == --- xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/XS11Constraints.java (original) +++ xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/XS11Constraints.java Tue Oct 7 13:36:30 2008 @@ -24,7 +24,7 @@ * * @author Khaled Noaman, IBM * - * @version $Id:$ + * @version $Id$ * */ class XS11Constraints extends XSConstraints { @@ -43,7 +43,7 @@ XSWildcardDecl wildcard2) { // if the intersection of the two wildcards is not any and // and the {namespaces} of such intersection is not the empty set -XSWildcardDecl intersect = wildcard1.performIntersectionWith(wildcard2, wildcard1.fProcessContents); +XSWildcardDecl intersect = performIntersectionWith(wildcard1, wildcard2, wildcard1.fProcessContents); if (intersect.fType != XSWildcardDecl.NSCONSTRAINT_ANY intersect.fNamespaceList.length != 0) { return true; Modified: xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/XSAttributeGroupDecl.java URL: http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/XSAttributeGroupDecl.java?rev=702620r1=702619r2=702620view=diff == --- xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/XSAttributeGroupDecl.java (original) +++ xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/XSAttributeGroupDecl.java Tue Oct 7 13:36:30 2008 @@ -187,7 +187,6 @@ return errorArgs; } - // // derivation-ok-restriction. Constraint 2.1.3 // @@ -268,7 +267,7 @@ errorArgs = new Object[]{typeName, derivation-ok-restriction.4.1}; return errorArgs; } -if (! fAttributeWC.isSubsetOf(baseGroup.fAttributeWC)) { +if (! xsConstraints.isSubsetOf(fAttributeWC, baseGroup.fAttributeWC)) { errorArgs = new Object[]{typeName, derivation-ok-restriction.4.2}; return errorArgs; } Modified: xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/XSConstraints.java URL
svn commit: r702622 - /xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/traversers/XSAttributeChecker.java
Author: knoaman Date: Tue Oct 7 13:37:41 2008 New Revision: 702622 URL: http://svn.apache.org/viewvc?rev=702622view=rev Log: fill in 1.1 local and global attribute maps Modified: xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/traversers/XSAttributeChecker.java Modified: xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/traversers/XSAttributeChecker.java URL: http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/traversers/XSAttributeChecker.java?rev=702622r1=702621r2=702622view=diff == --- xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/traversers/XSAttributeChecker.java (original) +++ xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/traversers/XSAttributeChecker.java Tue Oct 7 13:37:41 2008 @@ -550,6 +550,8 @@ // use = (optional | prohibited | required) : optional attrList.put(SchemaSymbols.ATT_USE, allAttrs[ATT_USE_D]); fEleAttrsMapL.put(ATTRIBUTE_N, attrList); +// TODO: XML Schema 1.1 - different list +fEleAttrs11MapL.put(ATTRIBUTE_N, attrList); // for element attribute - local ref attrList = Container.getContainer(5); @@ -590,6 +592,8 @@ // type = QName attrList.put(SchemaSymbols.ATT_TYPE, allAttrs[ATT_TYPE_N]); fEleAttrsMapG.put(SchemaSymbols.ELT_ELEMENT, attrList); +// REVISIT: XML Schema 1.1 - different list? +fEleAttrs11MapG.put(SchemaSymbols.ELT_ELEMENT, attrList); // for element element - local name attrList = Container.getContainer(10); @@ -614,6 +618,8 @@ // type = QName attrList.put(SchemaSymbols.ATT_TYPE, allAttrs[ATT_TYPE_N]); fEleAttrsMapL.put(ELEMENT_N, attrList); +// TODO: XML Schema 1.1 - different attribute list +fEleAttrs11MapL.put(ELEMENT_N, attrList); // for element element - local ref attrList = Container.getContainer(4); @@ -714,6 +720,8 @@ // processContents = (lax | skip | strict) : strict attrList.put(SchemaSymbols.ATT_PROCESSCONTENTS, allAttrs[ATT_PROCESS_C_D]); fEleAttrsMapL.put(SchemaSymbols.ELT_ANYATTRIBUTE, attrList); +// TODO: XML Schema 1.1 different attribute list +fEleAttrs11MapL.put(SchemaSymbols.ELT_ANYATTRIBUTE, attrList); // for element complexContent - local attrList = Container.getContainer(2); @@ -801,6 +809,8 @@ // processContents = (lax | skip | strict) : strict attrList.put(SchemaSymbols.ATT_PROCESSCONTENTS, allAttrs[ATT_PROCESS_C_D]); fEleAttrsMapL.put(SchemaSymbols.ELT_ANY, attrList); +// TODO: XML Schema 1.1 different attribute list +fEleAttrs11MapL.put(SchemaSymbols.ELT_ANY, attrList); // for element unique - local attrList = Container.getContainer(2); @@ -811,6 +821,11 @@ fEleAttrsMapL.put(SchemaSymbols.ELT_UNIQUE, attrList); // for element key - local fEleAttrsMapL.put(SchemaSymbols.ELT_KEY, attrList); +// XML Schema 1.1 - same list +// for element unique - local +fEleAttrs11MapL.put(SchemaSymbols.ELT_UNIQUE, attrList); +// for element key - local +fEleAttrs11MapL.put(SchemaSymbols.ELT_KEY, attrList); // for element keyref - local attrList = Container.getContainer(3); @@ -821,6 +836,8 @@ // refer = QName attrList.put(SchemaSymbols.ATT_REFER, allAttrs[ATT_REFER_R]); fEleAttrsMapL.put(SchemaSymbols.ELT_KEYREF, attrList); +// XML Schema 1.1 +fEleAttrs11MapL.put(SchemaSymbols.ELT_KEYREF, attrList); // for element selector - local attrList = Container.getContainer(2); - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
svn commit: r702646 - in /xerces/java/branches/xml-schema-1.1-dev: samples/xni/ src/org/apache/xerces/impl/xs/ src/org/apache/xerces/impl/xs/traversers/ src/org/apache/xerces/xs/
Author: knoaman Date: Tue Oct 7 14:41:07 2008 New Revision: 702646 URL: http://svn.apache.org/viewvc?rev=702646view=rev Log: Multiple subsutition group heads - patch by John Chan Modified: xerces/java/branches/xml-schema-1.1-dev/samples/xni/PSVIWriter.java xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/SubstitutionGroupHandler.java xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/XSElementDecl.java xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/traversers/XSAttributeChecker.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/xs/XSElementDeclaration.java Modified: xerces/java/branches/xml-schema-1.1-dev/samples/xni/PSVIWriter.java URL: http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/samples/xni/PSVIWriter.java?rev=702646r1=702645r2=702646view=diff == --- xerces/java/branches/xml-schema-1.1-dev/samples/xni/PSVIWriter.java (original) +++ xerces/java/branches/xml-schema-1.1-dev/samples/xni/PSVIWriter.java Tue Oct 7 14:41:07 2008 @@ -1859,7 +1859,11 @@ sendElementEvent(psv:substitutionGroupAffiliation); } else { sendIndentedElement(psv:substitutionGroupAffiliation); -processPSVIElementRef(psv:elementDeclaration, elem.getSubstitutionGroupAffiliation()); +XSElementDeclaration[] subgroups = elem.getSubstitutionGroupAffiliation(); +for (int i=0; isubgroups.length; i++) { +XSElementDeclaration subgroup = subgroups[i]; +processPSVIElementRef(psv:elementDeclaration, subgroup); +} sendUnIndentedElement(psv:substitutionGroupAffiliation); } } Modified: xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/SubstitutionGroupHandler.java URL: http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/SubstitutionGroupHandler.java?rev=702646r1=702645r2=702646view=diff == --- xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/SubstitutionGroupHandler.java (original) +++ xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/SubstitutionGroupHandler.java Tue Oct 7 14:41:07 2008 @@ -104,12 +104,8 @@ } // 2.2 There is a chain of {substitution group affiliation}s from D to C, that is, either D's {substitution group affiliation} is C, or D's {substitution group affiliation}'s {substitution group affiliation} is C, or . . . -XSElementDecl subGroup = element.fSubGroup; -while (subGroup != null subGroup != exemplar) { -subGroup = subGroup.fSubGroup; -} - -if (subGroup == null) { +XSElementDecl[] subGroup = element.fSubGroup; +if (subGroup == null || !checkSubstitutionGroupAffil(subGroup, exemplar)) { return false; } @@ -119,6 +115,18 @@ return typeDerivationOK(element.fType, exemplar.fType, blockingConstraint); } +// Recursively check if there is a element in substitution group matching exemplar +private boolean checkSubstitutionGroupAffil(XSElementDecl[] subGroupArray, XSElementDecl examplar) { +for (int i=0; isubGroupArray.length; i++) { +XSElementDecl element = subGroupArray[i]; +if (element == examplar) +return true; +if (element.fSubGroup != null) +if (checkSubstitutionGroupAffil(element.fSubGroup, examplar)) return true; +} +return false; +} + private boolean typeDerivationOK(XSTypeDefinition derived, XSTypeDefinition base, short blockingConstraint) { short devMethod = 0, blockConstraint = blockingConstraint; @@ -199,22 +207,27 @@ /** * add a list of substitution group information. */ -public void addSubstitutionGroup(XSElementDecl[] elements) { -XSElementDecl subHead, element; +public void addSubstitutionGroup(XSElementDecl[] elements) { +XSElementDecl element; +XSElementDecl[] subHeads; Vector subGroup; // for all elements with substitution group affiliation for (int i = elements.length-1; i = 0; i--) { element = elements[i]; -subHead = element.fSubGroup; +subHeads = element.fSubGroup; + // check whether this an entry for this element -subGroup = (Vector)fSubGroupsB.get(subHead); -if (subGroup == null) { -// if not, create a new one -subGroup = new Vector(); -fSubGroupsB.put(subHead, subGroup); +for (int j=0
svn commit: r702650 - in /xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/traversers: XSDElementTraverser.java XSDTypeAlternativeTraverser.java
Author: knoaman Date: Tue Oct 7 14:47:23 2008 New Revision: 702650 URL: http://svn.apache.org/viewvc?rev=702650view=rev Log: Fix indentation problem Modified: 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/XSDTypeAlternativeTraverser.java 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=702650r1=702649r2=702650view=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 Tue Oct 7 14:47:23 2008 @@ -517,7 +517,7 @@ // 4 If there is an {substitution group affiliation}, the {type definition} of the element declaration must be validly derived from the {type definition} of the {substitution group affiliation}, given the value of the {substitution group exclusions} of the {substitution group affiliation}, as defined in Type Derivation OK (Complex) (3.4.6) (if the {type definition} is complex) or as defined in Type Derivation OK (Simple) (3.14.6) (if the {type definition} is simple). if (element.fSubGroup != null) { - for (int i=0; i element.fSubGroup.length; i++) { +for (int i=0; i element.fSubGroup.length; i++) { if (!fSchemaHandler.fXSConstraints.checkTypeDerivationOk(element.fType, element.fSubGroup[i].fType, element.fSubGroup[i].fFinal)) { reportSchemaError (e-props-correct.4, new Object[]{nameAtt, ((QName)subGroupAtt.get(i)).prefix +:+((QName)subGroupAtt.get(i)).localpart}, elmDecl); } Modified: xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/traversers/XSDTypeAlternativeTraverser.java URL: http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/traversers/XSDTypeAlternativeTraverser.java?rev=702650r1=702649r2=702650view=diff == --- xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/traversers/XSDTypeAlternativeTraverser.java (original) +++ xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/traversers/XSDTypeAlternativeTraverser.java Tue Oct 7 14:47:23 2008 @@ -49,12 +49,12 @@ */ class XSDTypeAlternativeTraverser extends XSDAbstractTraverser { - XSDTypeAlternativeTraverser (XSDHandler handler, +XSDTypeAlternativeTraverser (XSDHandler handler, XSAttributeChecker attrChecker) { super(handler, attrChecker); } - - /** + +/** * Traverse the given alternative element and update the * schema grammar. Validate the content of the type alternative * element. @@ -111,17 +111,17 @@ XSTypeDefinition typeDef = null; if (childName.equals(SchemaSymbols.ELT_COMPLEXTYPE)) { typeDef = fSchemaHandler.fComplexTypeTraverser.traverseLocal(childNode, schemaDoc, grammar); - hasAnonType = true; +hasAnonType = true; childNode = DOMUtil.getNextSiblingElement(childNode); - } +} else if (childName.equals(SchemaSymbols.ELT_SIMPLETYPE)) { - typeDef = fSchemaHandler.fSimpleTypeTraverser.traverseLocal(childNode, schemaDoc, grammar); - hasAnonType = true; +typeDef = fSchemaHandler.fSimpleTypeTraverser.traverseLocal(childNode, schemaDoc, grammar); +hasAnonType = true; childNode = DOMUtil.getNextSiblingElement(childNode); } if (alternativeType == null) { - alternativeType = typeDef; +alternativeType = typeDef; } // type and either simpleType or complexType are mutually exclusive. @@ -133,12 +133,12 @@ // if the type definition component is not present.. // i.e. test attr value is absent and no anonymous types are defined if (typeAtt == null !hasAnonType) { - reportSchemaError(src-type-alternative.3.12.13.2, null, altElement); +reportSchemaError(src-type-alternative.3.12.13.2, null, altElement); } // fall back to the element declaration's type if (alternativeType == null) { - alternativeType= element.fType; +alternativeType= element.fType; } // not expecting any more children
svn commit: r700258 - in /xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs: ./ models/ traversers/
Author: knoaman Date: Mon Sep 29 14:18:28 2008 New Revision: 700258 URL: http://svn.apache.org/viewvc?rev=700258view=rev Log: Refactor XSConstraints to allow XML Schema 1.0 vs. 1.1 constraint checking Added: xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/XS10Constraints.java (with props) xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/XS11Constraints.java (with props) Modified: 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/XSAttributeGroupDecl.java xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/XSConstraints.java xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/models/XS11AllCM.java xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/models/XSAllCM.java xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/models/XSCMValidator.java xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/models/XSDFACM.java xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/models/XSEmptyCM.java xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/traversers/XSDAttributeGroupTraverser.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 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=700258r1=700257r2=700258view=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 Mon Sep 29 14:18:28 2008 @@ -246,6 +246,9 @@ /** XML Schema 1.1 flag */ private short fSchemaVersion = Constants.SCHEMA_VERSION_1_0; + +/** XML Schema Constraints checker */ +private XSConstraints fXSConstraints = XSConstraints.XS_1_0_CONSTRAINTS; // default constructor. Create objects we absolutely need: public XMLSchemaLoader() { @@ -321,7 +324,7 @@ builder = new CMBuilder(nodeFactory); } fCMBuilder = builder; -fSchemaHandler = new XSDHandler(fGrammarBucket); +fSchemaHandler = new XSDHandler(fGrammarBucket, fSchemaVersion, fXSConstraints); fDeclPool = new XSDeclarationPool(); fJAXPCache = new WeakHashMap(); @@ -485,11 +488,13 @@ void setSchemaVersion(String version) { if (version.equals(Constants.W3C_XML_SCHEMA11_NS_URI)) { fSchemaVersion = Constants.SCHEMA_VERSION_1_1; +fXSConstraints = XSConstraints.XS_1_1_CONSTRAINTS; } else { fSchemaVersion = Constants.SCHEMA_VERSION_1_0; +fXSConstraints = XSConstraints.XS_1_0_CONSTRAINTS; } -fSchemaHandler.setSchemaVersion(fSchemaVersion); +fSchemaHandler.setSchemaVersionInfo(fSchemaVersion, fXSConstraints); fCMBuilder.setSchemaVersion(fSchemaVersion); } @@ -501,6 +506,13 @@ } /** + * Return XML Schema Constraints + */ +XSConstraints getXSConstraints() { + return fXSConstraints; +} + +/** * Returns a Grammar object by parsing the contents of the * entities pointed to by sources. * @@ -555,7 +567,7 @@ // NOTE: we only need to verify full checking in case the schema was not provided via JAXP // since full checking already verified for all JAXP schemas if(fIsCheckedFully fJAXPCache.get(grammar) != grammar) { -XSConstraints.fullSchemaChecking(fGrammarBucket, fSubGroupHandler, fCMBuilder, fErrorReporter); +fXSConstraints.fullSchemaChecking(fGrammarBucket, fSubGroupHandler, fCMBuilder, fErrorReporter); } } return grammar; @@ -750,7 +762,7 @@ fJAXPSource instanceof InputSource) { fJAXPCache.put(fJAXPSource, g); if (fIsCheckedFully) { -XSConstraints.fullSchemaChecking(fGrammarBucket, fSubGroupHandler, fCMBuilder, fErrorReporter); + fXSConstraints.fullSchemaChecking(fGrammarBucket, fSubGroupHandler, fCMBuilder, fErrorReporter
svn commit: r697134 [2/2] - in /xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs: SchemaSymbols.java traversers/XSAttributeChecker.java traversers/XSDComplexTypeTraverser.java tra
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=697134r1=697133r2=697134view=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 Fri Sep 19 08:36:02 2008 @@ -24,9 +24,11 @@ import org.apache.xerces.impl.xs.SchemaNamespaceSupport; import org.apache.xerces.impl.xs.SchemaSymbols; import org.apache.xerces.impl.xs.XMLSchemaException; +import org.apache.xerces.impl.xs.XSAttributeGroupDecl; import org.apache.xerces.impl.xs.XSOpenContentDecl; import org.apache.xerces.impl.xs.util.XInt; import org.apache.xerces.util.SymbolTable; +import org.apache.xerces.xni.QName; import org.w3c.dom.Element; /** @@ -85,6 +87,10 @@ // once removeAnnotations has been called. protected XSAnnotationInfo fAnnotations = null; +// defaultAttributes and its corresponding attribute group +QName fDefaultAttributes = null; +XSAttributeGroupDecl fDefaultAGroup = null; + // defaultOpenContent XSOpenContentDecl fDefaultOpenContent = null; @@ -125,6 +131,8 @@ fNamespaceSupportRoot = new SchemaNamespaceSupport(fNamespaceSupport); +fDefaultAttributes = (QName) fSchemaAttrs[XSAttributeChecker.ATTIDX_DEFAULTATTRAPPLY]; + //set namespace support fValidationContext.setNamespaceSupport(fNamespaceSupport); fValidationContext.setSymbolTable(symbolTable); - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]