You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Adrian Herscu <bm...@axentra.net> on 2005/05/17 23:12:33 UTC
File URI issue
Hi all,
I am using <ant:fileScanner> to validate all XML files in a
given directory ${src.dir}.
<ant:fileScanner var="xmlFiles">
<!-- assume all files in src.dir are XML files -->
<ant:fileset dir="${src.dir}" />
</ant:fileScanner>
<core:forEach var="xmlFilePath" items="${xmlFiles.iterator()}">
<echo>Validating ${xmlFilePath}</echo>
<validate:validate
var="validationResult"
verifier="${someVerifier}">
<!-- this line does not work* -->
<core:include uri="${xmlFilePath}" />
<!-- this line works (?) -->
<core:include uri="file:///${xmlFilePath}" />
</validate:validate>
<echo>Validation result: ${validationResult}</echo>
</core:forEach>
* The error message is:
BUILD FAILED
File...... E:\Documents\bmf1972\My Tests\core\maven.xml
Element... core:include
Line...... 99
Column.... 39
null:-1:-1: <null> Could not parse Jelly script
My question is about the consistency of the file references. If
some function returns file references in DOS format (e.g.
D:\path\filename.ext) then why other functions cannot accept this?
Is there some function that can be used to "normalize" file
references?
Thanks for your time,
Adrian.
P.S. Also, from the error message is clear that the file
reference format is the problem...
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org
Re: File URI issue
Posted by Adrian Herscu <bm...@axentra.net>.
Thank for your reply Kenney.
I did not formulate my question right.
The problem is that <core:include> cannot accept a file
reference formatted as a DOS path (e.g. E:\path\file.ext), while
this is the format returned by the fileScanner iterator.
So, in order to use the returned file reference I must prepend
"file:///" (i.e. "file:///E:\path\file.ext" works).
My concern is that leads to platform dependence - that is why I
asked for a "normalization" function (i.e. something that I can
pass it a platform-specific file reference format and receive a
platform-independent file reference format).
Adrian.
P.S. The core:included file is not a Jelly script - it uses a
different XML namespace. Besides, if that was the problem, as
the error message erroneously suggest, then it should work while
referenced through the file:// protocol.
Kenney Westerhof wrote:
> On Wed, 18 May 2005, Adrian Herscu wrote:
>
> Hi there,
>
> Below is the answer to your questions and an answer to your problem
> (no, they are not the same ;))
>
>
>>Hi all,
>>
>>I am using <ant:fileScanner> to validate all XML files in a
>>given directory ${src.dir}.
>>
>> <core:include uri="${xmlFilePath}" />
>>
>> <!-- this line works (?) -->
>> <core:include uri="file:///${xmlFilePath}" />
>>BUILD FAILED
>>File...... E:\Documents\bmf1972\My Tests\core\maven.xml
>>Element... core:include
>>Line...... 99
>>Column.... 39
>>null:-1:-1: <null> Could not parse Jelly script
>>
>>My question is about the consistency of the file references. If
>>some function returns file references in DOS format (e.g.
>>D:\path\filename.ext) then why other functions cannot accept this?
>
>
> They can. file://D:\path\filename.ext should work in Windows.
>
>
>>Is there some function that can be used to "normalize" file
>>references?
>
>
> Probably, but that's not relevant here :)
>
> core:include includes the referenced file in the current jelly script,
> and after the include, jelly tries to evaluate it. It works like
> a XInclude, and the parse error you get is from the included file not
> being a correct jelly script.
>
> So you might want to validate your xml files differently.
>
> Greetings,
>
> Kenney Westerhof
>
>
>>Thanks for your time,
>>Adrian.
>>
>>P.S. Also, from the error message is clear that the file
>>reference format is the problem...
>>
>>
>>---------------------------------------------------------------------
>>To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
>>For additional commands, e-mail: users-help@maven.apache.org
>>
>
>
> --
> Kenney Westerhof
> http://www.neonics.com
> GPG public key: http://www.gods.nl/~forge/kenneyw.key
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org
Re: File URI issue
Posted by Kenney Westerhof <fo...@neonics.com>.
On Wed, 18 May 2005, Adrian Herscu wrote:
Hi there,
Below is the answer to your questions and an answer to your problem
(no, they are not the same ;))
> Hi all,
>
> I am using <ant:fileScanner> to validate all XML files in a
> given directory ${src.dir}.
>
> <core:include uri="${xmlFilePath}" />
>
> <!-- this line works (?) -->
> <core:include uri="file:///${xmlFilePath}" />
> BUILD FAILED
> File...... E:\Documents\bmf1972\My Tests\core\maven.xml
> Element... core:include
> Line...... 99
> Column.... 39
> null:-1:-1: <null> Could not parse Jelly script
>
> My question is about the consistency of the file references. If
> some function returns file references in DOS format (e.g.
> D:\path\filename.ext) then why other functions cannot accept this?
They can. file://D:\path\filename.ext should work in Windows.
> Is there some function that can be used to "normalize" file
> references?
Probably, but that's not relevant here :)
core:include includes the referenced file in the current jelly script,
and after the include, jelly tries to evaluate it. It works like
a XInclude, and the parse error you get is from the included file not
being a correct jelly script.
So you might want to validate your xml files differently.
Greetings,
Kenney Westerhof
>
> Thanks for your time,
> Adrian.
>
> P.S. Also, from the error message is clear that the file
> reference format is the problem...
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
--
Kenney Westerhof
http://www.neonics.com
GPG public key: http://www.gods.nl/~forge/kenneyw.key
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org