tejaswi c

tejaswi c

  • NA
  • 9
  • 659

How to access the nodes and its elements in XML using c#

Aug 23 2019 9:55 AM
For example , I have an XML file like this 
 
<UAObject NodeId="ns=2;i=1001" BrowseName="2:PackMLObjects">
<DisplayName>PackMLObjects</DisplayName>
<References>
<Reference ReferenceType="HasTypeDefinition">i=61</Reference>
<Reference ReferenceType="Organizes" IsForward="false">i=85</Reference>
</References>
</UAObject>
<UAObject NodeId="ns=2;i=1002" BrowseName="2:PackMLMachine">
<DisplayName>PackMLMachine</DisplayName>
<References>
<Reference ReferenceType="HasTypeDefinition">ns=1;i=1008</Reference>
<Reference ReferenceType="Organizes" IsForward="false">ns=2;i=1001</Reference>
</References>
</UAObject>
<UAObject NodeId="ns=2;i=1003" BrowseName="1:Admin">
<DisplayName>Admin</DisplayName>
<References>
<Reference ReferenceType="HasComponent" IsForward="false">ns=2;i=1002</Reference>
<Reference ReferenceType="HasTypeDefinition">ns=1;i=1007</Reference>
</References>
</UAObject>
<UAVariable DataType="PackMLDescriptorDataType" ValueRank="1" NodeId="ns=2;i=1004" ArrayDimensions="1" BrowseName="1:Parameters">
<DisplayName>Parameters</DisplayName>
<References>
<Reference ReferenceType="HasComponent" IsForward="false">ns=2;i=1003</Reference>
<Reference ReferenceType="HasTypeDefinition">i=63</Reference>
</References>
<Extensions>
<Extension>
<si:VariableMapping>"PackTags"."Admin"."Parameter"</si:VariableMapping>
</Extension>
</Extensions>
</UAVariable>
 
 using c# i need to access all namespaces  <si:variablemappig> and its respectice values 
could anyone pls help me with code ?  i'm using VS studio 2015 

Answers (3)