下面是xml的文件,本人要获取红色字体的值,问一下有什么方法,分不多,见谅
</kw>
-<kw name=”Get Text” library=”Selenium2Library”>
<doc>Returns the text value of element identified by `locator`.</doc>
-<arguments>
<arg>xpath=//*[@id=”boot_code_version”]</arg>
</arguments>
-<assign>
<var>${getBootloader Ver}</var>
</assign>
<msg level=”INFO” timestamp=”20161017 16:59:49.060″>${getBootloader Ver} = v0.00.05.0000-OT (Mon Mar 2 17:22:31 2015)</msg>
<status starttime=”20161017 16:59:48.998″ endtime=”20161017 16:59:49.060″ status=”PASS”/>
</kw>
-<kw name=”Get Text” library=”Selenium2Library”>
<doc>Returns the text value of element identified by `locator`.</doc>
-<arguments>
<arg>xpath=//*[@id=”hardware_version”]</arg>
</arguments>
-<assign>
<var>${get HW}</var>
</assign>
<msg level=”INFO” timestamp=”20161017 16:59:49.107″>${get HW} = 01A</msg>
<status starttime=”20161017 16:59:49.060″ endtime=”20161017 16:59:49.107″ status=”PASS”/>
</kw>
-<kw name=”Get Text” library=”Selenium2Library”>
<doc>Returns the text value of element identified by `locator`.</doc>
-<arguments>
<arg>xpath=//*[@id=”serial_number”]</arg>
</arguments>
-<assign>
<var>${get SN}</var>
</assign>
<msg level=”INFO” timestamp=”20161017 16:59:49.170″>${get SN} = J639109543</msg>
<status starttime=”20161017 16:59:49.107″ endtime=”20161017 16:59:49.170″ status=”PASS”/>
</kw>
-<kw name=”Get Text” library=”Selenium2Library”>
<doc>Returns the text value of element identified by `locator`.</doc>
-<arguments>
<arg>xpath=//*[@id=”lan_mac_addr”]</arg>
</arguments>
-<assign>
<var>${get Lan MAC}</var>
</assign>
<msg level=”INFO” timestamp=”20161017 16:59:49.232″>${get Lan MAC} = E4:3E:D7:8D:63:CE</msg>
<status starttime=”20161017 16:59:49.170″ endtime=”20161017 16:59:49.232″ status=”PASS”/>
</kw>
-<kw name=”Get Text” library=”Selenium2Library”>
<doc>Returns the text value of element identified by `locator`.</doc>
-<arguments>
<arg>xpath=//*[@id=”wan_mac_addr”]</arg>
</arguments>
-<assign>
<var>${get WAN MAC}</var>
</assign>
<msg level=”INFO” timestamp=”20161017 16:59:49.279″>${get WAN MAC} = E4:3E:D7:8D:63:CE</msg>
<status starttime=”20161017 16:59:49.232″ endtime=”20161017 16:59:49.279″ status=”PASS”/>
</kw>
-<kw name=”Get Text” library=”Selenium2Library”>
<doc>Returns the text value of element identified by `locator`.</doc>
-<arguments>
<arg>xpath=//*[@id=”wlan_mac_addr”]</arg>
</arguments>
-<assign>
<var>${get 2.4G MAC}</var>
</assign>
<msg level=”INFO” timestamp=”20161017 16:59:49.341″>${get 2.4G MAC} = E4:3E:D7:8D:63:CF</msg>
<status starttime=”20161017 16:59:49.294″ endtime=”20161017 16:59:49.341″ status=”PASS”/>
</kw>
-<kw name=”Unselect Frame” library=”Selenium2Library”>
<doc>Sets the top frame as the current frame.</doc>
<status starttime=”20161017 16:59:49.341″ endtime=”20161017 16:59:49.341″ status=”PASS”/>
</kw>
-<kw name=”Log” library=”BuiltIn”>
<doc>Logs the given message with the given level.</doc>
-<arguments>
<arg>${2.4G SSID}</arg>
</arguments>
<msg level=”INFO” timestamp=”20161017 16:59:49.341″>EE-BrightBox-s294nq</msg>
<status starttime=”20161017 16:59:49.341″ endtime=”20161017 16:59:49.357″ status=”PASS”/>
</kw>
-<kw name=”Log” library=”BuiltIn”>
<doc>Logs the given message with the given level.</doc>
-<arguments>
<arg>${2.4G psw}</arg>
</arguments>
<msg level=”INFO” timestamp=”20161017 16:59:49.357″>lid-amble-able</msg>
<status starttime=”20161017 16:59:49.357″ endtime=”20161017 16:59:49.357″ status=”PASS”/>
</kw>
-<kw name=”Log” library=”BuiltIn”>
<doc>Logs the given message with the given level.</doc>
-<arguments>
<arg>${getBootloader Ver}</arg>
</arguments>
<msg level=”INFO” timestamp=”20161017 16:59:49.357″>v0.00.05.0000-OT (Mon Mar 2 17:22:31 2015)</msg>
<status starttime=”20161017 16:59:49.357″ endtime=”20161017 16:59:49.357″ status=”PASS”/>
</kw>
-<kw name=”Log” library=”BuiltIn”>
<doc>Logs the given message with the given level.</doc>
-<arguments>
<arg>${get HW}</arg>
</arguments>
<msg level=”INFO” timestamp=”20161017 16:59:49.357″>01A</msg>
<status starttime=”20161017 16:59:49.357″ endtime=”20161017 16:59:49.357″ status=”PASS”/>
</kw>
-<kw name=”Log” library=”BuiltIn”>
<doc>Logs the given message with the given level.</doc>
-<arguments>
<arg>${get SN}</arg>
</arguments>
<msg level=”INFO” timestamp=”20161017 16:59:49.357″>J639109543</msg>
<status starttime=”20161017 16:59:49.357″ endtime=”20161017 16:59:49.357″ status=”PASS”/>
</kw>
-<kw name=”Log” library=”BuiltIn”>
<doc>Logs the given message with the given level.</doc>
-<arguments>
<arg>${get Lan MAC}</arg>
</arguments>
<msg level=”INFO” timestamp=”20161017 16:59:49.357″>E4:3E:D7:8D:63:CE</msg>
<status starttime=”20161017 16:59:49.357″ endtime=”20161017 16:59:49.357″ status=”PASS”/>
</kw>
-<kw name=”Log” library=”BuiltIn”>
<doc>Logs the given message with the given level.</doc>
-<arguments>
<arg>${get WAN MAC}</arg>
</arguments>
<msg level=”INFO” timestamp=”20161017 16:59:49.357″>E4:3E:D7:8D:63:CE</msg>
<status starttime=”20161017 16:59:49.357″ endtime=”20161017 16:59:49.357″ status=”PASS”/>
</kw>
-<kw name=”Log” library=”BuiltIn”>
<doc>Logs the given message with the given level.</doc>
-<arguments>
<arg>${get 2.4G MAC}</arg>
</arguments>
<msg level=”INFO” timestamp=”20161017 16:59:49.357″>E4:3E:D7:8D:63:CF</msg>
<status starttime=”20161017 16:59:49.357″ endtime=”20161017 16:59:49.357″ status=”PASS”/>
</kw>
<status starttime=”20161017 16:59:28.879″ endtime=”20161017 16:59:49.357″ status=”PASS” critical=”yes”/>
</test>
<status starttime=”20161017 16:59:28.677″ endtime=”20161017 16:59:49.372″ status=”PASS”/>
</suite>
<status starttime=”20161017 16:59:28.630″ endtime=”20161017 16:59:49.372″ status=”PASS”/>
</suite>
</kw>
-<kw name=”Get Text” library=”Selenium2Library”>
<doc>Returns the text value of element identified by `locator`.</doc>
-<arguments>
<arg>xpath=//*[@id=”boot_code_version”]</arg>
</arguments>
-<assign>
<var>${getBootloader Ver}</var>
</assign>
<msg level=”INFO” timestamp=”20161017 16:59:49.060″>${getBootloader Ver} = v0.00.05.0000-OT (Mon Mar 2 17:22:31 2015)</msg>
<status starttime=”20161017 16:59:48.998″ endtime=”20161017 16:59:49.060″ status=”PASS”/>
</kw>
-<kw name=”Get Text” library=”Selenium2Library”>
<doc>Returns the text value of element identified by `locator`.</doc>
-<arguments>
<arg>xpath=//*[@id=”hardware_version”]</arg>
</arguments>
-<assign>
<var>${get HW}</var>
</assign>
<msg level=”INFO” timestamp=”20161017 16:59:49.107″>${get HW} = 01A</msg>
<status starttime=”20161017 16:59:49.060″ endtime=”20161017 16:59:49.107″ status=”PASS”/>
</kw>
-<kw name=”Get Text” library=”Selenium2Library”>
<doc>Returns the text value of element identified by `locator`.</doc>
-<arguments>
<arg>xpath=//*[@id=”serial_number”]</arg>
</arguments>
-<assign>
<var>${get SN}</var>
</assign>
<msg level=”INFO” timestamp=”20161017 16:59:49.170″>${get SN} = J639109543</msg>
<status starttime=”20161017 16:59:49.107″ endtime=”20161017 16:59:49.170″ status=”PASS”/>
</kw>
-<kw name=”Get Text” library=”Selenium2Library”>
<doc>Returns the text value of element identified by `locator`.</doc>
-<arguments>
<arg>xpath=//*[@id=”lan_mac_addr”]</arg>
</arguments>
-<assign>
<var>${get Lan MAC}</var>
</assign>
<msg level=”INFO” timestamp=”20161017 16:59:49.232″>${get Lan MAC} = E4:3E:D7:8D:63:CE</msg>
<status starttime=”20161017 16:59:49.170″ endtime=”20161017 16:59:49.232″ status=”PASS”/>
</kw>
-<kw name=”Get Text” library=”Selenium2Library”>
<doc>Returns the text value of element identified by `locator`.</doc>
-<arguments>
<arg>xpath=//*[@id=”wan_mac_addr”]</arg>
</arguments>
-<assign>
<var>${get WAN MAC}</var>
</assign>
<msg level=”INFO” timestamp=”20161017 16:59:49.279″>${get WAN MAC} = E4:3E:D7:8D:63:CE</msg>
<status starttime=”20161017 16:59:49.232″ endtime=”20161017 16:59:49.279″ status=”PASS”/>
</kw>
-<kw name=”Get Text” library=”Selenium2Library”>
<doc>Returns the text value of element identified by `locator`.</doc>
-<arguments>
<arg>xpath=//*[@id=”wlan_mac_addr”]</arg>
</arguments>
-<assign>
<var>${get 2.4G MAC}</var>
</assign>
<msg level=”INFO” timestamp=”20161017 16:59:49.341″>${get 2.4G MAC} = E4:3E:D7:8D:63:CF</msg>
<status starttime=”20161017 16:59:49.294″ endtime=”20161017 16:59:49.341″ status=”PASS”/>
</kw>
-<kw name=”Unselect Frame” library=”Selenium2Library”>
<doc>Sets the top frame as the current frame.</doc>
<status starttime=”20161017 16:59:49.341″ endtime=”20161017 16:59:49.341″ status=”PASS”/>
</kw>
-<kw name=”Log” library=”BuiltIn”>
<doc>Logs the given message with the given level.</doc>
-<arguments>
<arg>${2.4G SSID}</arg>
</arguments>
<msg level=”INFO” timestamp=”20161017 16:59:49.341″>EE-BrightBox-s294nq</msg>
<status starttime=”20161017 16:59:49.341″ endtime=”20161017 16:59:49.357″ status=”PASS”/>
</kw>
-<kw name=”Log” library=”BuiltIn”>
<doc>Logs the given message with the given level.</doc>
-<arguments>
<arg>${2.4G psw}</arg>
</arguments>
<msg level=”INFO” timestamp=”20161017 16:59:49.357″>lid-amble-able</msg>
<status starttime=”20161017 16:59:49.357″ endtime=”20161017 16:59:49.357″ status=”PASS”/>
</kw>
-<kw name=”Log” library=”BuiltIn”>
<doc>Logs the given message with the given level.</doc>
-<arguments>
<arg>${getBootloader Ver}</arg>
</arguments>
<msg level=”INFO” timestamp=”20161017 16:59:49.357″>v0.00.05.0000-OT (Mon Mar 2 17:22:31 2015)</msg>
<status starttime=”20161017 16:59:49.357″ endtime=”20161017 16:59:49.357″ status=”PASS”/>
</kw>
-<kw name=”Log” library=”BuiltIn”>
<doc>Logs the given message with the given level.</doc>
-<arguments>
<arg>${get HW}</arg>
</arguments>
<msg level=”INFO” timestamp=”20161017 16:59:49.357″>01A</msg>
<status starttime=”20161017 16:59:49.357″ endtime=”20161017 16:59:49.357″ status=”PASS”/>
</kw>
-<kw name=”Log” library=”BuiltIn”>
<doc>Logs the given message with the given level.</doc>
-<arguments>
<arg>${get SN}</arg>
</arguments>
<msg level=”INFO” timestamp=”20161017 16:59:49.357″>J639109543</msg>
<status starttime=”20161017 16:59:49.357″ endtime=”20161017 16:59:49.357″ status=”PASS”/>
</kw>
-<kw name=”Log” library=”BuiltIn”>
<doc>Logs the given message with the given level.</doc>
-<arguments>
<arg>${get Lan MAC}</arg>
</arguments>
<msg level=”INFO” timestamp=”20161017 16:59:49.357″>E4:3E:D7:8D:63:CE</msg>
<status starttime=”20161017 16:59:49.357″ endtime=”20161017 16:59:49.357″ status=”PASS”/>
</kw>
-<kw name=”Log” library=”BuiltIn”>
<doc>Logs the given message with the given level.</doc>
-<arguments>
<arg>${get WAN MAC}</arg>
</arguments>
<msg level=”INFO” timestamp=”20161017 16:59:49.357″>E4:3E:D7:8D:63:CE</msg>
<status starttime=”20161017 16:59:49.357″ endtime=”20161017 16:59:49.357″ status=”PASS”/>
</kw>
-<kw name=”Log” library=”BuiltIn”>
<doc>Logs the given message with the given level.</doc>
-<arguments>
<arg>${get 2.4G MAC}</arg>
</arguments>
<msg level=”INFO” timestamp=”20161017 16:59:49.357″>E4:3E:D7:8D:63:CF</msg>
<status starttime=”20161017 16:59:49.357″ endtime=”20161017 16:59:49.357″ status=”PASS”/>
</kw>
<status starttime=”20161017 16:59:28.879″ endtime=”20161017 16:59:49.357″ status=”PASS” critical=”yes”/>
</test>
<status starttime=”20161017 16:59:28.677″ endtime=”20161017 16:59:49.372″ status=”PASS”/>
</suite>
<status starttime=”20161017 16:59:28.630″ endtime=”20161017 16:59:49.372″ status=”PASS”/>
</suite>
解决方案
30
读取XML解析 获取到节点 然后再保存到txt里面 linq to xml 或用xmldocument 来的得到值
var query = from item in xDoc.Element( “kw”).Elements()
select new
{
arg= item .Element(“arg”).Value,
};
foreach (var item in query)
{//取得处理}
var query = from item in xDoc.Element( “kw”).Elements()
select new
{
arg= item .Element(“arg”).Value,
};
foreach (var item in query)
{//取得处理}
20
用XML相关的对象去获取
XmlDocument
用xpath查询
XmlDocument
用xpath查询
30
linq2xml读取就行了
XElement.Parse(xml).Elements(“xxx”)
相似这种写法可以获取
对于你后面的txt没看懂
XElement.Parse(xml).Elements(“xxx”)
相似这种写法可以获取
对于你后面的txt没看懂
20
LINQ TO XML参考http://bbs.csdn.net/topics/390017085