From: Ron V. d. B. <ron...@ka...> - 2007-10-04 13:08:31
|
Hi, In general, the validation:validate-report() function is working great, but I'm confused about the coordinates (line and column numbers) of the errors reported. Given a document <TEI xmlns="http://www.tei-c.org/ns/1.0"> <p>this is a paragraph with <div>a <choice>div</choice></div></p> </TEI> stored at '/db/test/test.xml' and a teilite.xsd schema stored at '/db/test/teixlite.xsd'. I get different results when issuing following commands in the Java client (latest SVN trunk): * XQuery 1: let $query := document('/db/TBE/test.xml') return validation:validate-report($query, xs:anyURI('/db/TBE/schema/teilite.xsd')) RESULT 1: <report> <status>invalid</status> <namespace>http://www.tei-c.org/ns/1.0</namespace> <time>15</time> <message level="Error" line="1" column="45">cvc-complex-type.2.4.a: Invalid content was found starting with element 'p'. One of '{teiHeader}' is expected.</message> <message level="Error" line="1" column="75">cvc-complex-type.2.4.a: Invalid content was found starting with element 'div'. One of '{seg, s, hi, foreign, emph, mentioned, soCalled, gloss, term, title, code, ident, eg, graphic, formula, choice, abbr, expan, sic, corr, reg, orig, add, del, unclear, ptr, ref, att, gi, val, date, time, num, measureGrp, address, name, rs, bibl, biblFull, desc, label, list, listBibl, stage, quote, cit, said, q, table, figure, index, interp, interpGrp, milestone, pb, lb, note, gap, anchor}' is expected.</message> <message level="Error" line="1" column="85">cvc-complex-type.2.4.a: Invalid content was found starting with element 'choice'. One of '{byline, dateline, argument, epigraph, docAuthor, docDate, head, opener, salute, index, interp, interpGrp, milestone, pb, lb, note, gap, anchor, div, divGen, p, l, lg, sp, bibl, biblFull, desc, label, list, listBibl, stage, quote, cit, said, q, table, figure, eg}' is expected.</message> <message level="Error" line="1" column="97">cvc-complex-type.2.3: Element 'choice' cannot have character [children], because the type's content type is element-only.</message> <message level="Error" line="1" column="103">cvc-complex-type.2.3: Element 'div' cannot have character [children], because the type's content type is element-only.</message> </report> * XQuery 2: validation:validate-report(xs:anyURI('/db/TBE/test.xml'), xs:anyURI('/db/TBE/schema/teilite.xsd')) RESULT 2: <report> <status>invalid</status> <namespace>http://www.tei-c.org/ns/1.0</namespace> <time>15</time> <message level="Error" line="2" column="8">cvc-complex-type.2.4.a: Invalid content was found starting with element 'p'. One of '{teiHeader}' is expected.</message> <message level="Error" line="2" column="38">cvc-complex-type.2.4.a: Invalid content was found starting with element 'div'. One of '{seg, s, hi, foreign, emph, mentioned, soCalled, gloss, term, title, code, ident, eg, graphic, formula, choice, abbr, expan, sic, corr, reg, orig, add, del, unclear, ptr, ref, att, gi, val, date, time, num, measureGrp, address, name, rs, bibl, biblFull, desc, label, list, listBibl, stage, quote, cit, said, q, table, figure, index, interp, interpGrp, milestone, pb, lb, note, gap, anchor}' is expected.</message> <message level="Error" line="2" column="48">cvc-complex-type.2.4.a: Invalid content was found starting with element 'choice'. One of '{byline, dateline, argument, epigraph, docAuthor, docDate, head, opener, salute, index, interp, interpGrp, milestone, pb, lb, note, gap, anchor, div, divGen, p, l, lg, sp, bibl, biblFull, desc, label, list, listBibl, stage, quote, cit, said, q, table, figure, eg}' is expected.</message> <message level="Error" line="2" column="60">cvc-complex-type.2.3: Element 'choice' cannot have character [children], because the type's content type is element-only.</message> <message level="Error" line="3" column="15">cvc-complex-type.2.3: Element 'div' cannot have character [children], because the type's content type is element-only.</message> </report> Notice the difference in line and column numbering. The error coordinates for the first XQuery are consistent, but particularly for the second XQuery there seems to be no logic in the imprecision. Any clarifications / suggestions? I know the lexical form of an XML document is trivial, but in this case it seems to matter, for I'm trying to build a validation service that renders a visual representation of the validation results. Thanks for any help or insight, Ron |