Project

Profile

Help

Bug #4287

XSD validation errors should always display offending element names

Added by Jorge Williams 29 days ago. Updated 15 days ago.

Status:
Closed
Priority:
Low
Assignee:
Category:
Diagnostics
Sprint/Milestone:
-
Start date:
2019-08-19
Due date:
% Done:

0%

Legacy ID:
Applies to branch:
9.9
Fix Committed on Branch:
Fixed in Maintenance Release:

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.

sample.zip (30.4 KB) Jorge Williams, 2019-08-30 20:36 sample.zip

History

#1 Updated by Jorge Williams 29 days ago

Should read:

Here the element is described as

<Q{http://docbook.org/ns/docboo...>

this isn't useful.

#2 Updated by Michael Kay 28 days 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.

#3 Updated by Michael Kay 19 days ago

  • Description updated (diff)

#4 Updated by Michael Kay 19 days 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)

#5 Updated by Michael Kay 19 days ago

  • Status changed from New to AwaitingInfo

#6 Updated by Jorge Williams 19 days ago

Sure, what's the best way to get you an example privately?

#7 Updated by Michael Kay 19 days ago

You're welcome to send it to support (at) saxonica.com

#8 Updated by Jorge Williams 18 days ago

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

#9 Updated by Michael Kay 17 days 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.

#10 Updated by Michael Kay 17 days 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.

#11 Updated by Jorge Williams 15 days ago

Thank you. We'll update before reporting an issue next time!

Please register to edit this issue

Also available in: Atom PDF