Wrox Programmer Forums
Go Back   Wrox Programmer Forums > XML > XML
|
XML General XML discussions.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the XML section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old January 7th, 2010, 12:44 AM
Registered User
 
Join Date: Jan 2010
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi............
Quote:
Originally Posted by samjudson View Post
Try something like this:
Thanks Sam Judson..
It worked..when i changed GetElementsByTagName to selectnodes it worked.
But what is the reason behind it..Why its not worked when i use GetElementsByTagName?

Code:
        doc1.Load("first.XML")
        doc2.Load("second.XML")
        Dim nodeList1 As XmlNodeList = doc1.SelectNodes("//SB/SBN")
        Dim nodeList2 As XmlNodeList = doc2.SelectNodes("//SB/SBN")

        Try
            For Each selectednode1 As XmlNode In nodeList1

                For Each selectednode2 As XmlNode In nodeList2
                    If selectednode1.InnerText = selectednode2.InnerText Then
                        Dim newNode As XmlNode = doc1.ImportNode(selectednode2.ParentNode, True)
                        doc1.SelectSingleNode("root").InsertAfter(newNode, selectednode1.ParentNode)
                    End If
                Next
            Next
        Catch ex As Exception
        End Try
It might not be exactly what you are after, but should give you some hints on how to go about doing things better.

Last edited by ammu86; January 7th, 2010 at 12:57 AM..
 
Old January 19th, 2010, 09:13 AM
Authorized User
 
Join Date: Jan 2010
Posts: 22
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to elizas
Smile XML file using vb.net

Hi,
I am a non-technical person, but i am also very keen in learning and sharing technology.Software developers of my company has designed various tips onn XML.Please visit those.

Hope it will be helpful.
__________________
Cheers,
Eliza

Mindfire: India's Only Company to be both Apple Premier & Microsoft Gold certified.





Similar Threads
Thread Thread Starter Forum Replies Last Post
VB.net, adding XML data to an existing XML file saikoboarder XML 11 April 17th, 2008 04:19 PM
XML DOM :modifying the existing nodes attributes i sharmasourabh54 XML 1 February 14th, 2005 05:04 AM
javascript - add element to existing xml? willgotoo XML 4 October 8th, 2004 09:33 AM
Add and Remove Nodes in XML document. tutul128 XML 3 March 1st, 2004 10:17 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.