You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Mario Madunic <ha...@imag.net> on 2007/10/09 00:55:08 UTC

How to move invalid XML files to another folder

Hi,

I'm using the following to validate thousands of XML files and want to move off
any that are invalid to another folder for further parsing or update XSLT.

<schemavalidate noNamespaceFile="../articleObject.xsd" failonerror="false">
  <fileset dir="${l_Drive}XML/finished" includes="Article-*.xml"/>
</schemavalidate>

Any help will be appreciated.

Thanks

Marijan (Mario) Madunic


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


Re: How to move invalid XML files to another folder

Posted by Steve Loughran <st...@apache.org>.
Mario Madunic wrote:
> Steve,
> 
> Thanks for insight.
> 
> That is too bad. Writing a new resource is beyond my talents at the moment (I'm
> a taker not a giver at the moment).
> 
> Just a thought. Would it be easier to change the fail task to allow more than a
> message (don't really know if it does more than this) and then allow fail to be
> a child of all tasks (where warranted)?
> 

<fail> is conditional; you can stick some condition inside it, and you 
can use the return value from a property as part of a test.  Do you need 
more than that?

-- 
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


Re: How to move invalid XML files to another folder

Posted by Mario Madunic <ha...@imag.net>.
Steve,

Thanks for insight.

That is too bad. Writing a new resource is beyond my talents at the moment (I'm
a taker not a giver at the moment).

Just a thought. Would it be easier to change the fail task to allow more than a
message (don't really know if it does more than this) and then allow fail to be
a child of all tasks (where warranted)?

Marijan (Mario) Madunic

Quoting Steve Loughran <st...@apache.org>:

> Mario Madunic wrote:
> > Hi,
> > 
> > I'm using the following to validate thousands of XML files and want to move
> off
> > any that are invalid to another folder for further parsing or update XSLT.
> > 
> > <schemavalidate noNamespaceFile="../articleObject.xsd"
> failonerror="false">
> >   <fileset dir="${l_Drive}XML/finished" includes="Article-*.xml"/>
> > </schemavalidate>
> > 
> > Any help will be appreciated.
> > 
> > Thanks
> > 
> > Marijan (Mario) Madunic
> > 
> > 
> 
> There's nothing like that, I'm afraid. The use case was "make sure all 
> the XML in a project is valid, halt if one fails".
> 
> I'm trying to think how you'd do it other ways. You could always write a 
> new resource <validxml> and <invalidxml> that would combine a fileset 
> with the validation, but you'd get deep in to ant coding that 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
> 
> 



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


Re: How to move invalid XML files to another folder

Posted by Steve Loughran <st...@apache.org>.
Mario Madunic wrote:
> Hi,
> 
> I'm using the following to validate thousands of XML files and want to move off
> any that are invalid to another folder for further parsing or update XSLT.
> 
> <schemavalidate noNamespaceFile="../articleObject.xsd" failonerror="false">
>   <fileset dir="${l_Drive}XML/finished" includes="Article-*.xml"/>
> </schemavalidate>
> 
> Any help will be appreciated.
> 
> Thanks
> 
> Marijan (Mario) Madunic
> 
> 

There's nothing like that, I'm afraid. The use case was "make sure all 
the XML in a project is valid, halt if one fails".

I'm trying to think how you'd do it other ways. You could always write a 
new resource <validxml> and <invalidxml> that would combine a fileset 
with the validation, but you'd get deep in to ant coding that 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