3 Replies - 3023 Views - Last Post: 07 May 2009 - 02:16 PM Rate Topic: -----

#1 Califer  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 2
  • Joined: 05-May 09

Using an XML file as a database in C#

Post icon  Posted 05 May 2009 - 10:35 PM

So I'm starting to use XML and I'm trying to use it as a database of sorts. I've managed to save it off and read the whole thing in, but now the problem is that I want to be able to search through, get an item, and make it.

My current XML setup is below.

<?xml version="1.0" encoding="utf-8"?>
<Items>
<Object>
  <Index>10</Index>
  <Damage>4650</Damage>
</Object>
<Object>
   <Index>8</Index>
   <Damage>2940</Damage>
</Object>
<SecondObject>
   <Index>10</Index>
   <HP>0</HP>
   <Name>Some Dude</Name>
</SecondObject>
</Items>



So I'd like to be able to call for a "Object" of a certain index then use those details (both the index and the damage) to make an item.

I've tried a few different things but I wasn't able to get anything to work right. Any ideas?

Is This A Good Question/Topic? 0
  • +

Replies To: Using an XML file as a database in C#

#2 beatles1692  Icon User is offline

  • D.I.C Head

Reputation: 13
  • View blog
  • Posts: 62
  • Joined: 03-December 08

Re: Using an XML file as a database in C#

Posted 06 May 2009 - 03:09 AM

Hi
To search in a xml file you can use XPath through XmlDocument and XPathNavigator classes.

here is an article by microsoft
Was This Post Helpful? 0
  • +
  • -

#3 JackOfAllTrades  Icon User is offline

  • Saucy!
  • member icon

Reputation: 6110
  • View blog
  • Posts: 23,670
  • Joined: 23-August 08

Re: Using an XML file as a database in C#

Posted 06 May 2009 - 04:58 AM

XML and the DataSet
Was This Post Helpful? 0
  • +
  • -

#4 Califer  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 2
  • Joined: 05-May 09

Re: Using an XML file as a database in C#

Posted 07 May 2009 - 02:16 PM

I was able to get it working thanks to you guys :D

This post has been edited by Califer: 07 May 2009 - 02:16 PM

Was This Post Helpful? 0
  • +
  • -

Page 1 of 1