[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]



Reply via email to