Skip to main content
Solved

XML fragmenter dynamic attributes to expose


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.

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

2 replies

daveatsafe
Safer
Forum|alt.badge.img+19
  • Safer
  • 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
  • October 3, 2019
daveatsafe wrote:

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


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