зеркало из https://github.com/mozilla/gecko-dev.git
[XForms] Too many schema-validation errors. Bug 332960, r=doronr+smaug
This commit is contained in:
Родитель
3a030d4ed8
Коммит
e4987193ee
|
@ -1549,8 +1549,6 @@ nsXFormsModelElement::ValidateDocument(nsIDOMDocument *aInstanceDocument,
|
||||||
nsresult rv = aInstanceDocument->GetDocumentElement(getter_AddRefs(element));
|
nsresult rv = aInstanceDocument->GetDocumentElement(getter_AddRefs(element));
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
|
|
||||||
PRBool isValid = PR_FALSE;
|
|
||||||
|
|
||||||
// get namespace from node
|
// get namespace from node
|
||||||
nsAutoString nsuri;
|
nsAutoString nsuri;
|
||||||
element->GetNamespaceURI(nsuri);
|
element->GetNamespaceURI(nsuri);
|
||||||
|
@ -1560,25 +1558,19 @@ nsXFormsModelElement::ValidateDocument(nsIDOMDocument *aInstanceDocument,
|
||||||
|
|
||||||
nsCOMPtr<nsISchema> schema;
|
nsCOMPtr<nsISchema> schema;
|
||||||
schemaColl->GetSchema(nsuri, getter_AddRefs(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;
|
nsXFormsSchemaValidator validator;
|
||||||
validator.LoadSchema(schema);
|
validator.LoadSchema(schema);
|
||||||
// Validate will validate the node and its subtree, as per the schema
|
// Validate will validate the node and its subtree, as per the schema
|
||||||
// specification.
|
// specification.
|
||||||
isValid = validator.Validate(element);
|
*aResult = 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 = isValid;
|
return NS_OK;
|
||||||
return rv;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -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'
|
instanceNotFound = XForms Error (33): Could not find instance with id == '%S'
|
||||||
defInstanceNotFound = XForms Error (34): Could not find default instance
|
defInstanceNotFound = XForms Error (34): Could not find default instance
|
||||||
MDGLoopError = XForms Error (35): There are loops in the bindings of the model!
|
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:
|
# 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.
|
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.
|
||||||
|
|
Загрузка…
Ссылка в новой задаче