Adrian Herscu wrote:

Hi all (especially Dion),

I have found a validation example here:
http://cvs.apache.org/viewcvs/jakarta-commons/jelly/jelly-tags/validate/src/test/org/apache/commons/jelly/tags/validate/suite.jelly?rev=HEAD

Based on that example I tried this:

 1 <validate:verifier
 2   var="verifier"
 3   uri="myschemapath/foo.xsd" />

 4 <core:catch var="exception">
 5   <validate:assertValid var="validFlag" verifier="${verifier}">
 6     <foo
 7       xsi:schemaLocation="foo_ns myschemapath/foo.xsd"
 8       xmlns="foo_ns"
 9       xmlns:base="base_ns"
10       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";>
11       <a>blah</a>
12       <base:a>trah</base:a>
13     </foo>
14   </validate:assertValid>
15 </core:catch>

16 <echo>Valid: ${validFlag}</echo>
17 <echo>Exception: ${exception}</echo>

My problems are:
=================
1) Line #7, although valid XML, triggers this exception:
<validate:assertValid> The XML is not valid according to the schema: error : line: -1 column: -1 message: unexpected attribute "xsi:schemaLocation"
After deleting line #7 the validation succeeds.

2) Because of the previous problem I cannot use <core:include>, to load that document. (Or, should I use something else?)

3) The foo.xsd schema imports a base.xsd schema. While using a standalone schema validator (like MS-XML) the import path is resolved relatively to myschemapath/. While using the above script, imports are resolved relatively to the program's launch path -- so the imported schemas are not found. After changing the paths of the imported schema to be relative to the launch path the validation succeeds.

Also checked with MSV like this:

E:\mylaunchpath>java -jar %MSV_HOME%\msv.jar -warning -strict myschemapath\foo.xsd foo_instance.xml

...and imported schemas are resolved relatively to myschemapath/ (not to the program launch path).


Please help!!!!!

...and thanks for your time,
Adrian.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to