You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xerces.apache.org by mu...@apache.org on 2011/08/13 05:55:35 UTC
svn commit: r1157313 - in
/xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs:
QNameDV.java XSSimpleTypeDecl.java
Author: mukulg
Date: Sat Aug 13 03:55:34 2011
New Revision: 1157313
URL: http://svn.apache.org/viewvc?rev=1157313&view=rev
Log:
doing a schema 1.1 commit. adding rules for validating values of types NCName, Name, NMToken & QName with XML 1.1 rules if working in XSD 1.1 mode, else (if we would work in XSD 1.0 mode) we would use the XML 1.0 rules.
Modified:
xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/QNameDV.java
xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/XSSimpleTypeDecl.java
Modified: xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/QNameDV.java
URL: http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/QNameDV.java?rev=1157313&r1=1157312&r2=1157313&view=diff
==============================================================================
--- xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/QNameDV.java (original)
+++ xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/QNameDV.java Sat Aug 13 03:55:34 2011
@@ -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.util.XML11Char;
import org.apache.xerces.util.XMLChar;
import org.apache.xerces.xni.QName;
import org.apache.xerces.xs.datatypes.XSQName;
@@ -52,12 +53,17 @@ public class QNameDV extends TypeValidat
localpart = content;
}
- // both prefix (if any) a nd localpart must be valid NCName
- if (prefix.length() > 0 && !XMLChar.isValidNCName(prefix))
+ boolean isSchema11 = context.getTypeValidatorHelper().isXMLSchema11();
+
+ // both prefix (if any) and localpart must be valid NCName
+ // if using XSD 1.1, use the XML 1.1 rules of validating the prefix and the local part, else use the XML 1.0 rules
+ if (prefix.length() > 0 && ((isSchema11) ? !XML11Char.isXML11ValidNCName(prefix) : !XMLChar.isValidNCName(prefix))) {
throw new InvalidDatatypeValueException("cvc-datatype-valid.1.2.1", new Object[]{content, "QName"});
+ }
- if(!XMLChar.isValidNCName(localpart))
+ if((isSchema11) ? !XML11Char.isXML11ValidNCName(localpart) : !XMLChar.isValidNCName(localpart)) {
throw new InvalidDatatypeValueException("cvc-datatype-valid.1.2.1", new Object[]{content, "QName"});
+ }
// resove prefix to a uri, report an error if failed
String uri = context.getURI(prefix);
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=1157313&r1=1157312&r2=1157313&view=diff
==============================================================================
--- xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/XSSimpleTypeDecl.java (original)
+++ xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/XSSimpleTypeDecl.java Sat Aug 13 03:55:34 2011
@@ -37,6 +37,7 @@ import org.apache.xerces.impl.xs.util.Ob
import org.apache.xerces.impl.xs.util.ShortListImpl;
import org.apache.xerces.impl.xs.util.StringListImpl;
import org.apache.xerces.impl.xs.util.XSObjectListImpl;
+import org.apache.xerces.util.XML11Char;
import org.apache.xerces.util.XMLChar;
import org.apache.xerces.xni.NamespaceContext;
import org.apache.xerces.xs.ShortList;
@@ -2073,17 +2074,19 @@ public class XSSimpleTypeDecl implements
if (fPatternType != SPECIAL_PATTERN_NONE) {
boolean seenErr = false;
+ boolean isSchema11 = context.getTypeValidatorHelper().isXMLSchema11();
+ // if using XSD 1.1, use the XML 1.1 rules of validating the NMTOKEN, Name and NCName else use the XML 1.0 rules
if (fPatternType == SPECIAL_PATTERN_NMTOKEN) {
// PATTERN "\\c+"
- seenErr = !XMLChar.isValidNmtoken(nvalue);
+ seenErr = (isSchema11) ? !XML11Char.isXML11ValidNmtoken(nvalue) : !XMLChar.isValidNmtoken(nvalue);
}
else if (fPatternType == SPECIAL_PATTERN_NAME) {
- // PATTERN "\\i\\c*"
- seenErr = !XMLChar.isValidName(nvalue);
+ // PATTERN "\\i\\c*"
+ seenErr = (isSchema11) ? !XML11Char.isXML11ValidName(nvalue) : !XMLChar.isValidName(nvalue);
}
else if (fPatternType == SPECIAL_PATTERN_NCNAME) {
// PATTERN "[\\i-[:]][\\c-[:]]*"
- seenErr = !XMLChar.isValidNCName(nvalue);
+ seenErr = (isSchema11) ? !XML11Char.isXML11ValidNCName(nvalue) : !XMLChar.isValidNCName(nvalue);
}
if (seenErr) {
throw new InvalidDatatypeValueException("cvc-datatype-valid.1.2.1",
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@xerces.apache.org
For additional commands, e-mail: commits-help@xerces.apache.org