# Moving xml nodes up/down

**URL:** <https://forum.kirupa.com/t/moving-xml-nodes-up-down/322170>\
**Category:** Uncategorized\
**Created:** [May 12, 2011, 8:17pm UTC](https://forum.kirupa.com/t/moving-xml-nodes-up-down/322170 "2011-05-12T20:17:05Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![omnivibe](https://avatars.discourse-cdn.com/v4/letter/o/dbc845/32.png) [@omnivibe](https://forum.kirupa.com/u/omnivibe)\
**Post date:** [May 12, 2011, 8:17pm UTC](https://forum.kirupa.com/t/moving-xml-nodes-up-down/322170/1 "2011-05-12T20:17:05Z")

</div>

I’ve been trying forever to get this to work…

Given a dynamically generated complex XML, and a variable myNode which points to a specific node in the XML, is there any way to move it up or down underneath it’s parent?

I’ve tried all sorts of combinations…

The following is basically a “gotcha” for me:

\<xml\>  
\<parent\>  
\<child\>1\</child\>  
\</parent\>  
\<parent\>  
\<child\>2\</child\>  
\<child\>3\</child\>  
\</parent\>  
\</xml\>

When I try to grab parent() from any of the children, it returns null…

Anyway- help is appreciated. Thanks!
