欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

XML文件要有根标签(Extra content at the end of the document in file 错误) 博客分类: servletjava servletxml 

程序员文章站 2024-02-08 14:53:46
...

使用的xml文档如下

 

 

[html] view plain copy
 
  1. <?xml version="1.0" encoding="UTF-8"?>  
  2.   <SearchConstraints>  
  3.     <Begin>glucose</Begin>  
  4.     <End>Ethanol</End>  
  5.     <Interface>name</Interface>  
  6.     <IntermediatesInclude number="0"></IntermediatesInclude>  
  7.     <IntermediatesExclude> number="0"></IntermediatesExclude>  
  8.     <Organisms type="all"></Organisms>  
  9.     <KShort>10</KShort>  
  10.   </SearchConstraints>  
  11.   <StoPList>  
  12.     <StoP>  
  13.       <Source id="glucose"></Source>  
  14.       <Target id="Ethanol"></Target>  
  15.       <RouteList>  
  16.       </RouteList>  
  17.     </StoP>  
  18.   </StoPList>  


问题所在:没有加根标签呀!XML文件只能有一个根标签
把xml改成下面这样就ok了,也就是加一个Document标签,将先前的两个根标签SearchConstraints和StoPList都放到Document标签的下面,从而整个XML文件只有一个根标签

 

 

[html] view plain copy
 
  1. <?xml version="1.0" encoding="UTF-8"?>  
  2. <Document>  
  3.   <SearchConstraints>  
  4.     <Begin>glucose</Begin>  
  5.     <End>Ethanol</End>  
  6.     <Interface>name</Interface>  
  7.     <IntermediatesInclude number="0"></IntermediatesInclude>  
  8.     <IntermediatesExclude> number="0"></IntermediatesExclude>  
  9.     <Organisms type="all"></Organisms>  
  10.     <KShort>10</KShort>  
  11.   </SearchConstraints>  
  12.   <StoPList>  
  13.     <StoP>  
  14.       <Source id="glucose"></Source>  
  15.       <Target id="Ethanol"></Target>  
  16.       <RouteList>  
  17.       </RouteList>  
  18.     </StoP>  
  19.   </StoPList>  
  20. </Document>  
相关标签: servlet xml