必须很好地形成根元素后面的文档中的标记

时间:2013-04-17 10:29:42

标签: xml

我在XML文档中遇到错误第2行。请帮忙。

"The markup in the document following the root elemnt must be well formed."

我的XML是

<property name="src" location="C:\Selenium\Workspace\AutoTester\src"/>
<property name="libs" location="C:\Selenium\Ref_Library"></property>
<property name="build" location="build"></property>

<!-- Define the classpath which includes the junit.jar and the classes after compiling--> 
<path id="AutoTester.classpath">
<pathelement location="bin"/>
<pathelement location="${libs}/jxl.jar"/>
<pathelement location="${libs}/selenium-java-srcs.jar"/>
<pathelement location="${libs}/selenium-java.jar"/>
<pathelement location="${libs}/selenium-server-standalone.jar"/>
<pathelement location="${libs}/testng.jar"/>
</path>

<!-- Deletes the existing build and result directories-->
<target name="clean">
<delete dir="${build}" />
</target>

<!-- Creates the build, and test results directories-->
<target name="makedir">
<mkdir dir="${build}" />
</target>

<!-- Compiles the java code -->
<target name="compile" depends="clean, makedir">
<javac srcdir="${src}" destdir="${build}" debug="true" includeAntRuntime="false">
<classpath refid="AutoTester.classpath" />
</javac>
</target>

3 个答案:

答案 0 :(得分:2)

XML文件必须始终包含包含所有其他元素的单个根元素。这看起来像Ant构建脚本,这意味着您忘记将其包装在<project>元素中。

答案 1 :(得分:1)

看起来缺少根元素,或者您可能没有在示例中包含整个XML。如果它是一个Ant脚本,看看,请查看http://ant.apache.org/manual/using.html

上的示例

答案 2 :(得分:1)

必须有一个包含其余元素的根元素。

只需创建一个,例如:

<myXml>
    <property name="src" location="C:\Selenium\Workspace\AutoTester\src"/>

    <!-- Rest of your xml -->

</myXml>