Posted: Thu Oct 09, 2003 5:17 am Post subject: DETACH ELEMENTS?
Novice
Joined: 24 Jul 2003 Posts: 19
Hi,
How I can detach only the children <xxx>,<yyy> and attach or move it as last child under <cde> within the same parent <abc>.
I/P XML
Code:
<abc>
<xxx>21</xxx>
<yyy>22</yyy>
<cde>
<efg>
<* please do not use *>23</* please do not use *>
<aaa_vvv>25</aaa_vvv>
<bbb_yyy>26</bbb_yyy>
<ccc>27</ccc>
</efg>
</cde>
</abc>
O/P XML
Code:
<cde>
<efg>
<* please do not use *>23</* please do not use *>
<aaa_vvv>25</aaa_vvv>
<bbb_yyy>26</bbb_yyy>
<ccc>27</ccc>
</efg>
<abc>
<xxx>21</xxx>
<yyy>22</yyy>
</abc>
</cde>
Set OutputRoot.XML.cde.efg = InputRoot.XML.abc.cde.efg;
Set OutputRoot.XML.cde.abc.xxx = InputRoot.XML.abc.xxx;
Set OutputRoot.XML.cde.abc.yyy = InputRoot.XML.abc.yyy;
_________________ I am *not* the model of the modern major general.
Thanks for your reply.However I would like to navigate the children under <abc> anonymously since there might be be multiple children.
I have used the below code and not sure what I am doing wrong since there is nuttin written at output???
Set OutputRoot = InputRoot;
Code:
DECLARE outref REFERENCE TO OutputRoot.XML.abc.xxx;
WHILE LASTMOVE(outref)= TRUE DO
DETACH outref;
ATTACH outref TO OutputRoot.XML.cde.abc AS LASTCHILD;
MOVE outref NEXTSIBLING;
END WHILE;
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum