MrWhite
01-23-2004, 02:06 AM
Hello,
I'm trying to read out an XML file that would need to meet the requirements specified by the user in the textboxes.
The format of the XML file is as folllows:
- <root creator="MrWhite">
- <datasets>
- <dataset>
<DataField name="DATE">6/01/2004</DataField>
<DataField name="DF1">43</DataField>
<DataField name="DF2">Test, Test</DataField>
</dataset>
- <dataset>
<DataField name="DATE">6/01/2004</DataField>
<DataField name="DF1">44</DataField>
<DataField name="DF2">Test2, Test2</DataField>
</dataset>
</datasets>
</root>
The XPath to read out the nodes when only one textbox is specified works perfectly, and looks like this:
szXPathQuery = "//datasets/dataset[./DataField[@name = 'DF1'
and contains(., '" & txtPatientID.Text & "')]]"
But the problem occurs when I'm trying to read out more than one textboxes.
My guess was that it should be something like:
szXPathQuery = "//datasets/dataset[./DataField[@name = 'DF1'
and contains(., '" & txtPatientID.Text & "')]
AND [@name = 'DF2' and contains(., '" & txtPatientName.Text & "') ]]"
But then I get an error message ("expression expected") after the AND on the third line.
As far as I can see the syntax is correct, so I don't really have a clue what is wrong.
Any ideas?
Thanks.
I'm trying to read out an XML file that would need to meet the requirements specified by the user in the textboxes.
The format of the XML file is as folllows:
- <root creator="MrWhite">
- <datasets>
- <dataset>
<DataField name="DATE">6/01/2004</DataField>
<DataField name="DF1">43</DataField>
<DataField name="DF2">Test, Test</DataField>
</dataset>
- <dataset>
<DataField name="DATE">6/01/2004</DataField>
<DataField name="DF1">44</DataField>
<DataField name="DF2">Test2, Test2</DataField>
</dataset>
</datasets>
</root>
The XPath to read out the nodes when only one textbox is specified works perfectly, and looks like this:
szXPathQuery = "//datasets/dataset[./DataField[@name = 'DF1'
and contains(., '" & txtPatientID.Text & "')]]"
But the problem occurs when I'm trying to read out more than one textboxes.
My guess was that it should be something like:
szXPathQuery = "//datasets/dataset[./DataField[@name = 'DF1'
and contains(., '" & txtPatientID.Text & "')]
AND [@name = 'DF2' and contains(., '" & txtPatientName.Text & "') ]]"
But then I get an error message ("expression expected") after the AND on the third line.
As far as I can see the syntax is correct, so I don't really have a clue what is wrong.
Any ideas?
Thanks.