<?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>
以上就是xml文件要有根标签(错误)的代码解决分享的详细内容。
