Skip to main content
Question

[XML] order siblings

  • May 16, 2014
  • 1 reply
  • 15 views

gpt_geoinfo
Contributor
Forum|alt.badge.img+2
Hi all,

 

 

I'm quite into FME+XML.

 

My today's question: How can I order the siblings of a node?

 

Example:

 

in:

 

<Book>

 

  <Format Type="Kindle">

 

    <Price>5.00</Price>

 

    <Currency>£</Currency>

 

    <AvailableDate>2010-05-01</AvailableDate>

 

  </Format>

 

  <Format Type="Paperback">

 

    <Price>8.00</Price>

 

    <Currency>£</Currency>

 

    <AvailableDate>2010-03-20</AvailableDate>

 

  </Format>

 

</Book>

 

 

out:

 

<Book>

 

  <Format Type="Kindle">

 

    <AvailableDate>2010-05-01</AvailableDate>

 

    <Price>5.00</Price>

 

    <Currency>£</Currency>

 

  </Format>

 

  <Format Type="Paperback">

 

    <AvailableDate>2010-03-20</AvailableDate>

 

    <Price>8.00</Price>

 

    <Currency>£</Currency>

 

  </Format>

 

</Book>

 

 

The node AvailableDate is now before Price.

 

Are the transformers XQueryUpdater or XMLUpdater right for that?

 

 

Regards,

 

-Maria

1 reply

david_r
Celebrity
  • May 18, 2014
Hi,

 

 

it's possible, but not super easy. I would try with a XMLFragmenter to convert the siblings into features, then send them through a Sorter and then an XMLTemplater to reassemble the XML.

 

 

David

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