0

I need to find all elements in huge xml, that has tag 'WOR' and attr distName.

Value matches

MNL-\d+/AAA-\d+

e.g. <WOR distName="MNL-123/AAA-4" /> Hovever i cannot figure out, how to properly use that in RFs XML Library, documentation does have no info about it too. I've tried to use Keyword 'Evaluate Xpath', but my search still is bad:

Library  XML  use_lxml=True
Evaluate Xpath  ${XML}  //WOR[re:match(@distName, "MNL-[0-9]+/AAA-[0-9]+")]
3
  • 1
    Don't tell us it's huge, tell us whether its 10Mb or 10Gb. Commented Aug 23, 2017 at 17:09
  • You should look in your documentation link for Finding elements with xpath, I think you might do something wrong. Commented Aug 24, 2017 at 10:22
  • Size of xml has nothing to issue. Finding elements with xpath was checked, but it's not same as finding elements with xpath using regex. There is no info about regex in xpath. Commented Aug 24, 2017 at 12:42

1 Answer 1

3

You can try to compose xpath to match full or partial attribute value.

Full:

//WOR[@distName = 'MNL-123/AAA-4']

Partial with one part of the attribute:

//WOR[contains(@distName, 'MNL')]

Partial with two parts of the attribute:

//WOR[contains(@distName, 'MNL')][contains(@distName, 'AAA')]
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.