473,468 Members | 1,352 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Replace XMLNode

I have an XML file that will contain the data of a binary file in MIME
encoding. My application receiver the XML file with the location of the
binary file:

<REQUEST>
<IMPORT>
<DOCUMENT>
<FIELD>
<DATA>c:\myfile.dat</DATA>
</FIELD>
</DOCUMENT>
</IMPORT>
<REQUEST>

I have created code that replaces the DATA node with a new node. But the
problem is that the node does not contain the name <DATA>, it's empty:
<![CDATA[ mime data ]]>. That should be in between <DATA></DATA>.

Part of my code:

Dim xmld As XmlDocument
Dim nodelist As XmlNodeList
Dim node As XmlNode
xmld = New XmlDocument
xmld.Load(CmdArgs(1))
nodelist =
xmld.SelectNodes("/REQUEST/IMPORT/DOCUMENT/FIELD")
If node.Attributes.GetNamedItem("CODE").Value = "BASE64" Then
Dim Filename As String =
node.Item("DATA").InnerText()
If File.Exists(Filename) Then

Dim newElem As XmlNode
newElem =
xmld.CreateNode(XmlNodeType.CDATA, "DATA", "")
newElem.InnerText = "nieuwe data"

node.ReplaceChild(newElem,
node.Item("DATA"))
xmld.Save(CmdArgs(2))
End if

What is going wrong that I loose the <DATA></DATA>? I create a new node with
newElem = xmld.CreateNode(XmlNodeType.CDATA, "DATA", "")....
Nov 21 '05 #1
0 1291

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

Similar topics

1
by: Chi Tang | last post by:
Hi, Does anybody know where I can find samples to search an element in a subtree of an xml file and replace some new value for this element? I can only find some samples to use 'replace last...
3
by: Mahesh Devjibhai Dhola | last post by:
Hi All, I want to make a custom class in c#, which extends System.Xml.XmlNode class of BCL. Now in custom class, I have implement abstract methods of XmlNode class also. Now when I am trying to...
5
by: Paul | last post by:
Here I have the definition of an XmlNode which is a property (PayPreference) on my Customer class containing an enum describing how the customer will pay. <PayPerference...
1
by: andrej | last post by:
hi, ich habe eine anwendung, welche ein xml document erstellt. um festzustellen, ob ein element bereits vorhanden ist, verwende ich die funktion selectsinglenode( ....) diese funktion...
6
by: C# newbie | last post by:
Hello group, When I run an XPATH query first as: //*[contains(translate(.,\"ABCDEFGHIJKLMNOPQRSTUVWXYZ\", \"abcdefghijklmnopqrstuvwxyz\")
5
by: Mahesh Devjibhai Dhola | last post by:
Hi All, I want to make a custom class in c#, which extends System.Xml.XmlNode class of BCL. Now in custom class, I have implement abstract methods of XmlNode class also. Now when I am trying to...
2
by: Todd Price | last post by:
I'm trying to use XPath to get a handle on one specific node so that I can replace it with an xml fragment I've loaded from another file. So if I have this XML: <issue> <id>1</id>...
4
by: Derek Hart | last post by:
For testing purposes, I need some code that will loop through all attributes and elements in an XML file, and replace the data with the element or attribute name? Does anybody have code that will...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
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...
0
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,...
0
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...
0
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...

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.