I am new to this forum as well as a beginner with XPATH and XML...here it goes: I am trying to extract the value "CARBIDE" from the node MfgParam name = "Tool_Material" from the below XML document. The problem is I don't know what type of node this is:
<MfgParam Name="TOOL_MATERIAL" Value="CARBIDE"/>
I tried some XPATH expressions and it seemed like it is not an element node or an attribute node...what is it? Here is the document:
<?xml version="1.0" encoding="UTF-8"?>
<MfgSetupDocument>
<DocType>PRO_NC_CUTTING_TOOL_SETUP</DocType>
<DocTitle>Cutting Tool Information</DocTitle>
<DateTime>2013-05-09T09:17:44</DateTime>
<ApplicationInfo AppName="Pro/ENGINEER" Language="usascii" AppVersion="M130"/>
<ToolingSetup>
<Tool Id="EM12345" Type="MILLING" RefXmlId="encref_1">
<Attr Name="UseOutline" Value="false" DataType="boolean"/>
<Attr Name="ProLibraryTool" Value="false" DataType="boolean"/>
<Attr Name="SketchTool" Value="false" DataType="boolean"/>
<Attr Name="ToolByRef" Value="false" DataType="boolean"/>
<MfgParam Name="LENGTH_UNITS" Value="INCH"/>
<MfgParam Name="CUTTER_DIAM" Value="0.5"/>
<MfgParam Name="CORNER_RADIUS" Value="-"/>
<MfgParam Name="SIDE_ANGLE" Value="-"/>
<MfgParam Name="LENGTH" Value="1.5"/>
<MfgParam Name="NUM_OF_TEETH" Value="5"/>
<MfgParam Name="TOOL_MATERIAL" Value="CARBIDE"/>
<MfgParam Name="GAUGE_X_LENGTH" Value="-"/>
<MfgParam Name="GAUGE_Z_LENGTH" Value="5.6842"/>
<MfgParam Name="COMP_OVERSIZE" Value="-"/>
<MfgParam Name="TOOL_LONG_FLAG" Value="NO"/>
<MfgParam Name="HOLDER_DIA" Value="2.94"/>
<MfgParam Name="HOLDER_LEN" Value="1"/>
<MfgParam Name="COOLANT_OPTION" Value="OFF"/>
<MfgParam Name="COOLANT_PRESSURE" Value="NONE"/>
<MfgParam Name="SPINDLE_SENSE" Value="CW"/>
<MfgParam Name="FLUTE_LENGTH" Value="1.25"/>
<MfgParam Name="TOOL_COMMENT" Value=".500 DIA 5-FLT HANITA EM "/>
<ToolSetUpOnWorkcell>
<OffsetDataCollection>
<OffsetData Tip="1" Comment=".500 DIA 5-FLT HANITA EM " OffsetZ="0.000000" Register="-1"/>
</OffsetDataCollection>
</ToolSetUpOnWorkcell>
</Tool>
</ToolingSetup>
</MfgSetupDocument>
Am programming with VB.Net 2010/Visual Studio. I tried experimenting with the code below using the DOM but it would only show the element nodes:
Dim AllNodes As XmlNodeList
AllNodes = MillingToolTemplate.SelectNodes("/MfgSetupDocument/descendant::*")
Dim i As Integer
For i = 0 To AllNodes.Count - 1
Console.WriteLine(i & ". " & AllNodes(i).InnerText)
Next
Sorry about the fonts.
what is the XPATH expression to get the value "CARBIDE" from the MfgParam Name = "TOOL_MATERIAL"
Any help is greatly appreciated.