2013-04-17 43 views
1

我在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> 

回答

1

必須有一個包含其餘元素的根元素。

只要創建一個,例如:

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

    <!-- Rest of your xml --> 

</myXml> 
2

的XML文件必須包含一個包含所有其他元素一個根元素。這看起來像一個Ant構建腳本,這意味着您忘記將它包裝在<project>元素中。

+0

啊鬆了一口氣!!!!它的工作...非常感謝! –

+0

@Shweta:如果它的工作,請考慮接受這個答案。如果其他人有用,請考慮提升他們。謝謝! – halfer

相關問題