Question

metadata update (multiple tags)

  • 22 October 2019
  • 6 replies
  • 4 views

Badge

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

Userlevel 1
Badge +21

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

Badge

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?

Userlevel 1
Badge +21

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

Badge

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

Badge

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?

Userlevel 1
Badge +21

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

 

Reply