commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Adrian Herscu <bmf1...@axentra.net>
Subject Re: [jelly] Still have schema validation problems
Date Mon, 18 Jul 2005 18:28:33 GMT
Thanks for your reply, Paul.
Moving the xsi namespace declaration will not help me -- I need to load 
those XML documents and validate them at build time.

I tried to use the parse tag:
<jxml:parse var="classDocument" xml="${classFileURL}" />
<core:set var="validFlag" value="${classVerifier.verify(classDocument)}" />

this provides an workaround for the xsi problem.

Still, this does not solve problem #3 -- the schema import path is 
resolved relatively to the program launch path :-(

Thanks for your help,
Adrian.


Paul Libbrecht wrote:
> Adrian,
> 
> I have a quick fix: move the namespace declaration of xsi somewhat 
> above. (e.g. at the jelly element).
> (note that outputting such attributes, however, needs the patch of Diogo 
> at JELLY-213).
> 
> This made me, however realize that the following, simpler script yields 
> the same exception and shows that there's something malfunctioning in 
> static tags having attributes in a non-empty namespace which explains 
> some of your issues:
>  <j:jelly xmlns:j="jelly:core">
>   <foo xmlns:xx="lolo" xx:att2="lala"/>
>  </j:jelly>
> I filed this as JELLY-214.
> Tell us, however, if the quick fix works for you.
> 
> thanks
> 
> paul
> 
> 
> 
> 
> Le 15 juil. 05, à 15:51, Adrian Herscu a écrit :
> 
>>>  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.
> 
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org


Mime
View raw message