Hi
all,
I'm working on the
implementation of XPointer, and I'm puzzled with an "error" being reported by
XMLSchemaValidator.
With an included
document that intentionally has no schema, I get the following error
reported:
[Error] planets.xml:2:58: cvc-elt.1:
Cannot find the declaration of element 'PLANETS'.
The code in
XMLSchemaValidator where this is reported from has an interesting comment
...
// We don't call
reportSchemaError here, because the spec
// doesn't think it's invalid not to be able to find a
// declaration or type definition for an element. Xerces is
// reporting it as an error for historical reasons, but in
// PSVI, we shouldn't mark this element as invalid because
// of this. - SG
fXSIErrorReporter.fErrorReporter.reportError(
XSMessageFormatter.SCHEMA_DOMAIN,
"cvc-elt.1",
new Object[] { element.rawname },
XMLErrorReporter.SEVERITY_ERROR);
// doesn't think it's invalid not to be able to find a
// declaration or type definition for an element. Xerces is
// reporting it as an error for historical reasons, but in
// PSVI, we shouldn't mark this element as invalid because
// of this. - SG
fXSIErrorReporter.fErrorReporter.reportError(
XSMessageFormatter.SCHEMA_DOMAIN,
"cvc-elt.1",
new Object[] { element.rawname },
XMLErrorReporter.SEVERITY_ERROR);
What I would like is
for the included document to be automatically validated if it has actually has
a schema, but not if it doesn't. I would have expected that this is
what xerces would have done for me. The pre-existing code in
XIncludeHandler disables the scheme validation feature with the following
code
// we don't want a schema validator on the new pipeline,
// so we set it to false, regardless of what was copied above
fChildConfig.setFeature(
Constants.XERCES_FEATURE_PREFIX + Constants.SCHEMA_VALIDATION_FEATURE,
false);
// so we set it to false, regardless of what was copied above
fChildConfig.setFeature(
Constants.XERCES_FEATURE_PREFIX + Constants.SCHEMA_VALIDATION_FEATURE,
false);
But I need to modify
this to conditionally validate when there is an XPointer _expression_, since this
_expression_ may refer to schema-definied IDs. If I enable schema validation
but the included XML does not have a schema, then I get this "error"
reported. My understanding of XPointer is that not finding schema-defined
IDs is not an error: you just don't get any output.
I have code that
functions as I want to to, except that this "error" is reported.
I am
concerned that users of my code will see xerces reporting this
error.
Can someone shed
some light on the intent on this reported "error" please? I'm guessing
that I could just wrap the offending reportError() call with a guard condition,
perhaps ...
if (fDoValidation)
{
fXSIErrorReporter.fErrorReporter.reportError( ...
);
}
}
but I am cautious of
doing so without understanding the historical reasons.
Thanks in
advance
Dean
INTERGRAPH
Dean Chalker
Distinguished Design Engineer (R&D)
IntelliWhere Product Development Center
Dean Chalker
Distinguished Design Engineer (R&D)
IntelliWhere Product Development Center
Intergraph
Mapping and Geospatial Solutions
Level
3/299 Coronation Drive
Milton
Brisbane
Austalia
4064
Phone:
+61 (0)7 3510 8918
Fax: +61 (0)7 3510 8901
E-mail: [EMAIL PROTECTED]
URL: imgs.intergraph.com
Fax: +61 (0)7 3510 8901
E-mail: [EMAIL PROTECTED]
URL: imgs.intergraph.com
