Author |
Message
|
Debarpan |
Posted: Fri Jan 09, 2015 4:36 am Post subject: Code for rearranging a XML |
|
|
Newbie
Joined: 09 Jan 2015 Posts: 1
|
Code: |
<Containers>
<Container>
<Consignment>1A</Consignment>
<Consignment>1A</Consignment>
<Consignment>1A</Consignment>
</Container>
<Container>
<Consignment>1B</Consignment>
<Consignment>1B</Consignment>
<Consignment>1B</Consignment>
<Consignment>1B</Consignment>
<Consignment>1B</Consignment>
</Container>
<Container>
<Consignment>1C</Consignment>
<Consignment>1C</Consignment>
</Container>
<Container>
<Consignment>1D</Consignment>
<Consignment>1D</Consignment>
<Consignment>1D</Consignment>
<Consignment>1D</Consignment>
<Consignment>1D</Consignment>
</Container>
</Containers> |
I have the above XML (Or for similar kind of XML),This is my InputRoot.XMLNSC.*,I just want to make a XML in OutputRoot where this <Container> tag shuold come first who has minimum number of Consignment within it.and in this Ascending way. |
|
Back to top |
|
 |
mqjeff |
Posted: Fri Jan 09, 2015 5:29 am Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
There's absolutely no need that any proigram should require that your XML data be sorted in that way. |
|
Back to top |
|
 |
Vitor |
Posted: Fri Jan 09, 2015 5:58 am Post subject: |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
mqjeff wrote: |
There's absolutely no need that any proigram should require that your XML data be sorted in that way. |
But you can write some ESQL that searches the InputRoot tree for the <Container> tag with the largest number of children and copies that to the OutputRoot, then the next highest, and so forth.
Which is exactly what the application consuming the XML should be doing if it does in fact need to process the data in that way. This is a daft thing to be doing in WMB and whoever gave you the task needs to be told that. _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
fjb_saper |
Posted: Fri Jan 09, 2015 6:36 am Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
School exercise to teach them about manipulation of the message tree???  _________________ MQ & Broker admin |
|
Back to top |
|
 |
mqjeff |
Posted: Fri Jan 09, 2015 6:48 am Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
fjb_saper wrote: |
School exercise to teach them about manipulation of the message tree???  |
Gosh, I sure hope their teacher doesn't read MQSeries.net looking for students trying to cheat!
 |
|
Back to top |
|
 |
|