Author: mukulg
Date: Thu Jan 27 16:24:08 2011
New Revision: 1064184
URL: http://svn.apache.org/viewvc?rev=1064184&view=rev
Log:
doing few variable renamings and clarifying in relevant javadocs, processing
related to schema 1.1 assertions processing.
Modified:
xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/XMLAssertPsychopathImpl.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/XSDAssertionValidator.java
xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/util/XSTypeHelper.java
Modified:
xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/XMLAssertPsychopathImpl.java
URL:
http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/XMLAssertPsychopathImpl.java?rev=1064184&r1=1064183&r2=1064184&view=diff
==============================================================================
---
xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/XMLAssertPsychopathImpl.java
(original)
+++
xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/XMLAssertPsychopathImpl.java
Thu Jan 27 16:24:08 2011
@@ -224,10 +224,11 @@ public class XMLAssertPsychopathImpl ext
fAssertRootStack.pop();
// get assertions and go one level up on the stack
List assertions = (List) fAssertListStack.pop();
- Boolean atomicValueValidity = (Boolean)
augs.getItem("ATOMIC_VALUE_VALIDITY");
- if (atomicValueValidity.booleanValue()) {
- // depending on simple content's validity status from
XMLSchemaValidator, process
- // XML schema assertions.
+ Boolean isAssertProcessingNeeded = (Boolean)
augs.getItem("ASSERT_PROC_NEEDED_FOR_UNION");
+ if (isAssertProcessingNeeded.booleanValue()) {
+ // if in a pre-processing step in XMLSchemaValidator, a
member type of union in XML Schema namespace successfully
+ // validated an atomic value, don't process assertions on
such union types. For all other use-cases (non union
+ // simple types or complex types, applicable assertions
would always be processed.
processAllAssertionsOnElement(element, itemType,
memberTypes, assertions, elemPSVI);
}
}
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=1064184&r1=1064183&r2=1064184&view=diff
==============================================================================
---
xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/XMLSchemaValidator.java
(original)
+++
xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/XMLSchemaValidator.java
Thu Jan 27 16:24:08 2011
@@ -1348,9 +1348,9 @@ public class XMLSchemaValidator
// assertion validator subcomponent
private XSDAssertionValidator fAssertionValidator = null;
- // variable to track validity of simple content for union types.
- // used for assertions processing.
- private boolean fisAtomicValueValidForSTVarietyUnion = true;
+ // variable to track validity of simple content for union types. if a
member type of union in XML Schema namespace, can
+ // successfully validate (in a preprocess step in this class) an atomic
value, don't process assertions for such union types.
+ private boolean fisAssertProcessingNeededForUnion = true;
// 'type alternative' validator subcomponent
private XSDTypeAlternativeValidator fTypeAlternativeValidator = null;
@@ -2543,8 +2543,8 @@ public class XMLSchemaValidator
fAssertionValidator.handleEndElement(element, fCurrentElemDecl,
fCurrentType, fNotation,
fGrammarBucket,
-
fisAtomicValueValidForSTVarietyUnion);
- fisAtomicValueValidForSTVarietyUnion = true;
+
fisAssertProcessingNeededForUnion);
+ fisAssertProcessingNeededForUnion = true;
}
// Check if we should modify the xsi:type ignore depth
@@ -3231,7 +3231,7 @@ public class XMLSchemaValidator
attDV.getVariety() == XSSimpleTypeDefinition.VARIETY_UNION) {
if
(XSTypeHelper.isAtomicValueValidForAnUnion(attDV.getMemberTypes(),
attrValue,
null)) {
- fisAtomicValueValidForSTVarietyUnion = false;
+ fisAssertProcessingNeededForUnion = false;
}
}
@@ -3257,7 +3257,7 @@ public class XMLSchemaValidator
}
}
catch (InvalidDatatypeValueException idve) {
- fisAtomicValueValidForSTVarietyUnion = false;
+ fisAssertProcessingNeededForUnion = false;
reportSchemaError(idve.getKey(), idve.getArgs());
reportSchemaError(
"cvc-attribute.3",
@@ -3387,12 +3387,12 @@ public class XMLSchemaValidator
attDV.getVariety() ==
XSSimpleTypeDefinition.VARIETY_UNION) {
if
(XSTypeHelper.isAtomicValueValidForAnUnion(attDV.getMemberTypes(),
null,
defaultValue)) {
- fisAtomicValueValidForSTVarietyUnion = false;
+ fisAssertProcessingNeededForUnion = false;
}
}
}
catch (InvalidDatatypeValueException idve) {
- fisAtomicValueValidForSTVarietyUnion = false;
+ fisAssertProcessingNeededForUnion = false;
reportSchemaError(idve.getKey(), idve.getArgs());
}
fValidationState.setFacetChecking(facetChecking);
@@ -3602,11 +3602,11 @@ public class XMLSchemaValidator
if
(XSTypeHelper.isAtomicValueValidForAnUnion(dv.getMemberTypes(),
String.valueOf(textContent),
null)) {
- fisAtomicValueValidForSTVarietyUnion = false;
+ fisAssertProcessingNeededForUnion = false;
}
}
} catch (InvalidDatatypeValueException e) {
- fisAtomicValueValidForSTVarietyUnion = false;
+ fisAssertProcessingNeededForUnion = false;
reportSchemaError(e.getKey(), e.getArgs());
reportSchemaError(
"cvc-type.3.1.3",
@@ -3653,11 +3653,11 @@ public class XMLSchemaValidator
if
(XSTypeHelper.isAtomicValueValidForAnUnion(dv.getMemberTypes(),
String.valueOf(textContent),
null)) {
- fisAtomicValueValidForSTVarietyUnion = false;
+ fisAssertProcessingNeededForUnion = false;
}
}
} catch (InvalidDatatypeValueException e) {
- fisAtomicValueValidForSTVarietyUnion = false;
+ fisAssertProcessingNeededForUnion = false;
reportSchemaError(e.getKey(), e.getArgs());
reportSchemaError("cvc-complex-type.2.2", new Object[] {
element.rawname });
}
Modified:
xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/XSDAssertionValidator.java
URL:
http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/XSDAssertionValidator.java?rev=1064184&r1=1064183&r2=1064184&view=diff
==============================================================================
---
xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/XSDAssertionValidator.java
(original)
+++
xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/XSDAssertionValidator.java
Thu Jan 27 16:24:08 2011
@@ -122,7 +122,7 @@ public class XSDAssertionValidator {
*/
public void handleEndElement(QName element, XSElementDecl elemDecl,
XSTypeDefinition typeDef, XSNotationDecl
notation,
- XSGrammarBucket grammarBucket, boolean
atomicValueValid) {
+ XSGrammarBucket grammarBucket, boolean
isAssertProcessingNeededForUnion) {
if (fAssertionProcessor != null) {
try {
@@ -136,7 +136,7 @@ public class XSDAssertionValidator {
// construct the augmentations object for assertions. store
assertPSVI into the augmentations.
AugmentationsImpl assertAugs = new AugmentationsImpl();
assertAugs.putItem(Constants.ELEMENT_PSVI, assertPSVI);
- assertAugs.putItem("ATOMIC_VALUE_VALIDITY",
Boolean.valueOf(atomicValueValid));
+ assertAugs.putItem("ASSERT_PROC_NEEDED_FOR_UNION",
Boolean.valueOf(isAssertProcessingNeededForUnion));
fAssertionProcessor.endElement(element, assertAugs);
} catch (Exception ex) {
throw new XNIException(ex.getMessage(), ex);
Modified:
xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/util/XSTypeHelper.java
URL:
http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/util/XSTypeHelper.java?rev=1064184&r1=1064183&r2=1064184&view=diff
==============================================================================
---
xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/util/XSTypeHelper.java
(original)
+++
xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/util/XSTypeHelper.java
Thu Jan 27 16:24:08 2011
@@ -82,28 +82,25 @@ public class XSTypeHelper {
} // isURIEqual
/*
- * Determine if an atomic value is valid with respect to any of the
union's member types.
- * If this method returns 'true', then the value is valid with respect to
entire union
- * schema component.
+ * Determine if an atomic value is valid with respect to any of the
union's member types (those that are in XML Schema namespace).
+ * If this method returns 'true', then the value is valid with respect to
entire union schema component.
*/
public static boolean isAtomicValueValidForAnUnion(XSObjectList
memberTypes, String content, ValidatedInfo validatedInfo) {
- boolean isValid = false;
+ boolean isValueValid = false;
- // check the union member types in order to check for validity of an
'atomic value'. the validity
- // of 'atomic value' wrt to the 1st available type in union's member
type collection, is
- // sufficient to achieve the objective of this method.
+ // check the union member types in order to check for validity of an
'atomic value'. the validity of 'atomic value' wrt
+ // to the 1st available type in union's member type collection, is
sufficient to achieve the objective of this method.
for (int memTypeIdx = 0; memTypeIdx < memberTypes.getLength();
memTypeIdx++) {
XSSimpleType simpleTypeDv = (XSSimpleType)
memberTypes.item(memTypeIdx);
- if
(SchemaSymbols.URI_SCHEMAFORSCHEMA.equals(simpleTypeDv.getNamespace())) {
- if (XSTypeHelper.isValueValidForASimpleType(content,
simpleTypeDv)) {
- isValid = true;
- break;
- }
+ if
(SchemaSymbols.URI_SCHEMAFORSCHEMA.equals(simpleTypeDv.getNamespace()) &&
+ XSTypeHelper.isValueValidForASimpleType(content,
simpleTypeDv)) {
+ isValueValid = true;
+ break;
}
}
- return isValid;
+ return isValueValid;
} // isAtomicValueValidForAnUnion
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]