XPATH Query help

Hello,

I have a very large/long web page that I need to parse and grab the text from the value element (in this case “Medway”). I tried so many ways to do it, but can’t seem to capture that word.

Please help.
Thank you.

<tr>
                                                                            <td>
                                                                                <span class="instructionalTextBlue">Structure Name:</span>
                                                                            </td>
                                                                            <td colspan="3" nowrap="">
                                                                                <input class="instructionalTextBoxBlue" maxlength="80" name="sitename" size="50" type="text" value="Medway">
                                                                                </input>
                                                                                <span class="instructionalTextFieldBlue">(Field owned by IT)</span>
                                                                            </td>
                                                                        </tr>

Hi @sw1336,

if you transfer your text into xml you can extract your value with a xpath query.

Best Regards
Andrew

@Andrew_Steel ,

Thank you for the response. I tried it, but I am failing…just don’t know what i am doing wrong…

Can you please look to see if there is anything obviously incorrect? “String to XML” node is problematic.

Thank you again.

Hi @sw1336,

You also use only the text column for the conversion to XML?
Bildschirmfoto von 2021-03-13 13-44-04

Best Regards
Andrew

Hi @Andrew_Steel,

Yes, tried that too - doesn’t work.

Just curious, how did you create that file you tested? did you just add the 1st line?

Thank you again…

Hi @sw1336,

it works with both, with xml row and without. I attach both files and the workflow. The raw text is a copy&paste of your text in your first message.

I hope it helps
Best Regards
Andrew

testXML.knwf (21.8 KB) rawtext.txt (997 Bytes) xmltext.txt (1.0 KB)

2 Likes

Many, Many thanks @Andrew_Steel. This really really helps.

Now another question. My txt file is greater than 2000 rows. There is a limit of 2000 rows of preview in the XPATH node. How can I look at the bottom bit as I need to click and capture the XPATH for data at the bottom?

Thank you again. :pray:

Hello @Andrew_Steel,

Another question please - promise this is the last one.

In a dropdown and select field, how do I capture the selected value? In this case No.

Thank you, again. I really do appreciate it…

 <tr>
	          <td>Is this a Structure?</td>
			  <td><select name="sensitive"><option value="">SELECT</option>
					 	<option value="1">Yes</option>
<option value="0" selected="selected">No</option>
<option value="2">n/a</option></select>
			  </td></tr>

Hi @sw1336,

for such cases the txt file is greater than 2000 rows the Xpath queries can only be entered manually. Add XPath without a preselection and fill in the XPath query, Column name …

Your second question:

If you need only the value SELECT you can use
/tr/td[*]/select/option[1]

If you need all option values you can use
/tr/rd[*]/select/option

Set Type to String(Multiple Rows)

Best regards
Andrew

2 Likes

again, Many thanks, @Andrew_Steel.

Have a great Weekend!!!

2 Likes

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.