Find node by matching on several sibling nodes

EDN Admin

Well-known member
Joined
Aug 7, 2010
Messages
12,794
Location
In the Machine
I have the following XML document which represents a dataset from a database:
<body><br/>
<ns0:WDSRESPONSE xmlns:ns0=" http://www.mycompany.com/WDSResponse/v1 http://www.mycompany.com/WDSResponse/v1 <br/>
<ns0:STATUS>SUCCESS</ns0:STATUS><br/>
<ns0:RESULTSET><br/>
<ns0:DATATYPES /><br/>
<ns0:RECORD><br/>
<FAC>NULL</FAC><br/>
<AREA>NULL</AREA><br/>
<MACH>ALD_03</MACH><br/>
<MACH_DATA>NULL</MACH_DATA><br/>
<LOADPORT>ALD_03</LOADPORT><br/>
<IPP>NULL</IPP><br/>
<PROD>CF</PROD><br/>
<LOT>NULL</LOT><br/>
<CODE>-1</CODE><br/>
<STAGE>SSAL_VD</STAGE><br/>
<REV>NULL</REV><br/>
<STEP>DEP_DIEL_ALD</STEP><br/>
<PARAM>CYCLES</PARAM><br/>
<PARAM_DATA>D;SEQUENCESTEP4</PARAM_DATA><br/>
<RECIPE>NULL</RECIPE><br/>
<RECIPE1>N/A</RECIPE1><br/>
<RECIPE2>N/A</RECIPE2><br/>
<RECIPE3>N/A</RECIPE3><br/>
<RECIPE4>N/A</RECIPE4><br/>
<RECIPE5>N/A</RECIPE5><br/>
<UCL>1000</UCL><br/>
<TARGET>956</TARGET><br/>
<LCL>NULL</LCL><br/>
<PDATETIME>NULL</PDATETIME><br/>
<DBTABLE>ASM_ALD_INFO</DBTABLE><br/>
<ENABLED>Y</ENABLED><br/>
<APC>NULL</APC><br/>
<PCA>NULL</PCA><br/>
<TARG_DATA>NULL</TARG_DATA><br/>
<FWVER>3</FWVER><br/>
<WAFSIZE>200</WAFSIZE><br/>
<WAFER>NULL</WAFER><br/>
</ns0:RECORD><br/>
<ns0:RECORD><br/>
<FAC>NULL</FAC><br/>
<AREA>NULL</AREA><br/>
<MACH>ALD_03</MACH><br/>
<MACH_DATA>NULL</MACH_DATA><br/>
<LOADPORT>ALD_03</LOADPORT><br/>
<IPP>NULL</IPP><br/>
<PROD>CF</PROD><br/>
<LOT>CF08Q</LOT><br/>
<CODE>-1</CODE><br/>
<STAGE>SSAL_VD</STAGE><br/>
<REV>NULL</REV><br/>
<STEP>DEP_DIEL_ALD</STEP><br/>
<PARAM>CYCLES</PARAM><br/>
<PARAM_DATA>D:SEQUENCESTEP4</PARAM_DATA><br/>
<RECIPE>NULL</RECIPE><br/>
<RECIPE1>N/A</RECIPE1><br/>
<RECIPE2>N/A</RECIPE2><br/>
<RECIPE3>N/A</RECIPE3><br/>
<RECIPE4>N/A</RECIPE4><br/>
<RECIPE5>N/A</RECIPE5><br/>
<UCL>2000</UCL><br/>
<TARGET>1000</TARGET><br/>
<LCL>NULL</LCL><br/>
<PDATETIME>NULL</PDATETIME><br/>
<DBTABLE>ASM_ALD_INFO</DBTABLE><br/>
<ENABLED>Y</ENABLED><br/>
<APC>NULL</APC><br/>
<PCA>NULL</PCA><br/>
<TARG_DATA>NULL</TARG_DATA><br/>
<FWVER>3</FWVER><br/>
<WAFSIZE>200</WAFSIZE><br/>
<WAFER>CF08Q</WAFER><br/>
</ns0:RECORD><br/>
<ns0:RECORD><br/>
<FAC>NULL</FAC><br/>
<AREA>NULL</AREA><br/>
<MACH>ALD_03</MACH><br/>
<MACH_DATA>NULL</MACH_DATA><br/>
<LOADPORT>ALD_03</LOADPORT><br/>
<IPP>NULL</IPP><br/>
<PROD>CF</PROD><br/>
<LOT>NULL</LOT><br/>
<CODE>-1</CODE><br/>
<STAGE>SSAL_VD</STAGE><br/>
<REV>NULL</REV><br/>
<STEP>DEP_DIEL_ALD</STEP><br/>
<PARAM>MODULE_TYPE</PARAM><br/>
<PARAM_DATA>D;SEQUENCESTEP4</PARAM_DATA><br/>
<RECIPE>PULSAR</RECIPE><br/>
<RECIPE1>N/A</RECIPE1><br/>
<RECIPE2>N/A</RECIPE2><br/>
<RECIPE3>N/A</RECIPE3><br/>
<RECIPE4>N/A</RECIPE4><br/>
<RECIPE5>N/A</RECIPE5><br/>
<UCL>NULL</UCL><br/>
<TARGET>NULL</TARGET><br/>
<LCL>NULL</LCL><br/>
<PDATETIME>NULL</PDATETIME><br/>
<DBTABLE>ASM_ALD_INFO</DBTABLE><br/>
<ENABLED>Y</ENABLED><br/>
<APC>NULL</APC><br/>
<PCA>NULL</PCA><br/>
<TARG_DATA>NULL</TARG_DATA><br/>
<FWVER>3</FWVER><br/>
<WAFSIZE>200</WAFSIZE><br/>
<WAFER>NULL</WAFER><br/>
</ns0:RECORD><br/>
<ns0:RECORD><br/>
<FAC>NULL</FAC><br/>
<AREA>NULL</AREA><br/>
<MACH>ALD_03</MACH><br/>
<MACH_DATA>NULL</MACH_DATA><br/>
<LOADPORT>ALD_03</LOADPORT><br/>
<IPP>NULL</IPP><br/>
<PROD>CF</PROD><br/>
<LOT>NULL</LOT><br/>
<CODE>-1</CODE><br/>
<STAGE>SSAL_VD</STAGE><br/>
<REV>NULL</REV><br/>
<STEP>DEP_DIEL_ALD</STEP><br/>
<PARAM>STEP_FILE</PARAM><br/>
<PARAM_DATA>D;SEQUENCESTEP4</PARAM_DATA><br/>
<RECIPE>D</RECIPE><br/>
<RECIPE1>N/A</RECIPE1><br/>
<RECIPE2>N/A</RECIPE2><br/>
<RECIPE3>N/A</RECIPE3><br/>
<RECIPE4>N/A</RECIPE4><br/>
<RECIPE5>N/A</RECIPE5><br/>
<UCL>NULL</UCL><br/>
<TARGET>NULL</TARGET><br/>
<LCL>NULL</LCL><br/>
<PDATETIME>NULL</PDATETIME><br/>
<DBTABLE>ASM_ALD_INFO</DBTABLE><br/>
<ENABLED>Y</ENABLED><br/>
<APC>NULL</APC><br/>
<PCA>NULL</PCA><br/>
<TARG_DATA>NULL</TARG_DATA><br/>
<FWVER>3</FWVER><br/>
<WAFSIZE>200</WAFSIZE><br/>
<WAFER>NULL</WAFER><br/>
</ns0:RECORD><br/>
<ns0:RECORD><br/>
<FAC>NULL</FAC><br/>
<AREA>NULL</AREA><br/>
<MACH>ALD_03</MACH><br/>
<MACH_DATA>I32</MACH_DATA><br/>
<LOADPORT>NULL</LOADPORT><br/>
<IPP>I32</IPP><br/>
<PROD>NULL</PROD><br/>
<LOT>NULL</LOT><br/>
<CODE>-1</CODE><br/>
<STAGE>NULL</STAGE><br/>
<REV>NULL</REV><br/>
<STEP>NULL</STEP><br/>
<PARAM>MODULE_ASSOC</PARAM><br/>
<PARAM_DATA>PULSAR</PARAM_DATA><br/>
<RECIPE>PM3</RECIPE><br/>
<RECIPE1>N/A</RECIPE1><br/>
<RECIPE2>N/A</RECIPE2><br/>
<RECIPE3>N/A</RECIPE3><br/>
<RECIPE4>N/A</RECIPE4><br/>
<RECIPE5>N/A</RECIPE5><br/>
<UCL>NULL</UCL><br/>
<TARGET>2</TARGET><br/>
<LCL>NULL</LCL><br/>
<PDATETIME>NULL</PDATETIME><br/>
<DBTABLE>ASM_ALD_INFO</DBTABLE><br/>
<ENABLED>Y</ENABLED><br/>
<APC>Y</APC><br/>
<PCA>NULL</PCA><br/>
<TARG_DATA>NULL</TARG_DATA><br/>
<FWVER>3</FWVER><br/>
<WAFSIZE>200</WAFSIZE><br/>
<WAFER>NULL</WAFER><br/>
</ns0:RECORD><br/>
<ns0:RECORD><br/>
<FAC>NULL</FAC><br/>
<AREA>NULL</AREA><br/>
<MACH>ALD_03</MACH><br/>
<MACH_DATA>I21</MACH_DATA><br/>
<LOADPORT>NULL</LOADPORT><br/>
<IPP>I21</IPP><br/>
<PROD>NULL</PROD><br/>
<LOT>NULL</LOT><br/>
<CODE>-1</CODE><br/>
<STAGE>NULL</STAGE><br/>
<REV>NULL</REV><br/>
<STEP>NULL</STEP><br/>
<PARAM>MODULE_ASSOC</PARAM><br/>
<PARAM_DATA>PULSAR</PARAM_DATA><br/>
<RECIPE>PM2</RECIPE><br/>
<RECIPE1>N/A</RECIPE1><br/>
<RECIPE2>N/A</RECIPE2><br/>
<RECIPE3>N/A</RECIPE3><br/>
<RECIPE4>N/A</RECIPE4><br/>
<RECIPE5>N/A</RECIPE5><br/>
<UCL>NULL</UCL><br/>
<TARGET>1</TARGET><br/>
<LCL>NULL</LCL><br/>
<PDATETIME>NULL</PDATETIME><br/>
<DBTABLE>ASM_ALD_INFO</DBTABLE><br/>
<ENABLED>Y</ENABLED><br/>
<APC>Y</APC><br/>
<PCA>NULL</PCA><br/>
<TARG_DATA>NULL</TARG_DATA><br/>
<FWVER>3</FWVER><br/>
<WAFSIZE>200</WAFSIZE><br/>
<WAFER>NULL</WAFER><br/>
</ns0:RECORD><br/>
<ns0:RECORD><br/>
<FAC>NULL</FAC><br/>
<AREA>NULL</AREA><br/>
<MACH>ALD_04</MACH><br/>
<MACH_DATA>I32</MACH_DATA><br/>
<LOADPORT>NULL</LOADPORT><br/>
<IPP>I32</IPP><br/>
<PROD>NULL</PROD><br/>
<LOT>NULL</LOT><br/>
<CODE>-1</CODE><br/>
<STAGE>NULL</STAGE><br/>
<REV>NULL</REV><br/>
<STEP>NULL</STEP><br/>
<PARAM>MODULE_ASSOC</PARAM><br/>
<PARAM_DATA>PULSAR</PARAM_DATA><br/>
<RECIPE>PM3</RECIPE><br/>
<RECIPE1>N/A</RECIPE1><br/>
<RECIPE2>N/A</RECIPE2><br/>
<RECIPE3>N/A</RECIPE3><br/>
<RECIPE4>N/A</RECIPE4><br/>
<RECIPE5>N/A</RECIPE5><br/>
<UCL>NULL</UCL><br/>
<TARGET>1</TARGET><br/>
<LCL>NULL</LCL><br/>
<PDATETIME>NULL</PDATETIME><br/>
<DBTABLE>ASM_ALD_INFO</DBTABLE><br/>
<ENABLED>Y</ENABLED><br/>
<APC>Y</APC><br/>
<PCA>NULL</PCA><br/>
<TARG_DATA>NULL</TARG_DATA><br/>
<FWVER>3</FWVER><br/>
<WAFSIZE>200</WAFSIZE><br/>
<WAFER>NULL</WAFER><br/>
</ns0:RECORD><br/>
<ns0:RECORD><br/>
<FAC>NULL</FAC><br/>
<AREA>NULL</AREA><br/>
<MACH>ALD_04</MACH><br/>
<MACH_DATA>I21</MACH_DATA><br/>
<LOADPORT>NULL</LOADPORT><br/>
<IPP>I21</IPP><br/>
<PROD>NULL</PROD><br/>
<LOT>NULL</LOT><br/>
<CODE>-1</CODE><br/>
<STAGE>NULL</STAGE><br/>
<REV>NULL</REV><br/>
<STEP>NULL</STEP><br/>
<PARAM>MODULE_ASSOC</PARAM><br/>
<PARAM_DATA>PULSAR</PARAM_DATA><br/>
<RECIPE>PM2</RECIPE><br/>
<RECIPE1>N/A</RECIPE1><br/>
<RECIPE2>N/A</RECIPE2><br/>
<RECIPE3>N/A</RECIPE3><br/>
<RECIPE4>N/A</RECIPE4><br/>
<RECIPE5>N/A</RECIPE5><br/>
<UCL>NULL</UCL><br/>
<TARGET>1</TARGET><br/>
<LCL>NULL</LCL><br/>
<PDATETIME>NULL</PDATETIME><br/>
<DBTABLE>ASM_ALD_INFO</DBTABLE><br/>
<ENABLED>Y</ENABLED><br/>
<APC>Y</APC><br/>
<PCA>NULL</PCA><br/>
<TARG_DATA>NULL</TARG_DATA><br/>
<FWVER>3</FWVER><br/>
<WAFSIZE>200</WAFSIZE><br/>
<WAFER>NULL</WAFER><br/>
</ns0:RECORD><br/>
</ns0:RESULTSET><br/>
<ns0:ERROR><br/>
<ns0:ERRORCODE /><br/>
<ns0:ERRORMESSAGE /><br/>
</ns0:ERROR><br/>
</ns0:WDSRESPONSE><br/>
</body>
I am trying to construct a Linq query to give me the RECIPE data from a particular node. If I were to write a SQL statement to do this, it would look like this:
SELECT RECIPE<br/>
FROM TABLE<br/>
WHERE (MACH=ALD_03)<br/>
AND (PARAM=MODULE_ASSOC)<br/>
AND (MACH_DATA=I21)<br/>
AND (PARAM_DATA=PULSAR)
The result of such a query would be "PM2". I just cant seem to get the Linq syntax correct to get the same data from this XML document. Can anyone give me some idea how to go about this?
Thanks.

View the full article
 
Back
Top