Skip to main content
Solved

Insert New Item/Child into an Existing XML Element List

  • February 27, 2024
  • 2 replies
  • 177 views

mmccart
Supporter
Forum|alt.badge.img+16

I am trying to insert a new item/child into an existing XML element. 

I want to add: <keyword>USA</keyword> to either the top of this list of keywords (Note this is part of a larger XML document.)

 

I’ve tried to use the XMLUpdater to no avail after a substantial Forum search. 

Here’s where I am at with the XMLUpdater:

I assume my XML/XQuery expression is the issue. Any help would be appreciated. 

Thanks in advance!

Version: FME 2022.2.0.0 (Build22765)

Best answer by mmccart

Thank you @debbiatsafe! That does what I need.

View original
Did this help you find an answer to your question?

2 replies

debbiatsafe
Safer
Forum|alt.badge.img+20
  • Safer
  • February 27, 2024

Hi @mmccart 

Since you want the new keyword element to be a child of the placeKeys element, the XML Path parameter should be: //dataIdInfo/placeKeys

The Value parameter should be <keyword>USA</keyword> as you want to insert a new element and not an attribute

I hope this information helps!


mmccart
Supporter
Forum|alt.badge.img+16
  • Author
  • Supporter
  • Best Answer
  • February 27, 2024

Thank you @debbiatsafe! That does what I need.


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