使用的xml文档如下

<?xml version="1.0" encoding="UTF-8"?>    <SearchConstraints>      <Begin>glucose</Begin>      <End>Ethanol</End>      <Interface>name</Interface>      <IntermediatesInclude number="0"></IntermediatesInclude>      <IntermediatesExclude> number="0"></IntermediatesExclude>      <Organisms type="all"></Organisms>      <KShort>10</KShort>    </SearchConstraints>    <StoPList>      <StoP>        <Source id="glucose"></Source>        <Target id="Ethanol"></Target>        <RouteList>        </RouteList>      </StoP>    </StoPList>

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

<?xml version="1.0" encoding="UTF-8"?>  <Document>    <SearchConstraints>      <Begin>glucose</Begin>      <End>Ethanol</End>      <Interface>name</Interface>      <IntermediatesInclude number="0"></IntermediatesInclude>      <IntermediatesExclude> number="0"></IntermediatesExclude>      <Organisms type="all"></Organisms>      <KShort>10</KShort>    </SearchConstraints>    <StoPList>      <StoP>        <Source id="glucose"></Source>        <Target id="Ethanol"></Target>        <RouteList>        </RouteList>      </StoP>    </StoPList>  </Document>

更多相关文章

  1. 读取XML文件时报“前言中不允许有内容”错误处理办法详解
  2. 解析XML文件的几种方式对比的详细介绍
  3. XML文件使用SAX方法读取的示例代码
  4. XML文件使用DOM方法读取的示例代码
  5. 如何打开xml文件介绍
  6. maven项目不编译xml文件的解决办法
  7. 四种获取RSS源xml文件的方法
  8. 关于读大数据量的XML文件的读取问题
  9. web.xml文件内容详细分析

随机推荐

  1. char是什么数据类型
  2. win10离线安装net35的方法技巧
  3. c++输出语句
  4. asp.net怎么使用js文件
  5. asp还有人用吗
  6. 递归算法的时间复杂度是什么
  7. webApi怎么调用
  8. malloc函数的用法
  9. 静态变量和动态变量
  10. c语言eps是什么意思