Ant:build.xml; XML document structure must start and end within the same entity
ant, java, xml
Solution
I believe this is the problem:
<doctitle><![CDATA[<h1>=Profile Mgnt =</h1>]]</doctitle>
<bottom><![CDATA[Copyright 2011. All Rights reserved></bottom>
Neither of your CDATA sections are properly terminated, so your file is simply not valid XML. I think you should have:
<doctitle><![CDATA[<h1>=Profile Mgnt =</h1>]]></doctitle>
<bottom><![CDATA[Copyright 2011. All Rights reserved>]]></bottom>
... although as the second of these strings does anything which requires escaping in XML, I woudln't even use a CDATA section for it:
<doctitle><![CDATA[<h1>=Profile Mgnt =</h1>]]></doctitle>
<bottom>Copyright 2011. All Rights reserved></bottom>
... and even the first one just needs the open angle brackets escaping:
<doctitle><h1>=Profile Mgnt =</h1></doctitle>
<bottom>Copyright 2011. All Rights reserved></bottom>
(You might chose to convert `>` to `>` as well, but I don't believe you have to.)
Problem
I have the following directory structure ``` +project +--profile +---src +---WebContent +---build ``` I am trying to compile and copy using Ant, but when I execute the following build.xml file I get this error XML document structure must start and end within the same entity and nothing else. I checked a couple of almost similar questions but none of them helped, the only question similar to this was collected by adding any thing within like a comment which didn't work for me. What am I missing in the build file? ``` <?xml version="1.0"?> <project name="profile" basedir="." default="Task-of-build"> <property name="src.dir" value="src"/> <property name="webcontent.dir" value="WebContent"/> <property name="javadoc" value="doc"/> <property name="name" value="profile"/> <property name="build.dir" value="${webcontent.dir}/WEB-INF/classes"/> <property name="backup.dir" value="C:/project/backup"/> <path id="classpathvalue"> <fileset dir="${webcontent.dir}/WEB-INF/lib"> <include name="*.jar"/> <!-- this is a comment --> </fileset> <pathelement path="${build.dir}"/> </path> <target name="javadoc"> <javadoc packagenames="com.mucyo.prep.profile.*" sourcepath="${src.dir}" destdir = "doc" version="true" windowtitle="Profile Mngt"> <doctitle><![CDATA[<h1>=Profile Mgnt =</h1>]]</doctitle> <bottom><![CDATA[Copyright 2011. All Rights reserved></bottom> <group title="Beans packages" packages="com.mucyo.prep.profile.bean.*"/> <group title="Service packages" pachages="com.mucyo.prep.profile.services.*"/> <group title="servlets packages" packages="com.mucyo.profile.servlets.*"/> </javadoc> </target> <target name="Task-of-build"> <echo message="This a build example"/> </target> <target name="build" description="compiling java files"> <mkdir dir="${build.dir}"/> <javac destdir="${build.dir}" source="1.6" target="1.6" debug="true" deprecation="false" optimize="false" failonerror="true"> <src path="${src.dir}"/> <classpath refid="classpathvalue"/> </javac> </target> <target name="create-war" depends="build"> <war destfile="${name}.war" webxml="${webcontent.dir}/WEB-INF/web.xml"> <fileset dir="."> <include name="**/*.*"/> </fileset> </war> </target> <target name="backup" depends="build"> <mkdir dir="${backup.dir}"/> <copy todir="${backup.dir}" preservelastmodified="true"> <fileset dir="."> <include dir="${src.dir}:${build.dir}"/> </fileset> </copy> </target> <target name="clean" depends="build"> <delete> <fileset dir="${build.dir}"> <include name="**/*.class"/> </fileset> </delete> </target> </project> ```