Using jelly:xml tags:
<j:file name="${maven.ear.appxml}"
outputMode="xml"
prettyPrint="true"
encoding="UTF-8"
var="bla"
>
<x:doctype
name="application"
publicId="-//Sun Microsystems, Inc.//DTD J2EE Application 1.3//"
systemId="http://java.sun.com/dtd/application_1_3.dtd"
/>
<x:element name="application">
<display-name>${pom.artifactId}</display-name>
<j:forEach var="dep" items="${pom.dependencies}">
<j:choose>
<j:when
test="${dep.getProperty('ear.bundle.war')=='true'}">
<j:set var="warName" value="${dep.getJar()}"
trim="true"/>
<x:element name="module">
<x:element name="web">
<x:element
name="web-uri">${warName}</x:element>
<x:element
name="context-root">${dep.getProperty('ear.bundle.war.context-root')}</x:ele
ment>
</x:element>
</x:element>
</j:when>
<j:when
test="${dep.getProperty('ear.bundle.ejb')=='true'}">
<x:element name="module">
<x:element
name="ejb">${dep.getArtifact()}</x:element>
</x:element>
</j:when>
</j:choose>
</j:forEach>
</x:element>
</j:file>
> -----Urspr�ngliche Nachricht-----
> Von: Richard Kirby [mailto:[EMAIL PROTECTED]
> Gesendet am: Donnerstag, 16. Oktober 2003 15:46
> An: Maven Users List
> Betreff: Re: j:file and xml files
>
> [EMAIL PROTECTED] wrote:
>
> >Hi,
> >
> >How can I generate XML files with <j:file ... >, notice that
> I need to add DTD
> >declaration in generated files.
> >
> >
> >
> >
> Try:
>
> <j:file name="${basedir}/resources/application.xml"
> escapeText="true"
> trim="true" prettyPrint="true" outputMode="xml" xmlns="dummy">
> <![CDATA[
> <!DOCTYPE application PUBLIC '-//Sun Microsystems, Inc.//DTD
> J2EE Application
> 1.3//EN' 'http://java.sun.com/dtd/application_1_3.dtd'>
> ]]>
> <application>
> <display-name>${j2ee.displayName}</display-name>
> <description>${j2ee.displayName}</description>
> <module>
> <ejb>${ejb}</ejb>
> </module>
> <module>
> <web>
> <web-uri>${uri}</web-uri>
> <context-root>${j2ee.contextRoot}</context-root>
> </web>
> </module>
> </application>
>
> </j:file>
>
> The issue is that maven.xml is itself an XML file and the parser does
> not expect to find a <!DOCTYPE declaration in the middle of
> an XML file,
> so you need to escape it by using the CDATA declaration. You
> might need
> to move the closing ]]> to the end of your file contents so
> that none of
> the XML fragment is interpreted by the parser of the maven.xml file!
>
> Richard.
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]