Skip to main content
Solved

Insert New Item/Child into an Existing XML Element List

  • February 27, 2024
  • 2 replies
  • 208 views

mmccart
Enthusiast
Forum|alt.badge.img+28

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.

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.

2 replies

debbiatsafe
Safer
Forum|alt.badge.img+21
  • 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
Enthusiast
Forum|alt.badge.img+28
  • Author
  • Enthusiast
  • Best Answer
  • February 27, 2024

Thank you @debbiatsafe! That does what I need.