I tried to use the xslt
task in Ant to modify a Hibernate mapping file (*.hbm.xml
) using XSLT. However I kept on getting an com.sun.org.apache.xml.internal.utils.WrappedRuntimeException
.
If I take out the !DOCTYPE
declaration in the source xml file, the following target runs without any error. Could someone please tell me what I'm doing wrong? Thanks!
Here's my Ant target:
<target name="generatePermHbmXml">
<xslt in="${base.configuration.hibernate.dir}\Test.hbm.xml"
out="${base.configuration.hibernate.dir}\TestPerm.hbm.xml"
style="${base.configuration.hibernate.dir}\perm.xsl">
<xmlcatalog>
<dtd publicId="-//Hibernate/Hibernate Mapping DTD//EN"
location="http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd"/>
</xmlcatalog>
</xslt>
</target>
Here's my log output:
[xslt] : Error! hibernate.sourceforge.net
[xslt] : Error! com.sun.org.apache.xml.internal.utils.WrappedRuntimeException: hibernate.sourceforge.net
[Edit] Here's the DOCTYPE that I removed to get it working
<!DOCTYPE hibernate-mapping
PUBLIC
"-//Hibernate/Hibernate Mapping DTD//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
[Edit2]: I found a fix, but I don't know whether if it is the "right" way or not. I downloaded the DTD file and placed that in my project dir. I referenced the file (as shown below) instead of the URL, and it seems to be working now.
<xmlcatalog>
<dtd publicId="-//Hibernate/Hibernate Mapping DTD//EN"
location="${base.configuration.hibernate.dir}/hibernate-mapping-3.0.dtd"/>
</xmlcatalog>