# Parsing repeated tags in XML

**URL:** <https://discuss.elastic.co/t/parsing-repeated-tags-in-xml/267405>\
**Category:** Logstash\
**Created:** [March 16, 2021, 5:57pm UTC](https://discuss.elastic.co/t/parsing-repeated-tags-in-xml/267405 "2021-03-16T17:57:17Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![adityaPsl](https://avatars.discourse-cdn.com/v4/letter/a/e47c2d/32.png) [@adityaPsl](https://discuss.elastic.co/u/adityaPsl)\
**Post date:** [March 16, 2021, 5:57pm UTC](https://discuss.elastic.co/t/parsing-repeated-tags-in-xml/267405/1 "2021-03-16T17:57:17Z")

</div>

Hello Team,

I have XML data where there are repeated tags, as per the documentation it is converting it to an array, but I want to implement it like break on first match or convert array to single value.  
Could you please help me understand how can we achieve this in logstash.

Thanks for your help and support.

Aditya

---

<div class="post-metadata">

**Author:** ![Badger](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/badger/32/25190_2.png) [@Badger](https://discuss.elastic.co/u/Badger)\
**Post date:** [March 16, 2021, 6:13pm UTC](https://discuss.elastic.co/t/parsing-repeated-tags-in-xml/267405/2 "2021-03-16T18:13:58Z")

</div>

You can replace the array with its first entry

```
mutate { replace => { "someField" => "%{[someField][0]}" } }
```

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [April 13, 2021, 6:14pm UTC](https://discuss.elastic.co/t/parsing-repeated-tags-in-xml/267405/3 "2021-04-13T18:14:48Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
