You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@maven.apache.org by Nascif Abousalh-Neto <Na...@sas.com> on 2006/01/30 17:09:40 UTC
Help: Removing DTD definition from file
Hi,
I am trying to port the DTD removal code from an XML file (coverage.xml from the Cobertura code coverage tool) so that it can be parsed by a different plugin.
The file goes like that:
<?xml version="1.0"?>
<!DOCTYPE coverage SYSTEM "http://cobertura.sourceforge.net/xml/coverage-02.dtd">
<coverage line-rate="0.2648281714043275" branch-rate="0.3147208121827411" version="1.7" timestamp="1138631282402">
<sources>
<source>C:/home/playpen/ips/Products/InventoryReplenishmentPlanning/IrpClient/Source/Java</source>
When this file is parsed, even by a SAX parser, the second line causes an HTTP request which fails when the machine is behind a corporate firewall. Somehow Maven configuration for proxies does not affect this file (I would call that a bug...)
I have seen it done in the snapshot plugin using code like this:
<u:loadText file="${maven.dashboard.aggregator.coberturalipc.artifact}" var="artifactAsText" />
<j:set var="fileWithoutDTD" value="${stringUtils.replace(artifactAsText, '<!DOCTYPE coverage SYSTEM "http://cobertura.sourceforge.net/xml/coverage-02.dtd">', '')}"/>
<x:parse var="doc" text="${fileWithoutDTD}"/>
But for the plugin I am working with, the input has to come from a file - the parsing is done in a Java library, not by Jelly. So instead of calling "x:parse", I want to save the contents to a file, and then pass the file name to the library.
How can I do that? I thought it would be simple but nothing I tried works. It seems that "fileWithoutDTD" is actually empty, I can't pipe it to a file using "echo" or "file". I just need to store the contents of a Jelly variable in a file - no translations, just saving it.
Any help would be greatly appreciated.
Thanks,
Nascif
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org
Re: Help: Removing DTD definition from file
Posted by Lukas Theussl <lt...@apache.org>.
Have a look at the file tag of the jelly core library:
http://jakarta.apache.org/commons/jelly/tags.html
There are lots of examples of its use in the maven plugins.
-Lukas
Nascif Abousalh-Neto wrote:
> Hi,
>
> I am trying to port the DTD removal code from an XML file (coverage.xml from the Cobertura code coverage tool) so that it can be parsed by a different plugin.
>
> The file goes like that:
>
> <?xml version="1.0"?>
> <!DOCTYPE coverage SYSTEM "http://cobertura.sourceforge.net/xml/coverage-02.dtd">
>
> <coverage line-rate="0.2648281714043275" branch-rate="0.3147208121827411" version="1.7" timestamp="1138631282402">
> <sources>
> <source>C:/home/playpen/ips/Products/InventoryReplenishmentPlanning/IrpClient/Source/Java</source>
>
> When this file is parsed, even by a SAX parser, the second line causes an HTTP request which fails when the machine is behind a corporate firewall. Somehow Maven configuration for proxies does not affect this file (I would call that a bug...)
>
> I have seen it done in the snapshot plugin using code like this:
>
> <u:loadText file="${maven.dashboard.aggregator.coberturalipc.artifact}" var="artifactAsText" />
> <j:set var="fileWithoutDTD" value="${stringUtils.replace(artifactAsText, '<!DOCTYPE coverage SYSTEM "http://cobertura.sourceforge.net/xml/coverage-02.dtd">', '')}"/>
> <x:parse var="doc" text="${fileWithoutDTD}"/>
>
> But for the plugin I am working with, the input has to come from a file - the parsing is done in a Java library, not by Jelly. So instead of calling "x:parse", I want to save the contents to a file, and then pass the file name to the library.
>
> How can I do that? I thought it would be simple but nothing I tried works. It seems that "fileWithoutDTD" is actually empty, I can't pipe it to a file using "echo" or "file". I just need to store the contents of a Jelly variable in a file - no translations, just saving it.
>
> Any help would be greatly appreciated.
>
> Thanks,
> Nascif
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
> For additional commands, e-mail: dev-help@maven.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org