Skip to main content
Question

metadata update (multiple tags)


Forum|alt.badge.img

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

6 replies

ebygomm
Influencer
Forum|alt.badge.img+31
  • Influencer
  • October 22, 2019

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


Forum|alt.badge.img
  • Author
  • October 22, 2019

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
Influencer
Forum|alt.badge.img+31
  • Influencer
  • October 22, 2019

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']


Forum|alt.badge.img
  • Author
  • October 23, 2019

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


Forum|alt.badge.img
  • Author
  • October 27, 2019
ebygomm wrote:

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
Influencer
Forum|alt.badge.img+31
  • Influencer
  • October 28, 2019

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

 


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings