From 25a64fc3e871c99962b95111a8c2803bba76c94b Mon Sep 17 00:00:00 2001 From: "doronr%us.ibm.com" Date: Mon, 10 Apr 2006 17:51:15 +0000 Subject: [PATCH] NPOTDB Bug 333006 - Schema validation doesn't handle default attribute types. r=allan/aaronr 181=me git-svn-id: svn://10.0.0.236/branches/MOZILLA_1_8_BRANCH@194013 18797224-902f-48f8-a5cc-f745e15eee43 --- .../schema-validation/src/nsSchemaValidator.cpp | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/mozilla/extensions/schema-validation/src/nsSchemaValidator.cpp b/mozilla/extensions/schema-validation/src/nsSchemaValidator.cpp index 7ac022342f8..16c5c54efe6 100644 --- a/mozilla/extensions/schema-validation/src/nsSchemaValidator.cpp +++ b/mozilla/extensions/schema-validation/src/nsSchemaValidator.cpp @@ -400,6 +400,8 @@ nsSchemaValidator::ValidateSimpletype(const nsAString & aNodeValue, nsISchemaSimpleType *aSchemaSimpleType, PRBool *aResult) { + NS_ENSURE_ARG(aSchemaSimpleType); + // get the simpletype type. PRUint16 simpleTypeValue; nsresult rv = aSchemaSimpleType->GetSimpleType(&simpleTypeValue); @@ -4349,7 +4351,15 @@ nsSchemaValidator::ValidateSchemaAttribute(nsIDOMNode* aNode, // since we default to invalid. LOG((" -- attribute prohibited!")); } else { - rv = ValidateSimpletype(attrValue, simpleType, &isValid); + if (simpleType) { + rv = ValidateSimpletype(attrValue, simpleType, &isValid); + } else { + // If no type exists (ergo no simpleType), we should use the + // simple ur-type definition defined at: + // (http://www.w3.org/TR/xmlschema-1/#simple-ur-type-itself). + // XXX: So for now, we default to true. + isValid = PR_TRUE; + } } }