You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xerces.apache.org by tn...@apache.org on 2001/05/17 20:14:34 UTC
cvs commit: xml-xerces/c/src/validators/schema SchemaValidator.cpp
tng 01/05/17 11:14:34
Modified: c/src/validators/schema SchemaValidator.cpp
Log:
Schema Fix: if nillable, it's an error to have default value
Revision Changes Path
1.8 +12 -0 xml-xerces/c/src/validators/schema/SchemaValidator.cpp
Index: SchemaValidator.cpp
===================================================================
RCS file: /home/cvs/xml-xerces/c/src/validators/schema/SchemaValidator.cpp,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- SchemaValidator.cpp 2001/05/11 15:17:46 1.7
+++ SchemaValidator.cpp 2001/05/17 18:14:32 1.8
@@ -56,6 +56,9 @@
/*
* $Log: SchemaValidator.cpp,v $
+ * Revision 1.8 2001/05/17 18:14:32 tng
+ * Schema Fix: if nillable, it's an error to have default value
+ *
* Revision 1.7 2001/05/11 15:17:46 tng
* Schema: Nillable fixes.
*
@@ -150,6 +153,10 @@
|| (modelType == SchemaElementDecl::Children))
{
// if nillable, it's an error to have value
+ // XML Schema REC: Validation Rule: Element Locally Valid (Element)
+ // 3.2.1 The element information item must have no
+ // character or element information item [children].
+ //
if (fNil) {
if (childCount > 0 || XMLString::compareString(fDatatypeBuffer.getRawBuffer(), XMLUni::fgZeroLenString))
emitError(XMLValid::NilAttrNotEmpty, elemDecl->getFullName());
@@ -191,6 +198,11 @@
if (elemDefaultValue) {
// a default value was specified
+
+ // if nillable, it's an error to have default value
+ if (fNil)
+ emitError(XMLValid::NilAttrNotEmpty, elemDecl->getFullName());
+
if (!XMLString::compareString(value, XMLUni::fgZeroLenString)) {
// if this element didn't specified any value
// use default value
---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-cvs-help@xml.apache.org