473,396 Members | 1,987 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

easily reading and using an XML-string

Hi,

I have an application that gets on a suden momenth a XML-string as parameter
(so NOT an XML-file or something like that!!). See it a little bit like a
user would type an XML-string in a Textbox.

This XML-string will be look like this: "<?xml
version="1.0"?><par><do>12345678901234</do><ca>1234567890123456</ca><c1>Mr.
Billing Billy</c1><c2>Miss. Janette
Jackson</c2><sc>TREC</sc><ch>Augmentation</ch></par>"

More structured it will be like this:
<?xml version="1.0"?>
<par>
<do>12345678901234</do>
<ca>1234567890123456</ca>
<c1>Mr. Billing Billy</c1>
<c2>Miss. Janette Jackson</c2>
<sc>TREC</sc>
<ch>Augmentation</ch>
</par>
So in my application I will have a string (strXML) which contains the whole
XML-string.

I want to be able to convert it to something, so I will be able to easily
check all the paramters in it. Something as easy accessibnle as a Collection
or a DataView or I don't know what. So I can do actions like: "strDossier =
colPar("do")" or "strDossier = dtvPar("do")" etc etc.

Does anybody knows how to do this? Is there a standard function for this? Or
should I need to write my own methods that read the string and put it into a
structure?

Thanks a lot in advance!

Pieter

Nov 20 '05 #1
1 1107
Thanks!! That works great!!

Pieter

"Jim Perry" <jp****@qssmeds.com> wrote in message
news:E2**********************************@microsof t.com...
Check out the XMLDocument class and the LoadXML method for loading the string:
Option Explicit
Option Strict

Imports System
Imports System.IO
Imports System.Xml

Public Class Sample

Public Shared Sub Main()
'Create the XmlDocument.
Dim doc As New XmlDocument()
doc.LoadXml(("<book genre='novel' ISBN='1-861001-57-5'>" & _
"<title>Pride And Prejudice</title>" & _
"</book>"))

'Save the document to a file.
doc.Save("data.xml")
End Sub 'Main
End Class 'Sample

You can then use the class's method for searching for specific nodes and

the info they contain.
Nov 20 '05 #2

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

Similar topics

1
by: Sunil Pathi | last post by:
Thanks in Advance I have a XML file which is read from a .aspx page. I need to read through all the elements, find the values of them and pass them on to the stored procedure which updates the...
4
by: Drew | last post by:
I'm reading in an XML file from the server using XmlTextReader in C# like so: XmlTextReader xr = new XmlTextReader(url); while(xr.Read()) { //parse the xml file here
1
by: adhag | last post by:
Hi I have an app that uses xpath to read an xml document. The problem is a 70meg file uses 1.5 gig of memory. What I really need is to read only chunks of the file at a given time and cannot...
4
by: PaulF | last post by:
How do I identify all of the namespace / prefix pairs associated with an XML document I am reading? Thanks for any help. Paul
6
by: cj | last post by:
I'm doing something wrong in the reading of this file. I think the rest will work but it keeps telling me something else is using the file. Nothing is. Any ideas? Private Sub...
1
by: Terry Olsen | last post by:
I download xml logs from several servers every day and read the data out of them using the XmlTextReader. But about 10% of them each day throw exceptions because they are not well formed. I don't...
4
by: ramyakrishnakumar | last post by:
Hi All, I am facing some problem with basic file operation... I have one xml file looks like <?xml version="1.0" encoding="UTF-8" standalone="no" ?> <x:recording> <udf3>Gélin</udf3> ...
5
blazedaces
by: blazedaces | last post by:
Ok, so you know my problem, java is running out of memory reading with SAX, the event-based xml parser intended more-so than DOM for extremely large files. I'll try to explain what I've been doing...
2
by: sachinwadi | last post by:
Hi, Sachin here. I have a problem with XML using with VB6.0. I Have a XML file of size nearly 129MB. I am reading the file using XML DOM object and the retrieved record i am inserting into...
2
by: Derik | last post by:
I've got a XML file I read using a file_get_contents and turn into a simpleXML node every time index.php loads. I suspect this is causing a noticeable lag in my page-execution time. (Or the...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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,...
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...
0
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,...

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.