//XML文件
<?
xml version="1.0" encoding="UTF-8" ?>
- <root>
  <Time>2007/07/06 14:46</Time>
  <CurrentP>1.500</CurrentP>
  <BidP>1.450</BidP>
  <AskP>1.630</AskP>
  <Open>1.500</Open>
  <High>1.500</High>
  <Low>1.500</Low>
  <LClose>1.500</LClose>
  <Unit>5000</Unit>
  <chg>0.000</chg>
  <pchg>0.00%</pchg>
  <Volume>30000</Volume>
  <Value>45000</Value>
  <PE>17.715</PE>
  <Yield>0.005</Yield>
  <YHigh>20.000</YHigh>
  <YLow>1.490</YLow>
  <TotalValue>185400009</TotalValue>
 </root>

  
 string FilePath = @"D:/Test/0817.xml";

   /* 加载XML并输出 */
   XmlDocument doc = new XmlDocument();
   doc.Load(FilePath);

   XmlElement root = doc.DocumentElement;
   XmlNode current = root.SelectSingleNode("CurrentP");

   CurrentP = current.InnerText.ToString();
   Integer = CurrentP.Split('.')[0];
   Decimal = CurrentP.Split('.')[1];

输出结果:Integer=1;
         Decimal=500;

相关文章:

  • 2021-10-22
  • 2021-10-16
  • 2021-10-19
  • 2021-10-05
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2021-09-21
  • 2021-12-26
  • 2021-09-26
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案