You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Steve Loughran <st...@apache.org> on 2007/09/03 13:06:43 UTC

Re: Validating XML with W3C schema and OASIS xmlcatalogs

Kale54 wrote:
> Hi all,
> 
>  in a xmlvalidate-task using a xmlcatalog nested step, I try this:
>      ...
>      <schema namespace="http://schemas.xmlsoap.org/soap/envelope/ 
> file="${schemasRoot}\envelope.xsd"/>
>      ...
> 
> and in my xmlcatalog i wrote:
>      ...
>      <uri name="http://schemas.xmlsoap.org/soap/envelope/" 
> uri="file://c:/mydir/envelope.xsd" /> (I want catalog overrides previous 
> specification)
>      ...
> but the resolver in Apache xml-resolver only take the file in 
> schemasRoot directory! (not that I want).
> It seems the catalog entries are never matched.
> (the log reports:
> 
> 
> 
>     ...
>     resolveEntity:         
> 'null':file:/D:/TestsRoot/resources/Schemas/envelope.xsd'
>     Class org.apache.tools.ant.types.resolver.ApacheCatalogResolver     
> loaded from parent loader (parentFirst)
>     Apache resolver library found, xml-commons resolver will be used
>     Using catalogpath 
> 'D:\CanooWebTest_R2.5_B1584\JobScripts\XML_Catalog_Locale_1.xml'
>     Parsing     
> D:\CanooWebTest_R2.5_B1584\JobScripts\XML_Catalog_Locale_1.xml
>     No matching catalog entry found, parser will use: 
> 'file:/D:/TestsRoot/resources/Schemas/envelope.xsd'
>     ...
> 
> 
> Can anyone give me any suggestion? Please, Im very stuck!
> Thanks in advance.
> 

I've used <schemavalidate> to validate big things; it is why we added 
it, but not with xmlcatalog


     <presetdef name="validate-xsd">
       <schemavalidate>
         <schema namespace="http://www.w3.org/2001/XMLSchema"
                 file="${soap.dir}/XMLSchema.xsd"/>
         <schema namespace="http://www.w3.org/XML/1998/namespace"
                 file="${soap.dir}/xml.xsd"/>
         <dtd publicId="http://www.w3.org/2001/datatypes.dtd"
              location="${soap.dir}/datatypes.dtd"/>
       </schemavalidate>
     </presetdef>

     <!-- Validate SOAP declarations  on ant.17+ -->
     <presetdef name="validate-soap">
       <validate-xsd>
         <schema namespace="http://www.w3.org/2003/05/soap-envelope"
                 file="${soap12.xsd}"/>
         <schema namespace="http://schemas.xmlsoap.org/wsdl/"
                 file="${soap.dir}/wsdl.xsd"/>
         <schema namespace="http://schemas.xmlsoap.org/wsdl/soap/"
                 file="${soap.dir}/wsdlsoap.xsd"/>
       </validate-xsd>
     </presetdef>

try it this way

-- 
Steve Loughran                  http://www.1060.org/blogxter/publish/5
Author: Ant in Action           http://antbook.org/

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