Skip to main content
Solved

XML fragmenter dynamic attributes to expose

  • October 3, 2019
  • 2 replies
  • 202 views

boubcher
Contributor
Forum|alt.badge.img+11

Hello there

we are reading an XML URL , in order to extract the features and values,

we used the XML fragmenter, the problem is we need to enter the attribute to expose into the transformer setting , is there a way we could dynamically read them, because there large number and also avoid any typo problem.

 

 

Best answer by daveatsafe

Hi @boubcher,

I'm sorry, but FME currently cannot automatically populate the Attributes to Expose fields in the transformers.

However, there is a process I use to quickly expose attributes from JSON or XML sources:

  • Add an AttributeExploder after the XMLFragmenter, using the default settings.
  • Add a DuplicateFilter to remove duplicates of _attr_name
  • Write the Unique output to a CSV file, with column headers
  • Run the workspace once to create CSV file
  • Remove the new transformers, then add an AttributeExposer after the XMLFragmenter
  • In the AttributeExposer, click the Import button
  • Set Format to CSV, then select the new CSV file you created
  • Click the Next button, then set Import From to Attribute values
  • Click Next, then set Attributes to _attr_name
  • Click Import to populate the AttributeExposer with the new attributes

The Attributes to Expose setting doesn't have the Import option, so I use the AttributeExposer transformer instead.

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

daveatsafe
Safer
Forum|alt.badge.img+19
  • Safer
  • 1637 replies
  • Best Answer
  • October 3, 2019

Hi @boubcher,

I'm sorry, but FME currently cannot automatically populate the Attributes to Expose fields in the transformers.

However, there is a process I use to quickly expose attributes from JSON or XML sources:

  • Add an AttributeExploder after the XMLFragmenter, using the default settings.
  • Add a DuplicateFilter to remove duplicates of _attr_name
  • Write the Unique output to a CSV file, with column headers
  • Run the workspace once to create CSV file
  • Remove the new transformers, then add an AttributeExposer after the XMLFragmenter
  • In the AttributeExposer, click the Import button
  • Set Format to CSV, then select the new CSV file you created
  • Click the Next button, then set Import From to Attribute values
  • Click Next, then set Attributes to _attr_name
  • Click Import to populate the AttributeExposer with the new attributes

The Attributes to Expose setting doesn't have the Import option, so I use the AttributeExposer transformer instead.


boubcher
Contributor
Forum|alt.badge.img+11
  • Author
  • Contributor
  • 212 replies
  • October 3, 2019

Hi @boubcher,

I'm sorry, but FME currently cannot automatically populate the Attributes to Expose fields in the transformers.

However, there is a process I use to quickly expose attributes from JSON or XML sources:

  • Add an AttributeExploder after the XMLFragmenter, using the default settings.
  • Add a DuplicateFilter to remove duplicates of _attr_name
  • Write the Unique output to a CSV file, with column headers
  • Run the workspace once to create CSV file
  • Remove the new transformers, then add an AttributeExposer after the XMLFragmenter
  • In the AttributeExposer, click the Import button
  • Set Format to CSV, then select the new CSV file you created
  • Click the Next button, then set Import From to Attribute values
  • Click Next, then set Attributes to _attr_name
  • Click Import to populate the AttributeExposer with the new attributes

The Attributes to Expose setting doesn't have the Import option, so I use the AttributeExposer transformer instead.

Thanks @daveatsafe

Great its working