Skip to main content
Question

Multiple instances of attributes missing when reading in XML

  • April 26, 2019
  • 2 replies
  • 45 views

Hi, very new to FME so I'm sure there's probably a very easy fix for this but I can't seem to find one anywhere.

 

I have an XML file I'm trying to read, and one of the attributes has a one-to-many relationship with the parent feature. When reading in the XML, the data for this attribute will be read in when only one instance of the attribute occurs. Where multiple instance of the attribute occurs, the field is missing. Example below:

 

The attribute <Activity> is read successfully for instances like this in the XML file:

<FacilityReport>

<NationalID>Example1</NationalID>

<Activity>

<RankingNumeric>1</RankingNumeric>

<ActivityCode>5.(b)</ActivityCode>

</Activity>

</FacilityReport>

 

But <Activity> will be missing for instances like this:

<FacilityReport>

<NationalID>Example2</NationalID>

<Activity>

<RankingNumeric>1</RankingNumeric>

<ActivityCode>5.(b)</ActivityCode>

</Activity>

<Activity>

<RankingNumeric>2</RankingNumeric>

<ActivityCode>5.(c)</ActivityCode>

</Activity>

</FacilityReport>

 

In this example the tabular data looks like this:

 

NationalIDRankingNumericActivityCodeExample115.(b)Example2<missing><missing>

 

I have been trying using Feature Paths, with flattening enabled. Does anyone have any suggestions where I'm going wrong?

 

Thanks,

 

Laurence

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

nielsgerrits
VIP
Forum|alt.badge.img+60
  • 2939 replies
  • April 26, 2019

Because there are more children, FME puts those in a list. Lists can't be displayed in the Table View but can be found in the Feature Information. Select the row in the Inspector and look for {}.

There are several ways of dealing with this. It all depends on the data but generally (to get a more generic workflow) I prefer to put all attributes in lists and work from there. This can be done in the Advanced Flatten Options, change row 9 from

cardinality="+{?}"

to

cardinality="{}"

Not sure what your starting level is, shout if you need more help. Providing sampledata / workspace helps with finding a fitting solution.


  • Author
  • 1 reply
  • April 26, 2019

Because there are more children, FME puts those in a list. Lists can't be displayed in the Table View but can be found in the Feature Information. Select the row in the Inspector and look for {}.

There are several ways of dealing with this. It all depends on the data but generally (to get a more generic workflow) I prefer to put all attributes in lists and work from there. This can be done in the Advanced Flatten Options, change row 9 from

cardinality="+{?}"

to

cardinality="{}"

Not sure what your starting level is, shout if you need more help. Providing sampledata / workspace helps with finding a fitting solution.

Genius, that's worked, thanks very much.