473,811 Members | 4,039 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Problems with read XML

Hello,

i write a xml file with following code:

Dim xWriter As New XmlTextWriter(S aveFileContent. FileName, _
Encoding.UTF8)

With xWriter

.Formatting = Formatting.Inde nted
.Indentation = 4
.WriteStartDocu ment()
.WriteComment(" RootNote")

.WriteStartElem ent("article")

.WriteStartElem ent("headline")
.WriteString(tx tHead.Text)
.WriteEndElemen t()

.WriteString("l inks")
.WriteString(tx tLinks.Text)
.WriteEndElemen t()

.WriteStartElem ent("content")
.WriteString(Ax DHTMLEdit1.DOM. body.innerHTML)
.WriteEndElemen t()

.WriteEndElemen t()

.WriteEndDocume nt()
.Close()

End With

It works great. Now the Problem. If i want to read this created XML
File and one of the nodes are emtpy than i cant read the rest. Here is
the code to read:

Dim xml As New XmlDocument
xml.Load(OpenFi leContent.FileN ame)

txtHead.Text = _
xml.DocumentEle ment.ChildNodes (0).ChildNodes( 0).Value

txtLinks.Text = _
xml.DocumentEle ment.ChildNodes (1).ChildNodes( 0).Value

AxDHTMLEdit1.DO M.body.innerHTM L = _
xml.DocumentEle ment.ChildNodes (2).ChildNodes( 0).Value

What is the best way to write and read simple XML Files
with only three nodes to save program content or save
program settings (like ini file).

Greetings
René

Nov 20 '05 #1
1 1148
Cor
Hi René

I don't think there is a best way.

When you have only 3 elements in a XML file with only 3 values, do it the
way that is the most simple for you. When I see your code (I never used it
that way but what I understand from it) I just would write the empty
elements with empty values.

When you want to do it without it, I think that in your example the best way
could be searching (reading) for the text element, the next value item in
the read is then your value.

But it there are so much posibilities,
Take what you fits the best with your 3 element XML file.

I hope this helps a little bit.

Cor
Nov 20 '05 #2

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

Similar topics

6
1939
by: Sara Khalatbari | last post by:
Dear friends In a code, I'm opening a file to read. Like : lines = open(filename).readlines() & I'm never closing it. I'm not writing in that file, I just read it. Will it cause any problems if you open a file to read & never close it?
0
1392
by: yukon | last post by:
Hi there the next is my platform IIS5 windows 2000 asp vbscript My working area has the next virtual directoy: testAc (corrective ambient) testAe (evolutionary ambient)
2
17420
by: jfixsen | last post by:
Hello! Oracle 9.2.0.4 SunOS pchi-db01 5.8 Generic_108528-19 sun4u sparc SUNW,Ultra-EnterpriseSystem = SunOS Node = pchi-db01 Release = 5.8 KernelID = Generic_108528-19 Machine = sun4u BusType = <unknown>
13
3262
by: nick4soup | last post by:
General advice wanted: Some web sites (including two large companies in Australia) get themselves awfully confused if the user presses the BACK button in their browser (and possibly the forward button). They are using ASP (or some other active script), but I presume it's possible to make the same mistakes in CGI, or PHP, for instance. Questions:
0
1471
by: Robert Björn | last post by:
I'm trying to process a MemoryStream of XML data, which at any point in time may have incomplete fragments (because data arrives from a socket). If I process data until XmlTextReader.Read() returns false, fills it with more data, and reverses the position of the underlying MemoryStream, the XmlTextReader immediately stops working. I apparently have to re-create the XmlTextReader instance when I make changes to the MemoryStream.
6
3306
by: George McLean | last post by:
Hello, I am trying to isolate some performance issues. The database is DB2 v8.1 running on a Win2000 server with 4 processors and 1gb of RAM. The application is a GIS application that uses ADO to access the database. It was not written specifically for DB2 and I think almost all queries are running as dynamic queries. The performance issue arise when users are
0
2992
by: Sherif ElMetainy | last post by:
Hello I am making an application that generates source code. I am facing some problems. 1- How can I generate code that uses the c# 'params' keyword to specify multiple arguments? I tried 2 ways method.Parameters.Add(new CodeParameterDeclarationExpression("params object", name));
4
1746
by: JC - home | last post by:
Hello.. I've been having some problems for a little while with this which I was sure I would beat...hmmm. Anyway, I have a form with two rich textboxes. One at the top which is to display a concatenated summary, and one at the botton for making a new entry. When items are added in from the bottom box, I do this via a class
2
5395
by: goodnamesalltaken | last post by:
Hello fellow python users, I've been working on a basic implementation of a privilege separated web server, and I've goto the point of running a basic cgi script. Basically when the execCGI function in my Unpriv.py program is called a few things should happen, it should fork (which it does), the stdout of the child should be redirected to a given pipe (which it does), and the script should execute using execve(which is has problems...
2
3279
by: Mike | last post by:
Hi, I am new to C and having problems with the following program. Basically I am trying to read some files, loading data structures into memory for latter searching. I am trying to use structres and arrays of pointers to them. I have gotten the program to compile with gcc on WinXP. If the file i read doesnt have alot of records, it runs thru. But once i add more, it dies. In this program i have 4 files setup to read. The
0
9724
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
9604
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
10379
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10394
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10127
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
9201
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...
1
7665
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
1
4336
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
3015
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.