今天,在写个批量启动报盘机的自动化应用,为了简化起见,将配置信息存储在xml中,格式如下:
<?xml version="1.0" encoding="UTF-8"?>
<server tradeName="证券" operatorNo="---" operatorPassword="---" path="XXX.exe"></server>
<server tradeName="期货" operatorNo="---" operatorPassword="---" path="XXX.exe"></server>
结果报"文档中根元素后面的标记格式必须正确",最后经排查,是根节点必须为1个,不能多个。调整为如下后解决:
<?xml version="1.0" encoding="UTF-8"?>
<servers>
<server tradeName="证券" operatorNo="---" operatorPassword="---" path="XXX.exe"></server>
<server tradeName="期货" operatorNo="---" operatorPassword="---" path="XXX.exe"></server>
</servers>
还有可能的原因可参见http://www.cnblogs.com/jiahuafu/archive/2010/02/06/1664830.html