0

I am trying to flatten an xml file with fme 2014. I´m having problems understanding how to manage the following xml schema. One of the XML child elements is called "aspects" and contains the following ...

<aspects>
<a id="1" l="de" v="Alter Schafstall und Eichen beim Südsee-Camp"/>

How do I go about flattening the attributes? FME seems to flatten most of the table, but the above gets defined as an "XML Fragment". In the table the field "XML_Fragment" then contains the above xml structure with tags etc...ie is not being flattened.

1

I'm not sure if this is a bug, or just some weirdness about XML, but generally if I have this XML:

<?xml version="1.0" encoding="UTF-8"?> 
    <FeatureCollection> 
            <Course> 
                    <type>Desktop</type> 
                    <location>Vancouver, BC</location> 
                    <activeDate> 
                    <from>2014-05-22</from> 
                    <to>2014-05-23</to> 
                    </activeDate> 
                    <coord lat="49.2" long="-123.0"/> 
            </Course>
            <Course> 
                    <type>Server</type> 
                    <location>Austin, TX</location> 
                    <activeDate> 
                    <from>2014-11-13</from> 
                    <to>2014-11-14</to> 
                    </activeDate> 
                    <coord lat="30.25" long="-97.75"/> 
            </Course> > 
    </FeatureCollection> 

And run it through the XMLFlattener with "FeatureCollection" as the Element to Match, then I'll get a list attribute as follows:

Course{0}.activeDate.to' has value `2014-05-23'
Course{0}.coord' has value `'
Course{0}.coord.lat' has value `49.2'
Course{0}.coord.long' has value `-123.0'
Course{0}.location' has value `Vancouver, BC'
Course{0}.type' has value `Desktop'
Course{1}.activeDate.from' has value `2014-11-13'
Course{1}.activeDate.to' has value `2014-11-14'
Course{1}.coord' has value `'
Course{1}.coord.lat' has value `30.25'
Course{1}.coord.long' has value `-97.75'
Course{1}.location' has value `Austin, TX'
Course{1}.type' has value `Server'

So each child element becomes a part of a list. If there are multiple child elements it should be a multiple-level list (for example Course{1}.activeDate.from).

If you're not getting that (add a Logger transformer to show you exactly what is being output), then I would say either you've changed (or need to change) one of the Flatten Options in the transformer parameters, or it's maybe some XML oddity that isn't compatible with this flattening method.

Either way it would help to see a bit more of your source data. If you want, you can send it to us at Safe (http://www.safe.com/supportrequest) and we can investigate some more, but I'll also have some of our XML experts take a look at this question when they are in the office (it's still early in Vancouver) and see if they have any suggestions.

| improve this answer | |
  • Our chief XML-ologist took a look, duplicated what you have above, and found no problem. So I guess you'll need to definitely send it in to the support team for further analysis. – Mark Ireland Jul 24 '14 at 17:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.