You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Yaakov Chaikin <ya...@gmail.com> on 2005/07/11 01:38:38 UTC

Capturing XML validation output

Hi,

Could someone point me in the right direction on the following...

I have these directories:

root
  project1
  project2
  project3
...

Each project contains XML file declared with a DTD, the DTD file, XML
file declared with a Schema, the Schema file.

What I would like to get ANT to do is to validate both XML files and
capture the output of any errors inside 2 files: dtdOutput.txt and
schemaOutput.txt. Each file should be placed alongside the
XML/DTD/Schema file(s), so the file with the output file of the set of
files would be in the same directory as those files.

Any direction on this would be appreciated.

Thanks,
Yaakov.

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


Re: Capturing XML validation output

Posted by Ivan Ivanov <ra...@yahoo.com>.
Yaakov,

You need to iterate over your directories and do the
validating operation for each of them. You may find
<for> task[1] useful (untested pseudo code):

<property name="fs" value="${file.separator}"/>
<for param="dir">
  <dirset dir="...">
    <include name="...">
  </dirset>
  <record action="start" name="@{dir}"/>
  <xmlvalidate file="@{dir}${fs}filename.xml">
    <dtd publicid location="@{dir}${fs}filename.dtd"/>
  </xmlvalidate>
  <record action="stop"/>
</for>

HTH Ivan
[1]http://ant-contrib.sourceforge.net/tasks/tasks/for.html

--- Yaakov Chaikin <ya...@gmail.com> wrote:

> Thanks to both of you for replying. However, how
> would I have each
> directory have its own dtdOutput.txt?
> 
> Thanks,
> Yaakov.
> 
> On 7/10/05, Kristian Perkins <kh...@bigpond.com>
> wrote:
> > I didn't think you could nest tasks inside
> <record>, in which case you might like to try
> something like this untested version:
> > 
> > <record name="dtdOutput.txt" action="start"/>
> > <xmlvalidate file="filename.xml">
> >  <dtd publicId="..." location="filename.dtd"/>
> > </xmlvalidate>
> > <record name="dtdOutput.txt" action="stop"/>
> > 
> > 
> > 
> > Ivan Ivanov wrote:
> > 
> > >Yaakov,
> > >
> > >I think that you can use <xmlvalidate>[1] task
> for
> > >validation of your xml files and <record> task to
> > >capture the output of the validation (untested
> but
> > >might give you an idea):
> > >
> > ><record name="dtdOutput.txt" action="start">
> > ><xmlvalidate file="filename.xml">
> > >  <dtd publicId="..." location="filename.dtd"/>
> > ></xmlvalidate>
> > ></record>
> > >
> > >HTH Ivan
> > >
> >
>
>[1]http://ant.apache.org/manual/OptionalTasks/xmlvalidate.html
> >
>
>[2]http://ant.apache.org/manual/CoreTasks/recorder.html
> > >
> > >--- Yaakov Chaikin <ya...@gmail.com>
> wrote:
> > >
> > >
> > >
> > >>Hi,
> > >>
> > >>Could someone point me in the right direction on
> the
> > >>following...
> > >>
> > >>I have these directories:
> > >>
> > >>root
> > >>  project1
> > >>  project2
> > >>  project3
> > >>...
> > >>
> > >>Each project contains XML file declared with a
> DTD,
> > >>the DTD file, XML
> > >>file declared with a Schema, the Schema file.
> > >>
> > >>What I would like to get ANT to do is to
> validate
> > >>both XML files and
> > >>capture the output of any errors inside 2 files:
> > >>dtdOutput.txt and
> > >>schemaOutput.txt. Each file should be placed
> > >>alongside the
> > >>XML/DTD/Schema file(s), so the file with the
> output
> > >>file of the set of
> > >>files would be in the same directory as those
> files.
> > >>
> > >>Any direction on this would be appreciated.
> > >>
> > >>Thanks,
> > >>Yaakov.
> > >>
> > >>
> > >>
> > >>
> >
>
>---------------------------------------------------------------------
> > >
> > >
> > >>To unsubscribe, e-mail:
> > >>user-unsubscribe@ant.apache.org
> > >>For additional commands, e-mail:
> > >>user-help@ant.apache.org
> > >>
> > >>
> > >>
> > >>
> > >
> > >
> >
> >__________________________________________________
> > >Do You Yahoo!?
> > >Tired of spam?  Yahoo! Mail has the best spam
> protection around
> > >http://mail.yahoo.com
> > >
> >
>
>---------------------------------------------------------------------
> > >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
> > 
> >
> 
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> user-unsubscribe@ant.apache.org
> For additional commands, e-mail:
> user-help@ant.apache.org
> 
> 



		
____________________________________________________
Sell on Yahoo! Auctions – no fees. Bid on great items.  
http://auctions.yahoo.com/

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


Re: Capturing XML validation output

Posted by Yaakov Chaikin <ya...@gmail.com>.
Thanks to both of you for replying. However, how would I have each
directory have its own dtdOutput.txt?

Thanks,
Yaakov.

On 7/10/05, Kristian Perkins <kh...@bigpond.com> wrote:
> I didn't think you could nest tasks inside <record>, in which case you might like to try something like this untested version:
> 
> <record name="dtdOutput.txt" action="start"/>
> <xmlvalidate file="filename.xml">
>  <dtd publicId="..." location="filename.dtd"/>
> </xmlvalidate>
> <record name="dtdOutput.txt" action="stop"/>
> 
> 
> 
> Ivan Ivanov wrote:
> 
> >Yaakov,
> >
> >I think that you can use <xmlvalidate>[1] task for
> >validation of your xml files and <record> task to
> >capture the output of the validation (untested but
> >might give you an idea):
> >
> ><record name="dtdOutput.txt" action="start">
> ><xmlvalidate file="filename.xml">
> >  <dtd publicId="..." location="filename.dtd"/>
> ></xmlvalidate>
> ></record>
> >
> >HTH Ivan
> >
> >[1]http://ant.apache.org/manual/OptionalTasks/xmlvalidate.html
> >[2]http://ant.apache.org/manual/CoreTasks/recorder.html
> >
> >--- Yaakov Chaikin <ya...@gmail.com> wrote:
> >
> >
> >
> >>Hi,
> >>
> >>Could someone point me in the right direction on the
> >>following...
> >>
> >>I have these directories:
> >>
> >>root
> >>  project1
> >>  project2
> >>  project3
> >>...
> >>
> >>Each project contains XML file declared with a DTD,
> >>the DTD file, XML
> >>file declared with a Schema, the Schema file.
> >>
> >>What I would like to get ANT to do is to validate
> >>both XML files and
> >>capture the output of any errors inside 2 files:
> >>dtdOutput.txt and
> >>schemaOutput.txt. Each file should be placed
> >>alongside the
> >>XML/DTD/Schema file(s), so the file with the output
> >>file of the set of
> >>files would be in the same directory as those files.
> >>
> >>Any direction on this would be appreciated.
> >>
> >>Thanks,
> >>Yaakov.
> >>
> >>
> >>
> >>
> >---------------------------------------------------------------------
> >
> >
> >>To unsubscribe, e-mail:
> >>user-unsubscribe@ant.apache.org
> >>For additional commands, e-mail:
> >>user-help@ant.apache.org
> >>
> >>
> >>
> >>
> >
> >
> >__________________________________________________
> >Do You Yahoo!?
> >Tired of spam?  Yahoo! Mail has the best spam protection around
> >http://mail.yahoo.com
> >
> >---------------------------------------------------------------------
> >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
> 
>

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


Re: Capturing XML validation output

Posted by Ivan Ivanov <ra...@yahoo.com>.
Kristian,

yes, you are right. <record> task does not allow task
nesting, of course. Your snippet is more close to
truth than mine. Thank you for noting the error.

Regards
Ivan

--- Kristian Perkins <kh...@bigpond.com> wrote:

> I didn't think you could nest tasks inside <record>,
> in which case you might like to try something like
> this untested version:
> 
> <record name="dtdOutput.txt" action="start"/>
> <xmlvalidate file="filename.xml">
>   <dtd publicId="..." location="filename.dtd"/>
> </xmlvalidate>
> <record name="dtdOutput.txt" action="stop"/>
> 
> 
> 
> Ivan Ivanov wrote:
> 
> >Yaakov,
> >
> >I think that you can use <xmlvalidate>[1] task for
> >validation of your xml files and <record> task to
> >capture the output of the validation (untested but
> >might give you an idea):
> >
> ><record name="dtdOutput.txt" action="start">
> ><xmlvalidate file="filename.xml">
> >  <dtd publicId="..." location="filename.dtd"/>
> ></xmlvalidate>
> ></record>
> >
> >HTH Ivan
> >
>
>[1]http://ant.apache.org/manual/OptionalTasks/xmlvalidate.html
>
>[2]http://ant.apache.org/manual/CoreTasks/recorder.html
> >
> >--- Yaakov Chaikin <ya...@gmail.com>
> wrote:
> >
> >  
> >
> >>Hi,
> >>
> >>Could someone point me in the right direction on
> the
> >>following...
> >>
> >>I have these directories:
> >>
> >>root
> >>  project1
> >>  project2
> >>  project3
> >>...
> >>
> >>Each project contains XML file declared with a
> DTD,
> >>the DTD file, XML
> >>file declared with a Schema, the Schema file.
> >>
> >>What I would like to get ANT to do is to validate
> >>both XML files and
> >>capture the output of any errors inside 2 files:
> >>dtdOutput.txt and
> >>schemaOutput.txt. Each file should be placed
> >>alongside the
> >>XML/DTD/Schema file(s), so the file with the
> output
> >>file of the set of
> >>files would be in the same directory as those
> files.
> >>
> >>Any direction on this would be appreciated.
> >>
> >>Thanks,
> >>Yaakov.
> >>
> >>
> >>    
> >>
>
>---------------------------------------------------------------------
> >  
> >
> >>To unsubscribe, e-mail:
> >>user-unsubscribe@ant.apache.org
> >>For additional commands, e-mail:
> >>user-help@ant.apache.org
> >>
> >>
> >>    
> >>
> >
> >
> >__________________________________________________
> >Do You Yahoo!?
> >Tired of spam?  Yahoo! Mail has the best spam
> protection around 
> >http://mail.yahoo.com 
> >
>
>---------------------------------------------------------------------
> >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
> 
> 


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

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


Re: Capturing XML validation output

Posted by Kristian Perkins <kh...@bigpond.com>.
I didn't think you could nest tasks inside <record>, in which case you might like to try something like this untested version:

<record name="dtdOutput.txt" action="start"/>
<xmlvalidate file="filename.xml">
  <dtd publicId="..." location="filename.dtd"/>
</xmlvalidate>
<record name="dtdOutput.txt" action="stop"/>



Ivan Ivanov wrote:

>Yaakov,
>
>I think that you can use <xmlvalidate>[1] task for
>validation of your xml files and <record> task to
>capture the output of the validation (untested but
>might give you an idea):
>
><record name="dtdOutput.txt" action="start">
><xmlvalidate file="filename.xml">
>  <dtd publicId="..." location="filename.dtd"/>
></xmlvalidate>
></record>
>
>HTH Ivan
>
>[1]http://ant.apache.org/manual/OptionalTasks/xmlvalidate.html
>[2]http://ant.apache.org/manual/CoreTasks/recorder.html
>
>--- Yaakov Chaikin <ya...@gmail.com> wrote:
>
>  
>
>>Hi,
>>
>>Could someone point me in the right direction on the
>>following...
>>
>>I have these directories:
>>
>>root
>>  project1
>>  project2
>>  project3
>>...
>>
>>Each project contains XML file declared with a DTD,
>>the DTD file, XML
>>file declared with a Schema, the Schema file.
>>
>>What I would like to get ANT to do is to validate
>>both XML files and
>>capture the output of any errors inside 2 files:
>>dtdOutput.txt and
>>schemaOutput.txt. Each file should be placed
>>alongside the
>>XML/DTD/Schema file(s), so the file with the output
>>file of the set of
>>files would be in the same directory as those files.
>>
>>Any direction on this would be appreciated.
>>
>>Thanks,
>>Yaakov.
>>
>>
>>    
>>
>---------------------------------------------------------------------
>  
>
>>To unsubscribe, e-mail:
>>user-unsubscribe@ant.apache.org
>>For additional commands, e-mail:
>>user-help@ant.apache.org
>>
>>
>>    
>>
>
>
>__________________________________________________
>Do You Yahoo!?
>Tired of spam?  Yahoo! Mail has the best spam protection around 
>http://mail.yahoo.com 
>
>---------------------------------------------------------------------
>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: Capturing XML validation output

Posted by Ivan Ivanov <ra...@yahoo.com>.
Yaakov,

I think that you can use <xmlvalidate>[1] task for
validation of your xml files and <record> task to
capture the output of the validation (untested but
might give you an idea):

<record name="dtdOutput.txt" action="start">
<xmlvalidate file="filename.xml">
  <dtd publicId="..." location="filename.dtd"/>
</xmlvalidate>
</record>

HTH Ivan

[1]http://ant.apache.org/manual/OptionalTasks/xmlvalidate.html
[2]http://ant.apache.org/manual/CoreTasks/recorder.html

--- Yaakov Chaikin <ya...@gmail.com> wrote:

> Hi,
> 
> Could someone point me in the right direction on the
> following...
> 
> I have these directories:
> 
> root
>   project1
>   project2
>   project3
> ...
> 
> Each project contains XML file declared with a DTD,
> the DTD file, XML
> file declared with a Schema, the Schema file.
> 
> What I would like to get ANT to do is to validate
> both XML files and
> capture the output of any errors inside 2 files:
> dtdOutput.txt and
> schemaOutput.txt. Each file should be placed
> alongside the
> XML/DTD/Schema file(s), so the file with the output
> file of the set of
> files would be in the same directory as those files.
> 
> Any direction on this would be appreciated.
> 
> Thanks,
> Yaakov.
> 
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> user-unsubscribe@ant.apache.org
> For additional commands, e-mail:
> user-help@ant.apache.org
> 
> 


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

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