[XForms] Too many schema-validation errors. Bug 332960, r=doronr+smaug

This commit is contained in:
allan%beaufour.dk 2006-04-07 09:04:49 +00:00
Родитель 3a030d4ed8
Коммит e4987193ee
2 изменённых файлов: 11 добавлений и 20 удалений

Просмотреть файл

@ -1549,8 +1549,6 @@ nsXFormsModelElement::ValidateDocument(nsIDOMDocument *aInstanceDocument,
nsresult rv = aInstanceDocument->GetDocumentElement(getter_AddRefs(element));
NS_ENSURE_SUCCESS(rv, rv);
PRBool isValid = PR_FALSE;
// get namespace from node
nsAutoString nsuri;
element->GetNamespaceURI(nsuri);
@ -1560,25 +1558,19 @@ nsXFormsModelElement::ValidateDocument(nsIDOMDocument *aInstanceDocument,
nsCOMPtr<nsISchema> schema;
schemaColl->GetSchema(nsuri, getter_AddRefs(schema));
if (schema) {
if (!schema) {
// No schema found, so nothing to validate
*aResult = PR_TRUE;
return NS_OK;
}
nsXFormsSchemaValidator validator;
validator.LoadSchema(schema);
// Validate will validate the node and its subtree, as per the schema
// specification.
isValid = validator.Validate(element);
} else {
// no schema found for the instance document's namespace.
nsCOMPtr<nsIDOMNode> instanceElement;
nsXFormsUtils::GetInstanceNodeForData(element,
getter_AddRefs(instanceElement));
const PRUnichar *strings[] = { nsuri.get() };
nsXFormsUtils::ReportError(NS_LITERAL_STRING("noSchemaForInstance"),
strings, 1, instanceElement, nsnull);
rv = NS_ERROR_UNEXPECTED;
}
*aResult = validator.Validate(element);
*aResult = isValid;
return rv;
return NS_OK;
}
/*

Просмотреть файл

@ -71,7 +71,6 @@ externalLinkLoadOrigin = XForms Error (32): Security check failed! Trying to loa
instanceNotFound = XForms Error (33): Could not find instance with id == '%S'
defInstanceNotFound = XForms Error (34): Could not find default instance
MDGLoopError = XForms Error (35): There are loops in the bindings of the model!
noSchemaForInstance = XForms Error (36): Could not find a schema for validating the instance document (namespace=%S)
# Warning Messages:
warnSOAP = XForms Warning (1): You are using the SOAP post feature, which is an experimental feature! Beware that the functionality might change, and forms may stop working at any time.