DeathSurfer
Programmer
Duuudes:
Need help with XPath syntax. I'm new to XPath so bear with me. In the following statement, The way I understand XPath so far should recursively look in the xml file below for every <worksheet_name> element whos value is "Fabric Roll Data" then recursively look for the <first_column_header> element no matter how deep it is in the children of <worksheet_name> and return the .text property. When I run this it returns the very first <first_column_header>.text property which is PD_PONumber instead of the expected FRD_FabricID. I can't seem to find how to set the <worksheet_name> element to only the "Fabric Roll Data" and look at its children. Thanks for your help.
MsgBox xmlDoc.selectSingleNode("//worksheet_name[""Fabric Roll Data""]//first_column_header").text
<?xml version="1.0"?>
<report>
<report_name>Fabric Bucket Report
<workbook_name>Fabric Bucket Reportx.xls
<worksheet_name>PO Data
<query_name>FABRIC_POS
<data_range_name>POData</data_range_name>
<first_column_header>PD_PONumber</first_column_header>
</query_name>
</worksheet_name>
<worksheet_name>Fabric Roll Data
<query_name>FABREQQRY1
<data_range_name>FabricRollData</data_range_name>
<first_column_header>FRD_FabricID</first_column_header>
</query_name>
</worksheet_name>
</workbook_name>
</report_name>
</report>
Need help with XPath syntax. I'm new to XPath so bear with me. In the following statement, The way I understand XPath so far should recursively look in the xml file below for every <worksheet_name> element whos value is "Fabric Roll Data" then recursively look for the <first_column_header> element no matter how deep it is in the children of <worksheet_name> and return the .text property. When I run this it returns the very first <first_column_header>.text property which is PD_PONumber instead of the expected FRD_FabricID. I can't seem to find how to set the <worksheet_name> element to only the "Fabric Roll Data" and look at its children. Thanks for your help.
MsgBox xmlDoc.selectSingleNode("//worksheet_name[""Fabric Roll Data""]//first_column_header").text
<?xml version="1.0"?>
<report>
<report_name>Fabric Bucket Report
<workbook_name>Fabric Bucket Reportx.xls
<worksheet_name>PO Data
<query_name>FABRIC_POS
<data_range_name>POData</data_range_name>
<first_column_header>PD_PONumber</first_column_header>
</query_name>
</worksheet_name>
<worksheet_name>Fabric Roll Data
<query_name>FABREQQRY1
<data_range_name>FabricRollData</data_range_name>
<first_column_header>FRD_FabricID</first_column_header>
</query_name>
</worksheet_name>
</workbook_name>
</report_name>
</report>