If the only requirement is to check if the first line of the file is <?xml 
version = '1.0' encoding = 'UTF-8' ?> then I don't think you need to use 
xmltask. You can do something as follows
<loadfile srcfile="${src.file}" property="src.file.head"> <filterchain> 
<filterreader classname="org.apache.tools.ant.filters.HeadFilter"> <param 
name="lines" value="1"/> </filterreader> </filterchain>
</loadfile>
Theabove task will load the first line of a file into the property 
src.file.head. You can then check if it matches with '<?xml version = '1.0' 
encoding = 'UTF-8' ?>'


________________________________
From: Grüner Heinrich <gruener.heinr...@googlemail.com>
To: Ant Users List <user@ant.apache.org>
Sent: Tuesday, June 7, 2011 6:22 AM
Subject: Re: verifying encoding value using xmlvalidate task

Hi Dominic,
maybe you should check out the xmltask.
http://www.oopsconsultancy.com/software/xmltask/
I don't know exactly, but somehow it should be possible to extract the 
header and even manipulate it.


Regards,
Stefan.

Am 07.06.2011 15:04, schrieb dominic Tippabattuni:
> Hi Parag,
>
> My intent is to check the presence of encoding value in xml files.
>
> Thanks
> Dominic
>
> On Tue, Jun 7, 2011 at 12:07 AM, Parag Doke<parag.d...@gmail.com>  wrote:
>
>> Hi Dominic.
>> I'm no ant expert, but just trying to understand the requirement.
>> If you intent to check presence of encoding value in XML files ?
>> Or is your intent to validate the XML files using the encoding ?
>>
>> Thanks in advance,
>> Parag Doke
>> Save paper, save trees. Do not print emails/documents unless
>> absolutely necessary.
>>
>>
>>
>> On Mon, Jun 6, 2011 at 8:38 PM, dominic Tippabattuni
>> <dominics...@gmail.com>  wrote:
>>> Hi,
>>>
>>> I am working on a task which can verify xml encoding value. All xml files
>> in
>>> the project should be verified.
>>> It would be great if someone can point me in the right direction.
>>>
>>> The line in the xml file which needs to be verified is
>>> <?xml version = '1.0' encoding = 'UTF-8' ?>
>>>
>>> Thanks
>>> Nick
>>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscr...@ant.apache.org
>> For additional commands, e-mail: user-h...@ant.apache.org
>>
>>


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

Reply via email to