i have this xml
<?xml version="1.0" encoding="UTF-8"?>
<rsixml2 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://dtd.riege.com/rsixml2/rsixml2 http://dtd.riege.com/rsixml2/rsixml2.xsd" xmlns="http://dtd.riege.com/rsixml2/rsixml2">
<!-- 2.78 20170509 RSIXML2 -->
<!-- $Header: /export/cvs/procars/product/protrack/xml/rsixml2.dbs,v 1.217 2017/05/09 14:53:44 schaefer Exp $ -->
<metadata>
<processing>
<process name="AI2XML" version="1.90"/>
<process name="RSIXML2" version="2.78"/>
</processing>
<params>
</params>
</metadata>
<!-- generated by 1.90 20181218 AI2XML /$Header: /export/cvs/procars/incs/misc/fillxml.dbs,v 1.58 2017/02/28 14:05:47 brink Exp $ -->
<!-- Debug info. Branch BIRDXB: plb -d AI2XML -sno=1202000626 -msgtyp=AIHub2Branch -sid=BIRDXB -rid=GLOBLI -FINE -rsixml2 -->
<partners>
<partner qual="sender" value="BIRDXB"/>
<partner qual="receiver" value="GLOBLI"/>
</partners>
<shipment messageType="AIHub2Branch" status="new" type="house">
<partners>
<partner qual="sender" value="BIRDXB" role="importer"/>
<partner qual="receiver" value="GLOBLI"/>
<partner qual="finalDestination" value="GLOBLI"/>
<partner qual="exportGateway" value="BIRCGN"/>
<partner qual="shipmentCreator" value="BIRCGN"/>
</partners>
<refs>
<ref qual="shipper" type="shipper" value="20208098479"/>
<ref qual="shipper" type="shipper" value="8400649"/>
<ref qual="shipment" value="1202000626" system="true"/>
<ref qual="procarsId" value="BIRDXB1202000626" system="true"/>
<ref qual="ptt" value="BIRCGN20001198693" system="true"/>
<ref qual="awb" value="CGN-95629985" system="true"/>
<ref qual="mawb" value="501-06663753" system="true"/>
</refs>
</shipment>
</rsixml2>
I need Value from the Value Attribute from here
<ref qual="mawb" value="501-06663753" system="true"/>
This is the Code so far.
XmlDocument doc = new XmlDocument();
doc.Load("C:\\Users\\shaki\\Desktop\\input.xml");
foreach (XmlNode node in doc.DocumentElement)
{
if (node.Name == "ref")
{
string name = node.Attributes[1].InnerText;
checkedListBox2.Items.Add(name);
}
textBox1.Text += node;
}
These are the values in doc.DocumentElement
System.Xml.XmlCommentSystem.Xml.XmlCommentSystem.Xml.XmlElementSystem.Xml.XmlCommentSystem.Xml.XmlCommentSystem.Xml.XmlElementSystem.Xml.XmlElement
I dont understand why.
I haven't tried LINQ because i don't understand it, but if it is the last choice. i'll take it.