代码如下:
XmlDocument fmsXML = new XmlDocument();
fmsXML.LoadXml(@"E:\FMS\FMS项目\FMSManage(展会版本)--(2008.10.20)\FMSManage\FMSxml\FMSSystemConfig.xml");
string strBmpWidth = fmsXML.GetElementsByTagName("Width").Item(0).FirstChild.ToString();
string strBmpHeight = fmsXML.GetElementsByTagName("Height").Item(0).FirstChild.ToString();
bmpWidth = dataConvert.Str2Int(strBmpWidth, strBmpWidth.Length);
bmpWidth = dataConvert.Str2Int(strBmpHeight, strBmpHeight.Length);
XML文档路径是对的,但是老是出现如下错误:不知道这是怎么回事,XML文档格式如下:
<?xml version="1.0" encoding="utf-8"?>
<FMSConfig>
<ArrayOfFMSStation>
<FMSStation>上料单元</FMSStation>
<FMSStation>立体仓库单元</FMSStation>
<FMSStation>分拣单元</FMSStation>
<FMSStation>图像处理单元</FMSStation>
<FMSStation>安装搬运单元</FMSStation>
<FMSStation>加工单元</FMSStation>
<FMSStation>装配分拣单元</FMSStation>
</ArrayOfFMSStation>
<NumberOfAGV>2</NumberOfAGV>
<VideoSetting>
<Width>800</Width>
<Height>600</Height>
</VideoSetting>
</FMSConfig>
XmlDocument fmsXML = new XmlDocument();
fmsXML.LoadXml(@"E:\FMS\FMS项目\FMSManage(展会版本)--(2008.10.20)\FMSManage\FMSxml\FMSSystemConfig.xml");
string strBmpWidth = fmsXML.GetElementsByTagName("Width").Item(0).FirstChild.ToString();
string strBmpHeight = fmsXML.GetElementsByTagName("Height").Item(0).FirstChild.ToString();
bmpWidth = dataConvert.Str2Int(strBmpWidth, strBmpWidth.Length);
bmpWidth = dataConvert.Str2Int(strBmpHeight, strBmpHeight.Length);
XML文档路径是对的,但是老是出现如下错误:不知道这是怎么回事,XML文档格式如下:
<?xml version="1.0" encoding="utf-8"?>
<FMSConfig>
<ArrayOfFMSStation>
<FMSStation>上料单元</FMSStation>
<FMSStation>立体仓库单元</FMSStation>
<FMSStation>分拣单元</FMSStation>
<FMSStation>图像处理单元</FMSStation>
<FMSStation>安装搬运单元</FMSStation>
<FMSStation>加工单元</FMSStation>
<FMSStation>装配分拣单元</FMSStation>
</ArrayOfFMSStation>
<NumberOfAGV>2</NumberOfAGV>
<VideoSetting>
<Width>800</Width>
<Height>600</Height>
</VideoSetting>
</FMSConfig>
就出现了错误
问题解决了!