Question

XMLReader list creation

  • 7 April 2016
  • 1 reply
  • 1 view

Badge

Hi everyone, 

I've got a problem with the XML Reader in FME Desktop 2015. I want to read xml list attributes, and it works fine if a node contains multiple children like:

<feature>
  <networks>
            <network>
                <type></type>
                <linkage></linkage>
            </network>
            <network>
                <type></type>
                <linkage></linkage>
            </network>
        </networks>
</feature>

In this case the reader returns a list networks.network{}, which I need. BUT if networks contains only one network, then it does not return a list, but simple attributes like networks.network.type etc.

My Reader also lists the networks as a list, but in translation it becomes a simple attribute as mentioned. Is there a setting that I am missing? 

Feature Attributes:

0684Q00000ArC6IQAV.png

XMLReader settings:

0684Q00000ArBtKQAV.png

Thanks, 

mel


1 reply

Userlevel 2
Badge +17

Hi @me1, switch the XML Flatten Options dialog to Advanced mode (click the left-bottom button), and modify the cardinality option like this.

cardinality="*/networks/network{}/+ +{?}"

See also here to learn more.

 

Reply