[jdom-interest] Xerces Schema Validation Messages

Rich Robinson rich at boxuk.com
Thu Oct 17 09:31:56 PDT 2002


Hello

When validating an XML document against a schema using Xerces (as
described
in the FAQ section of the JDOM site) it produces messages like this for
invalid documents:

Error on line 2 of document : The content of element type "general" must
match
"(identifier?,title,(catalogentry,catalogentry?,catalogentry?,catalogent
ry?,
catalogentry?,catalogentry?,catalogentry?,catalogentry?,catalogentry?,ca
talo
gentry?),(language,language?,language?,language?,language?,language?,lan
guag
e?,language?,language?,language?),(description,description?,description?
,des
cription?,description?,description?,description?,description?,descriptio
n?,d
escription?),(keyword?,keyword?,keyword?,keyword?,keyword?,keyword?,keyw
ord?
,keyword?,keyword?,keyword?),(coverage?,coverage?,coverage?,coverage?,co
vera
ge?,coverage?,coverage?,coverage?,coverage?,coverage?),structure?,aggreg
atio
nlevel?,##other:uri=http://www.imsglobal.org/xsd/imsmd_v1p2*)".

Whilst it does make sense, the message is not particularly
user-friendly.  I am writing an application that requires the user's XML
documents to be validated against a schema - if they're not valid, my
application should tell the user why it is not.  Now the above message
does
do that, but most users will find it difficult to understand.

Is there any way of getting a more user-friendly message... something
like
"You are missing a <keyword> element" (or similar), or will I just have
to
take the above message and parse it myself?

Thanks very much for any help with this,

Rich.




More information about the jdom-interest mailing list