Skip to main content
Question

metadata update (multiple tags)

  • Oct 22, 2019 11:10 AM UTC
  • 6 replies
  • 83 views

wilczekmj
Contributor
Forum|alt.badge.img+4

Hello,

I am using XML updater to update geodatabase metadata and it works well with single tag value.

However when there are multiple tags it updates all of them with the same value.

XML path in XMLUpdater: dataIdInfo/tpCat/TopicCatCd – before the change

<tpCat>

<TopicCatCd value="007"></TopicCatCd>

</tpCat>

<tpCat>

<TopicCatCd value="018"></TopicCatCd>

</tpCat>

XML path in XMLUpdater: dataIdInfo/tpCat/TopicCatCd, change value: 44 – after the change

<tpCat>

<TopicCatCd value="44"></TopicCatCd>

</tpCat>

<tpCat>

<TopicCatCd value="44"></TopicCatCd>

</tpCat>

Expected results after the change

<tpCat>

<TopicCatCd value="44"></TopicCatCd>

</tpCat>

<tpCat>

<TopicCatCd value="018"></TopicCatCd>

</tpCat>

 

Any help much appreciated.

 

Many thanks

Magda

This post is closed to further activity.
It may be an old question, an answered question, an implemented idea, or a notification-only post.
Please check post dates before relying on any information in a question or answer.
For follow-up or related questions, please post a new question or idea.
If there is a genuine update to be made, please contact us and request that the post is reopened.

6 replies

ebygomm
Evangelist
Forum|alt.badge.img+54
  • Evangelist
  • Oct 22, 2019 1:17 PM UTC

Do you only want to update the first tag, or only update where the value = 007?


wilczekmj
Contributor
Forum|alt.badge.img+4
  • Author
  • Contributor
  • Oct 22, 2019 2:52 PM UTC

Hello ebygomm,

Many thanks for looking into the question.

I would like to know how to access/update first, second, third etc. tag. For example, if I want to update the 007 value, essentially this means I want to update the first tag. How do I go about it?


ebygomm
Evangelist
Forum|alt.badge.img+54
  • Evangelist
  • Oct 22, 2019 2:54 PM UTC

If you want to update the first tag you can use

//tpCat/TopicCatCd[1]

 

If you want to update the tag with value 007 you can use

//tpCat/TopicCatCd[@value = '007']


wilczekmj
Contributor
Forum|alt.badge.img+4
  • Author
  • Contributor
  • Oct 23, 2019 12:37 PM UTC

Many thanks ebygomm, that is what I was looking for, much appreciated!

Do you know how I can add a tag with a value?

Many thanks,

Magda


wilczekmj
Contributor
Forum|alt.badge.img+4
  • Author
  • Contributor
  • Oct 27, 2019 10:33 PM UTC

If you want to update the first tag you can use

//tpCat/TopicCatCd[1]

 

If you want to update the tag with value 007 you can use

//tpCat/TopicCatCd[@value = '007']

It does not work if I try to delete by value. Is there a different statement for deleting by value?


ebygomm
Evangelist
Forum|alt.badge.img+54
  • Evangelist
  • Oct 28, 2019 3:51 PM UTC

I normally use the XMLXQueryUpdater for updating xml and would use something like this to delete a node

e.g.

for $node in //TopicCatCd
where $node[@value="007"]
return delete node $node