Meine XML-Dateistruktur wie folgt aussieht:Looping durch XML-Dokument und suchen ein bestimmtes Attribut Wert
<Boards CountBoards="3" name="NAME" info="INFO" otherInfo="OTHERINFO">
<Board0 Name="Alm_HP_RE" BoardWidth="1800" BoardHeigth="1800" Image="" ImageLayout="None" fileName="FILENAME" path="PATH">
<Controls CountControls="2">
<IOControl Type="DigitalInput" Name=".._M1AED10_GS110_XG001" GroupName="" ControlBackColor="LimeGreen" ControlTextColor="White" ControlVisible="True" ControlWidth="207" ControlHeigth="26" IOMapName="IF3.ST1.IF1.ST3.DigitalInput01" IsHidden="False" DisplayElementVisible="True" GraphVisible="False" NameLabelVisible="True" LableContent="PV_Name" DiagramBackColor="Black" DiagramLineColor="Red" LineWidth="2" Timescale="225" XGrid="9" YGrid="4" Value="9" MaxYValue="2" MinYValue="-2" FeedBackSwitch="" FeedBackValue="" FeedBackColor="White" Signal="">
<Position X="259" Y="281" />
</IOControl>
<IOControl Type="DigitalInput" Name="IF3.ST1.IF1.ST3.DigitalInput08" GroupName="" ControlBackColor="LimeGreen" ControlTextColor="White" ControlVisible="True" ControlWidth="217" ControlHeigth="26" IOMapName="IF3.ST1.IF1.ST3.DigitalInput08" IsHidden="False" DisplayElementVisible="True" GraphVisible="False" NameLabelVisible="True" LableContent="PV_Name" DiagramBackColor="Black" DiagramLineColor="Red" LineWidth="2" Timescale="225" XGrid="9" YGrid="4" Value="9" MaxYValue="2" MinYValue="-2" FeedBackSwitch="" FeedBackValue="" FeedBackColor="White" Signal="">
<Position X="313" Y="199" />
</IOControl>
</Controls>
</Board0>
<Board1 Name="AO_Exchange" BoardWidth="1800" BoardHeigth="1800" Image="" ImageLayout="None" fileName="FILENAME" path="PATH">
<Controls CountControls="2">
<IOControl Type="DigitalInput" Name=".._M0CBC01_F151_XG001" GroupName="" ControlBackColor="LimeGreen" ControlTextColor="White" ControlVisible="True" ControlWidth="199" ControlHeigth="26" IOMapName="IF3.ST1.IF1.ST5.DigitalInput05" IsHidden="False" DisplayElementVisible="True" GraphVisible="False" NameLabelVisible="True" LableContent="PV_Name" DiagramBackColor="Black" DiagramLineColor="Red" LineWidth="2" Timescale="225" XGrid="9" YGrid="4" Value="0" MaxYValue="2" MinYValue="-2" FeedBackSwitch="" FeedBackValue="" FeedBackColor="White" Signal="">
<Position X="130" Y="260" />
</IOControl>
<IOControl Type="DigitalInput" Name=".._M0CBC01_F5152_XG001" GroupName="" ControlBackColor="LimeGreen" ControlTextColor="White" ControlVisible="True" ControlWidth="205" ControlHeigth="26" IOMapName="IF3.ST1.IF1.ST5.DigitalInput12" IsHidden="False" DisplayElementVisible="True" GraphVisible="False" NameLabelVisible="True" LableContent="PV_Name" DiagramBackColor="Black" DiagramLineColor="Red" LineWidth="2" Timescale="225" XGrid="9" YGrid="4" Value="0" MaxYValue="2" MinYValue="-2" FeedBackSwitch="" FeedBackValue="" FeedBackColor="White" Signal="">
<Position X="201" Y="463" />
</IOControl>
</Controls>
</Board1>
<Board2 Name="DO_Exchange" BoardWidth="1800" BoardHeigth="1800" Image="" ImageLayout="None" fileName="FILENAME" path="PATH">
<Controls CountControls="2">
<IOControl Type="DigitalInput" Name=".._M0CBC01_F10_XG001" GroupName="" ControlBackColor="LimeGreen" ControlTextColor="White" ControlVisible="True" ControlWidth="192" ControlHeigth="26" IOMapName="IF3.ST1.IF1.ST5.DigitalInput07" IsHidden="False" DisplayElementVisible="True" GraphVisible="False" NameLabelVisible="True" LableContent="PV_Name" DiagramBackColor="Black" DiagramLineColor="Red" LineWidth="2" Timescale="225" XGrid="9" YGrid="4" Value="0" MaxYValue="2" MinYValue="-2" FeedBackSwitch="" FeedBackValue="" FeedBackColor="White" Signal="">
<Position X="251" Y="194" />
</IOControl>
<IOControl Type="DigitalInput" Name=".._M0CBC01_F152_XG001" GroupName="" ControlBackColor="LimeGreen" ControlTextColor="White" ControlVisible="True" ControlWidth="199" ControlHeigth="26" IOMapName="IF3.ST1.IF1.ST5.DigitalInput06" IsHidden="False" DisplayElementVisible="True" GraphVisible="False" NameLabelVisible="True" LableContent="PV_Name" DiagramBackColor="Black" DiagramLineColor="Red" LineWidth="2" Timescale="225" XGrid="9" YGrid="4" Value="0" MaxYValue="2" MinYValue="-2" FeedBackSwitch="" FeedBackValue="" FeedBackColor="White" Signal="">
<Position X="186" Y="113" />
</IOControl>
</Controls>
</Board2>
</Boards>
Ich möchte den „Wert“ überprüfen XmlDocument verwenden.
Also schrieb ich eine Schleife wie folgt aus:
XmlDocument iosDoc = new XmlDocument();
iosDoc.Load(ios[0].FullName);
XmlNodeList boardList = iosDoc.GetElementsByTagName("Boards");
foreach (XmlNode node in boardList)
{
foreach (XmlNode xc in node.ChildNodes)
{ // wahat need to check here, I am not getting.
}
}
I wan dynamisch innerhalb Boards alle Knoten/Element suchen und die "Value" überprüfen. Bitte vorschlagen.