2
<tag1>
    <ResId Type="22" ID="MASTN_NHR" />
</tag1>

I want to get the string MASTN from the above xml(Java code). Do we have any option without using substring-before or substring?

2
  • 1
    Why can't you use the substring functions? Commented Apr 30, 2021 at 6:18
  • If you want to achieve something with one hand tied behind your back and wearing a blindfold, then it's a good idea to explain why you are restricted in this way, otherwise we have no motivation to help you with the task. Commented Apr 30, 2021 at 8:53

1 Answer 1

1

this could work (XPath 2.0):

tokenize(@ID,'_')[1]
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.