Project

Profile

Help

Bug #4287

closed

XSD validation errors should always display offending element names

Added by Jorge Williams over 4 years ago. Updated over 4 years ago.

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

0%

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

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

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

Updated by Jorge Williams over 4 years ago

Should read:

Here the element is described as

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

this isn't useful.

Actions #2

Updated by Michael Kay over 4 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.

Actions #3

Updated by Michael Kay over 4 years ago

  • Description updated (diff)
Actions #4

Updated by Michael Kay over 4 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)

Actions #5

Updated by Michael Kay over 4 years ago

  • Status changed from New to AwaitingInfo
Actions #6

Updated by Jorge Williams over 4 years ago

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

Actions #7

Updated by Michael Kay over 4 years ago

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

Actions #8

Updated by Jorge Williams over 4 years 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
Actions #9

Updated by Michael Kay over 4 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.

Actions #10

Updated by Michael Kay over 4 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.

Actions #11

Updated by Jorge Williams over 4 years ago

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

Please register to edit this issue

Also available in: Atom PDF