1

have a postgres query to extract xml , not able to provide the xpath correctly

select column1, xmlcolumn from tabla 

xmlcolumn is of the type:

<tag1>
  <tag2>
    <tag3>test</tag3>
  </tag2>
</tag1>

I need to extract value of tag3

Any idea how this can be done ?

1
  • sorry for that, thanks, this actually worked !! Commented Oct 8, 2018 at 9:03

1 Answer 1

2

demo: db<>fiddle

SELECT xpath('/tag1/tag2/tag3/text()', xmlcolumn) 

Postgres XML documentation

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.