Skip to main content
Solved

How can I extract XML attributes used as containers for data?


toedeledokie

Your input would be much appreciated.

I don't know how to proceed and would like to avoid manipulating the source data manually to get it to do what I want.

 

I've received data which is formatted in the following manner. I'm posting the first item and closing it off just as it ends in the file with </markers>:

<markers>

<marker name="Tilburg"

    straat="Vloeiveldweg 6a"

    postcode="5048 TD"

    plaats="Tilburg"

    site=""

    lat="51.600739"

    lng="5.064299"

    linkurl="tilburg"

    status="0"

    dot="red.png"

    >

</markers>

 

I used an XMLFragmenter and it's configured as:

Elements to Match: markers/marker

Flatten Options: Enabled

01Feature Information shows:

02How do I go about extracting marker.name etc. into their own attributes with values? I've tried various combinations in Elements as XML Fragments but no dice.

Best answer by nielsgerrits

Hej @toedeledokie​ (lol),

I think you only need to expose these attributes. You can do this by manually entering the attribute name in the "Attributes to Expose" field at the bottom of the XMLFragmenter. You can also use the AttributeExposer transformer if you prefer.

If you double click on an attribute value in the Feature Information window, a new window pops up from which you can copy the attributename to paste in the AttributeExposer.

If you use FME 2020 or newer, you can run the proces upstream the AttributeExposer with FeatureCaching on. Then you can easily click and select the unexposed attributes from a list:

2021-06-01_14h39_09

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

2 replies

nielsgerrits
VIP
Forum|alt.badge.img+54
  • Best Answer
  • June 1, 2021

Hej @toedeledokie​ (lol),

I think you only need to expose these attributes. You can do this by manually entering the attribute name in the "Attributes to Expose" field at the bottom of the XMLFragmenter. You can also use the AttributeExposer transformer if you prefer.

If you double click on an attribute value in the Feature Information window, a new window pops up from which you can copy the attributename to paste in the AttributeExposer.

If you use FME 2020 or newer, you can run the proces upstream the AttributeExposer with FeatureCaching on. Then you can easily click and select the unexposed attributes from a list:

2021-06-01_14h39_09


toedeledokie
nielsgerrits wrote:

Hej @toedeledokie​ (lol),

I think you only need to expose these attributes. You can do this by manually entering the attribute name in the "Attributes to Expose" field at the bottom of the XMLFragmenter. You can also use the AttributeExposer transformer if you prefer.

If you double click on an attribute value in the Feature Information window, a new window pops up from which you can copy the attributename to paste in the AttributeExposer.

If you use FME 2020 or newer, you can run the proces upstream the AttributeExposer with FeatureCaching on. Then you can easily click and select the unexposed attributes from a list:

2021-06-01_14h39_09

Thank you! Kicking myself over it. It was staring me right in the face 😅

03 

"Hej @toedeledokie​ (lol),"

😉


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