473,378 Members | 1,343 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,378 software developers and data experts.

can anyone help me with this simple XML example?

hi there,

i am currently using the following code to generate an XML object, then save
it, then read the contents of the file - but i dont wanna save it, instead
read it directly after i;ve created the object.. see below:
------------------------------
Dim w As New XmlTextWriter(Server.MapPath(".") & "\suppliers.xml",
System.Text.Encoding.UTF8)
w.Formatting = Formatting.Indented
w.WriteStartDocument()
w.WriteStartElement("suppliers")

Dim ds As DataSet = MyFunction.GetSuppliers()
If ds.Tables(0).Rows.Count > 0 Then
For i As Integer = 0 To ds.Tables(0).Rows.Count - 1
w.WriteStartElement("ROW")
Dim dr As DataRow = ds.Tables(0).Rows(i)
w.WriteElementString("text", dr("supplier"))
w.WriteElementString("value", dr("supplierID"))
w.WriteEndElement()
Next
End If
w.WriteEndElement()
w.WriteEndDocument()
w.Flush()
w.Close()
w = Nothing
Dim xd As New XmlDocument
xd.Load(Server.MapPath(".") & "\suppliers.xml")

Response.Write(xd.OuterXml)
xd = Nothing
GC.Collect()
------------------------------
any help appreciated,
Paul
Nov 19 '05 #1
3 1250
never mine
"Milsnips" <mi******@hotmail.com> wrote in message
news:#E*************@TK2MSFTNGP12.phx.gbl...
hi there,

i am currently using the following code to generate an XML object, then save it, then read the contents of the file - but i dont wanna save it, instead
read it directly after i;ve created the object.. see below:
------------------------------
Dim w As New XmlTextWriter(Server.MapPath(".") & "\suppliers.xml",
System.Text.Encoding.UTF8)
w.Formatting = Formatting.Indented
w.WriteStartDocument()
w.WriteStartElement("suppliers")

Dim ds As DataSet = MyFunction.GetSuppliers()
If ds.Tables(0).Rows.Count > 0 Then
For i As Integer = 0 To ds.Tables(0).Rows.Count - 1
w.WriteStartElement("ROW")
Dim dr As DataRow = ds.Tables(0).Rows(i)
w.WriteElementString("text", dr("supplier"))
w.WriteElementString("value", dr("supplierID"))
w.WriteEndElement()
Next
End If
w.WriteEndElement()
w.WriteEndDocument()
w.Flush()
w.Close()
w = Nothing
Dim xd As New XmlDocument
xd.Load(Server.MapPath(".") & "\suppliers.xml")

Response.Write(xd.OuterXml)
xd = Nothing
GC.Collect()
------------------------------
any help appreciated,
Paul

Nov 19 '05 #2
Hi Milsnips:

Are you trying to do something like the following?
http://scottonwriting.net/sowblog/posts/361.aspx
P.S. Calling GC.Collect() is generally a bad idea.

--
Scott
http://www.OdeToCode.com/blogs/scott/

On Fri, 20 May 2005 14:00:54 +0200, "Milsnips" <mi******@hotmail.com>
wrote:
hi there,

i am currently using the following code to generate an XML object, then save
it, then read the contents of the file - but i dont wanna save it, instead
read it directly after i;ve created the object.. see below:
------------------------------
Dim w As New XmlTextWriter(Server.MapPath(".") & "\suppliers.xml",
System.Text.Encoding.UTF8)
w.Formatting = Formatting.Indented
w.WriteStartDocument()
w.WriteStartElement("suppliers")

Dim ds As DataSet = MyFunction.GetSuppliers()
If ds.Tables(0).Rows.Count > 0 Then
For i As Integer = 0 To ds.Tables(0).Rows.Count - 1
w.WriteStartElement("ROW")
Dim dr As DataRow = ds.Tables(0).Rows(i)
w.WriteElementString("text", dr("supplier"))
w.WriteElementString("value", dr("supplierID"))
w.WriteEndElement()
Next
End If
w.WriteEndElement()
w.WriteEndDocument()
w.Flush()
w.Close()
w = Nothing
Dim xd As New XmlDocument
xd.Load(Server.MapPath(".") & "\suppliers.xml")

Response.Write(xd.OuterXml)
xd = Nothing
GC.Collect()
------------------------------
any help appreciated,
Paul


Nov 19 '05 #3
yeah that looks like what i'm after:)) thanks!
"Scott Allen" <sc***@nospam.odetocode.com> wrote in message
news:3u********************************@4ax.com...
Hi Milsnips:

Are you trying to do something like the following?
http://scottonwriting.net/sowblog/posts/361.aspx
P.S. Calling GC.Collect() is generally a bad idea.

--
Scott
http://www.OdeToCode.com/blogs/scott/

On Fri, 20 May 2005 14:00:54 +0200, "Milsnips" <mi******@hotmail.com>
wrote:
hi there,

i am currently using the following code to generate an XML object, then saveit, then read the contents of the file - but i dont wanna save it, insteadread it directly after i;ve created the object.. see below:
------------------------------
Dim w As New XmlTextWriter(Server.MapPath(".") & "\suppliers.xml",
System.Text.Encoding.UTF8)
w.Formatting = Formatting.Indented
w.WriteStartDocument()
w.WriteStartElement("suppliers")

Dim ds As DataSet = MyFunction.GetSuppliers()
If ds.Tables(0).Rows.Count > 0 Then
For i As Integer = 0 To ds.Tables(0).Rows.Count - 1
w.WriteStartElement("ROW")
Dim dr As DataRow = ds.Tables(0).Rows(i)
w.WriteElementString("text", dr("supplier"))
w.WriteElementString("value", dr("supplierID"))
w.WriteEndElement()
Next
End If
w.WriteEndElement()
w.WriteEndDocument()
w.Flush()
w.Close()
w = Nothing
Dim xd As New XmlDocument
xd.Load(Server.MapPath(".") & "\suppliers.xml")

Response.Write(xd.OuterXml)
xd = Nothing
GC.Collect()
------------------------------
any help appreciated,
Paul

Nov 19 '05 #4

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

Similar topics

5
by: Michael Lawrence | last post by:
I am looking to start up a comprehensive Adult dating website and I need pre-made PHP scripts to set up the back-end for this project. Preferably someone out there has a set of pre-made scripts...
19
by: Leif K-Brooks | last post by:
Has anyone ever tried implementing a simple unstructured BASIC dialect in Python? I'm getting interested in language implementation, and looking at a reasonably simple example like that could be...
6
by: Danny Lesandrini | last post by:
I'm using an Access database to drive a web site and the colors of various table backgrounds are stored in Access. I want users of the Access database to be able to select colors for the site, but...
2
by: Brent Taylor via AccessMonster.com | last post by:
HELP----DOES ANYONE HAVE A SIMPLE .mdb for MLM structure? Does anyone have an example database for multi-level marketing for a 3 Tier setup? Thank you, brenttaylor@actionimports.net
3
by: wesley.hall | last post by:
Hello, I have worked with XML fairly extensively but have generally used DTDs to describe the structure of my documents. Recently I decided to try to pick up XML Schemas and have been following...
40
by: Jeff | last post by:
I have a system on a network and want to determine if anyone is currently connected to the back-end files. An interesting twist is that I have noticed that some users can be connected (have the...
4
by: cj | last post by:
My company just purchased SocketTools Visual Edition from Catalyst with the intent that I would use the included Socketwrench tool to create a server application to receive and respond to requests...
10
by: Extremest | last post by:
I know there are ways to make this a lot faster. Any newsreader does this in seconds. I don't know how they do it and I am very new to c#. If anyone knows a faster way please let me know. All...
7
by: Ivan Marsh | last post by:
Hey Folks, I'm having a heck of a time wrapping mind around AJAX. Anyone know of a simple, straight-forward example for pulling a simple query from mysql with PHP using AJAX? As I...
0
by: samadams_2006 | last post by:
I'm trying to get a simple VB.NET "Web Application" (not a regular application) to work with an Access Database. Seems simple enough, but I cannot seem to get it working. If anyone has a simple...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
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: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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...

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.