Help | Site Map
Connecting Tech Pros Worldwide
 
 
LinkBack Thread Tools
  #1  
Old July 30th, 2006, 09:05 PM
Bob Heitzman
Guest
 
Posts: n/a
Default Need Help with INI app

I need to store data in, update, and read data from an XML file.

An INI structure worked fine:

[Zone 01]
a= 123
b= xyz
c= etc

[Zone 02]
.....

I've been look around the net and cannot find a simple comprehesive example
on how to convert this to VB.Net and System.Xml. Biggest problem is that the
sample files do not seem to be structure such that the data can be retrived
by "zone name" from the above example.

First issue is how do I structure the XML file to make updates and queries?

I'm working with this design currently:

<Zones>
<Zone Name="Zone 01">
<a>123</a>
<b>xyz</c>
<c>etc</c>
</Zone>
<Zone Name="Zone 02">
<a>2</a>
....
</Zones>

Is this a good layout for SIMPLE adds, updates and reading?

I'm really lost beyond the layout too - I'm thinking SelectNodes and
SelectSingleNodes is the way to go to get data out but I can't get any XPATH
strings to work with the above design.

Haven't a clue on adds and updates.

Should I be using a different design? I need to work with the data a "zone"
at a time, usually only one zone during a session.

Does anyone know of a good book/sample/white paper that addresses the above
application in VB?

Or perhaps this is simple enough a few examples of adds(new zones), updates,
and reads could be posted?

Thanks!
  #2  
Old August 1st, 2006, 04:55 PM
Bob Heitzman
Guest
 
Posts: n/a
Default RE: Need Help with INI app

So - I guess my impression of XML as a pathetic academic naval gazing
exercise is confirmed.

I have concluded that the reason I cannot find a god example on how to
replace an INI file with a XML file is because the tool is too weak.

I have always wonder about the strange example files used to demo/teach XML
in that they always seemed to be worthless as data records. Now I understand
the examples were designed to support what XML can do, which is very little
when it comes to storing data.

Amazing, all that "elegant" design and it can't even replace a simple INI
file.
"Bob Heitzman" wrote:
Quote:
I need to store data in, update, and read data from an XML file.
>
An INI structure worked fine:
>
[Zone 01]
a= 123
b= xyz
c= etc
>
[Zone 02]
....
>
I've been look around the net and cannot find a simple comprehesive example
on how to convert this to VB.Net and System.Xml. Biggest problem is that the
sample files do not seem to be structure such that the data can be retrived
by "zone name" from the above example.
>
First issue is how do I structure the XML file to make updates and queries?
>
I'm working with this design currently:
>
<Zones>
<Zone Name="Zone 01">
<a>123</a>
<b>xyz</c>
<c>etc</c>
</Zone>
<Zone Name="Zone 02">
<a>2</a>
...
</Zones>
>
Is this a good layout for SIMPLE adds, updates and reading?
>
I'm really lost beyond the layout too - I'm thinking SelectNodes and
SelectSingleNodes is the way to go to get data out but I can't get any XPATH
strings to work with the above design.
>
Haven't a clue on adds and updates.
>
Should I be using a different design? I need to work with the data a "zone"
at a time, usually only one zone during a session.
>
Does anyone know of a good book/sample/white paper that addresses the above
application in VB?
>
Or perhaps this is simple enough a few examples of adds(new zones), updates,
and reads could be posted?
>
Thanks!
  #3  
Old August 1st, 2006, 09:35 PM
Bob Heitzman
Guest
 
Posts: n/a
Default RE: Need Help with INI app

Figured out the soultion was to not use .Net SQL to work with records in a
XML formated data file. Used dataset instead. Using the dataset bound to a
DataGridView allowed for in place edit, adds, and deletes. Need a seed file
to get started (or go through the effort to expand solution to use schemas.

Imports System.IO
Public Class Form1
Dim ds As DataSet

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
ds = New DataSet
ds.ReadXml("C:\DevVS2005\XML_Test\XML_Test\XMLFile 1.xml")
dgv1.DataSource = ds
dgv1.DataMember = "Authors"
End Sub

Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button2.Click
ds.WriteXml("C:\DevVS2005\XML_Test\XML_Test\XMLFil e1.xml")
End Sub
End Class

Typical data:
<Authors_Table>
<authors>
<au_id>172-32-1176</au_id>
<au_lname>Blue</au_lname>
<au_fname>Johnson</au_fname>
<phone>408 496-7223</phone>
<address>10932 Bigge Rd.</address>
<city>Menlo Park</city>
<state>CA</state>
<zip>94025</zip>
<contract>true</contract>
</authors>
....
</Authors_Table>
 

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over network members.
Post your question now . . .
It's fast and it's free

Popular Articles