Web Wiz - Green Windows Web Hosting

  New Posts New Posts RSS Feed - Confusion in XML
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Confusion in XML

 Post Reply Post Reply Page  <1234 7>
Author
dpyers View Drop Down
Senior Member
Senior Member


Joined: 12 May 2003
Status: Offline
Points: 3937
Post Options Post Options   Thanks (0) Thanks(0)   Quote dpyers Quote  Post ReplyReply Direct Link To This Post Posted: 06 November 2003 at 9:30pm

MorningZ...

Nice piece of code


Lead me not into temptation... I know the short cut, follow me.
Back to Top
MorningZ View Drop Down
Senior Member
Senior Member
Avatar

Joined: 06 May 2002
Location: United States
Status: Offline
Points: 1793
Post Options Post Options   Thanks (0) Thanks(0)   Quote MorningZ Quote  Post ReplyReply Direct Link To This Post Posted: 07 November 2003 at 5:02am

thanks..

it could be a little cleaner/less-lines-of-code than it is.. but i wrote that last year when i was just starting to mess around with .NET code.....

Contribute to the working anarchy we fondly call the Internet
Back to Top
Diep-Vriezer View Drop Down
Senior Member
Senior Member
Avatar

Joined: 06 August 2003
Location: Netherlands
Status: Offline
Points: 831
Post Options Post Options   Thanks (0) Thanks(0)   Quote Diep-Vriezer Quote  Post ReplyReply Direct Link To This Post Posted: 23 November 2003 at 3:25pm
One tiny little more thing > Updating. A config file hasn't got much use if you can't update it, and I was wondering if there was any way of doing so.
Gone..
Back to Top
Mart View Drop Down
Senior Member
Senior Member
Avatar

Joined: 30 November 2002
Status: Offline
Points: 2304
Post Options Post Options   Thanks (0) Thanks(0)   Quote Mart Quote  Post ReplyReply Direct Link To This Post Posted: 24 November 2003 at 9:53am
You could select the element using xpath, save all the data to a variable or something then append the element with the old data and the changed variable.
Back to Top
MorningZ View Drop Down
Senior Member
Senior Member
Avatar

Joined: 06 May 2002
Location: United States
Status: Offline
Points: 1793
Post Options Post Options   Thanks (0) Thanks(0)   Quote MorningZ Quote  Post ReplyReply Direct Link To This Post Posted: 24 November 2003 at 10:03am

i think people are losing fact that XML used to store data, such as in config file, shouldn't be treated as a text file, but rather as a representation of data...

you can add/remove/update items/parameters/nodes/whatever just like you were updating records in a database, its just a matter of coding syntax....

but for sure one's gotta start with getting out of the "text file/File System Object" thinking

Contribute to the working anarchy we fondly call the Internet
Back to Top
Diep-Vriezer View Drop Down
Senior Member
Senior Member
Avatar

Joined: 06 August 2003
Location: Netherlands
Status: Offline
Points: 831
Post Options Post Options   Thanks (0) Thanks(0)   Quote Diep-Vriezer Quote  Post ReplyReply Direct Link To This Post Posted: 24 November 2003 at 12:53pm
So how should you think..  If you see XML as a database, which is somesort of is, it's still very new to me, so I'll download some e-book about it.
Gone..
Back to Top
MorningZ View Drop Down
Senior Member
Senior Member
Avatar

Joined: 06 May 2002
Location: United States
Status: Offline
Points: 1793
Post Options Post Options   Thanks (0) Thanks(0)   Quote MorningZ Quote  Post ReplyReply Direct Link To This Post Posted: 24 November 2003 at 1:36pm

There is no difference between going to the database and filling a DataSet, like:
Dim objConn As new OleDBConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\db\this.mdb")
Dim objCmd As new OleDbDataAdapter("SELECT * FROM SITE_Config", objConn)
Dim ds As DataSet = new DataSet()
objCmd.Fill(ds,"tblUsers")

or using the "LoadXML" method to fill a DataSet, like:
Dim dsImageInfo as New DataSet()
dsImageInfo.ReadXml( CheckForXMLFile() )

once its in the DataSet, you can manipulate, go through and find, change, add data just like any record set (this article shows some syntax in the "Building a DataTable Programmatically" section), and at the end, there is a "WriteXML" method to resave the file

Contribute to the working anarchy we fondly call the Internet
Back to Top
Diep-Vriezer View Drop Down
Senior Member
Senior Member
Avatar

Joined: 06 August 2003
Location: Netherlands
Status: Offline
Points: 831
Post Options Post Options   Thanks (0) Thanks(0)   Quote Diep-Vriezer Quote  Post ReplyReply Direct Link To This Post Posted: 25 November 2003 at 5:17am
I know, but I'm not really into datasets.
Gone..
Back to Top
 Post Reply Post Reply Page  <1234 7>

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.08
Copyright ©2001-2026 Web Wiz Ltd.


Become a Fan on Facebook Follow us on X Connect with us on LinkedIn Web Wiz Blogs
About Web Wiz | Contact Web Wiz | Terms & Conditions | Cookies | Privacy Notice

Web Wiz is the trading name of Web Wiz Ltd. Company registration No. 05977755. Registered in England and Wales.
Registered office: Web Wiz Ltd, Unit 18, The Glenmore Centre, Fancy Road, Poole, Dorset, BH12 4FB, UK.

Prices exclude VAT at 20% unless otherwise stated. VAT No. GB988999105 - $, € prices shown as a guideline only.

Copyright ©2001-2026 Web Wiz Ltd. All rights reserved.