Bug #4287
closedXSD validation errors should always display offending element names
0%
Description
We are getting validation errors like this:
One validation error was reported: In content of element <desc>: The content model does not allow element <Q{http://docbook.org/ns/docboo...> to appear as the first child. The following elements would be valid here, all in namespace http://docbook.org/ns/docbook: biblioref, para, constraintdef, errortext, glosslist, superscript, classname, literallayout, email, guisubmenu, and 139 others (or nothing).
Here the element name is described as <Q{http://docbook.org/ns/docboo...>
this isn't useful.
Files
Updated by Jorge Williams over 5 years ago
Should read:
Here the element is described as
<Q{http://docbook.org/ns/docboo...>
this isn't useful.
Updated by Michael Kay over 5 years ago
Thanks for reporting it. Fixing this instance will be very simple; a more general tidy-up might take a little longer. I think we probably shouldn't truncate element and attribute names in validation messages, the only thing we should truncate are long text node values.
Updated by Michael Kay about 5 years ago
I am not able to reproduce this. The message I get takes the form:
Validation error on line 2 column 14 of test.xml:
FORG0001: In content of element <Order>: The content model does not allow element
<Q{.../fruit}Bananas> to appear as the first child. Expected <Q{.../fruit}OrderNo>.
where Q{.../fruit}
abbreviates the URI to the part after the last "/" (unless it ends in "/").
Could you supply a repro please (and check carefully which Saxon version you are using -- run Validate with the -t option)
Updated by Michael Kay about 5 years ago
- Status changed from New to AwaitingInfo
Updated by Jorge Williams about 5 years ago
Sure, what's the best way to get you an example privately?
Updated by Michael Kay about 5 years ago
You're welcome to send it to support (at) saxonica.com
Updated by Jorge Williams about 5 years ago
- File sample.zip sample.zip added
Actually, I was able to isolate the problem with a simple example we can discuss openly. See attached:
I ran like this:
java com.saxonica.Validate -t -xsdversion:1.1 -xsd:xsd/i.xsd sample.xml
Saxon-EE 9.9.1.1J from Saxonica
Java version 1.8.0_212
Using license serial number S007617
Loading schema document file:/Users/jorgew/Documents/sample/xsd/i.xsd
URIResolver.resolve href="db.xsd" base="file:/Users/jorgew/Documents/sample/xsd/i.xsd"
Loading schema document file:/Users/jorgew/Documents/sample/xsd/db.xsd
URIResolver.resolve href="docbook.xsd" base="file:/Users/jorgew/Documents/sample/xsd/db.xsd"
Loading schema document file:/Users/jorgew/Documents/sample/xsd/docbook.xsd
Fetching Saxon copy of w3c/xlink/xlink.xsd
Loading schema document classpath:w3c/xlink/xlink.xsd
URIResolver.resolve href="http://www.w3.org/2001/xml.xsd" base="classpath:w3c/xlink/xlink.xsd"
Finished loading schema document classpath:w3c/xlink/xlink.xsd
Warning at xs:import on line 4 column 89 of docbook.xsd:
The schema document at xml.xsd is not being read because schema components for this
namespace are already available
Finished loading schema document file:/Users/jorgew/Documents/sample/xsd/docbook.xsd
Finished loading schema document file:/Users/jorgew/Documents/sample/xsd/db.xsd
Finished loading schema document file:/Users/jorgew/Documents/sample/xsd/i.xsd
Schema checking successful. Time: 1463ms. Memory: 123Mb.
Using parser com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser
Processing file:/Users/jorgew/Documents/sample/sample.xml
Validation error on line 4 column 16 of sample.xml:
FORG0001: In content of element <desc>: The content model does not allow element
<Q{http://docbook.org/ns/docboo...> to appear as the first child. The following elements
would be valid here, all in namespace http://docbook.org/ns/docbook: para, biblioref,
constraintdef, errortext, glosslist, superscript, literallayout, classname, email,
guisubmenu, and 139 others (or nothing).
See http://www.w3.org/TR/xmlschema-1/#cvc-complex-type clause 2.4
Validation error on line 5 column 8 of sample.xml:
FORG0001: One validation error was reported: In content of element <desc>: The content
model does not allow element <Q{http://docbook.org/ns/docboo...> to appear as the first
child. The following elements would be valid here, all in namespace
http://docbook.org/ns/docbook: para, biblioref, constraintdef, errortext, glosslist,
superscript, literallayout, classname, email, guisubmenu, and 139 others (or nothing).
Validation complete: errors found
Updated by Michael Kay about 5 years ago
With 9.9.1.4 the message is
FORG0001: In content of element <desc>: The content model does not allow element
<Q{.../docbook}tbody> to appear as the first child. The following elements would be valid
here, all in namespace http://docbook.org/ns/docbook: para, biblioref, constraintdef,
errortext, glosslist, superscript, literallayout, classname, email, guisubmenu, and 139
others (or nothing).
So I think this has been fixed somewhere along the line.
Updated by Michael Kay about 5 years ago
- Category set to Diagnostics
- Status changed from AwaitingInfo to Closed
- Assignee set to Michael Kay
It seems this was fixed while working on bug #4214, though it's not actually mentioned in the tracker for that bug. Closing with no action.
Updated by Jorge Williams about 5 years ago
Thank you. We'll update before reporting an issue next time!
Please register to edit this issue