Skip to main content
Question

[XML] order siblings

  • May 16, 2014
  • 1 reply
  • 31 views

gpt_geoinfo
Contributor
Forum|alt.badge.img+3
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
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.

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