473,769 Members | 5,205 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Move node?

Hi,

I have a xml file like this:

<?xml version="1.0"?>
<home>
<page name="Test1" id="1">
<page name="Pagetest1 " id="2" src="test1.htm" ></page>
<page name="pagetest3 " id="3" src="test2.htm" ></page>
</page>
<page name="Test2" id="4" src="test1.htm" >
<page name="Test23" id="7" src="test1.htm" >
<page name="pagetest1 " id="10" src="test1.htm" ></page>
</page>
<page name="Pagetest1 " id="5" src="test1.htm" ></page>
<page name="pagetest2 " id="6" src="test1.htm" ></page>
</page>
</home>

and i am trying to move up a node for instance node with id="6" or node
id="4", id="10" cant be moved up only able to move between the same levels.
(c#) (i also want to move nodes one step down when pressing another button)

i was trying somethign like:
singlenode = mdoc.selectsing lenode(xpath);

singleNode.Pare ntNode.InsertBe fore(singleNode , singleNode);
Patrick
Jun 29 '06 #1
1 1604


Patrick wrote:

singleNode.Pare ntNode.InsertBe fore(singleNode , singleNode);


Use
singleNode.Pare ntNode.InsertBe fore(singleNode ,
singleNode.Prev iousSibling)
and
singleNode.Pare ntNode.InsertAf ter(singleNode, singleNode.Next Sibling)
for the other direction
--

Martin Honnen --- MVP XML
http://JavaScript.FAQTs.com/
Jun 29 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
2105
by: \(¯`·.¸FlacK¸.·´¯\) | last post by:
Hi! I want to move a node from file "film1" to "film2" that has tag "FilmatoPartita". I have write the codo below, but it don't do anything...I don't see the error... I have forgotten something? Maybe samething to write in the file "film2"? Help...it's urgent..thanks!!!
0
1183
by: Ryan Liu | last post by:
After a tree node is clicked in a treeview, I'd like to move the focus to a rich text box(call it rt) next to it. How I can I do it? I tried to call rt.focus() in afterSelect, MouseUp ..etc event, none of them works, it keep the focus on the tree node. Thanks a lot in advance!
2
1859
by: vijay | last post by:
Hi, Can we do something like we select nodes from one tree and when we press a button like "Add" It will move that node with its parent node to the tree to the right? Is this possible in Javascript. If so any pointers..Also similarly we can remove items on the right tree. That should remove node from right tree and add to left tree.. If this is not easy in Javascript. Any pointers to a JSP solution.
1
1831
by: beachboy | last post by:
How I can Move up or down XmlElement? Please advise. Thanks in advanced.
2
2155
by: beachboy | last post by:
How I can Move up or down XmlElement? Please advise. Thanks in advanced.
0
1593
by: K B | last post by:
Hi again, I have a treeview, I would like to select a node, then click on an up or down button and move the node accordingly, updating the xmlDocument each time. For example, if I select a 2nd level element I want to move that up/down in that sibling node set...important that I move all the children, if any, as well. Could someone point me to a good reference? (Not drag and drop).
35
3047
by: Frederick Gotham | last post by:
(Before I begin, please don't suggest to me to use "std::vector" rather than actual arrays.) I understand that an object can have resources (e.g. dynamically allocated memory), and so we have to copy an object properly via copy- construction rather than using memcpy. However, is it okay to move an object manually (i.e. by using memcpy or memmove)?
1
1984
by: rampm2007 | last post by:
Hi, I am using the XmlTextReader along XmlValidatingReader for parsing the XML file. Becuase of the foreign characters sometimes I get the "There is an invalid character in the given encoding" error. I know this is the issue of Encoding and when I change the Encoding, my Parser works just fine. For reading & moving to next node, I use Read method of XmlValidatingReader. What I am trying is in case if error occurs how can I ignore or handle...
3
9883
by: John Rogers | last post by:
How do you move a selected node up or down a treeview? Not by drag and drop but by clicking a button to move the node up or down. I tried the following, but my tree gets all messed up after I move the first node. TreeNode sourceNode = treeView.SelectedNode; if (sourceNode.Parent == null)
0
9589
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9423
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10222
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9866
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8876
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6675
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5310
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5448
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
2815
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.