Skip to main content
Question

Multiple instances of attributes missing when reading in XML


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

2 replies

nielsgerrits
VIP
Forum|alt.badge.img+54

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
  • April 26, 2019
nielsgerrits wrote:

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.


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