dataset navigation in xml file

yaniv

Well-known member
Joined
Apr 15, 2002
Messages
162
Location
israel
can you navigate in xml file that use as source to dataset, like you do in a database via dataadatptor?

e.g.
k now the readxml command that just pull the file to the dataset, but you make a wuery to the xml file (select something from the xml?), can you do just update to the file or you have to create new one or overwrite the source by writexml command?

with thanks
yaniv
 
If I understand your question, you want to read an XML file from disk into a DataSet object, update the data then write it back out as XML? Or do you want to query the XML using XML syntax but still do everything else using a DataSet? Im a bit confused.

Assuming youve read the file in using a DataSet, you can modify the data using the DataSet or XML. Youll have to attach an XmlDataDocument object to the DataSet and then you can use standard XPath to navigate the XmlDataDocument (which will automatically update the DataSet). Saving the XML back to disk is probably easiest with the DataSet if you read it in that way.

If I misunderstood, maybe you could rephrase your question or keep the typos down to 10 or so. :p

-Nerseus
 
Sorry to confuse, what i want is to read xml file to dataset, change it and keep the changes. as much as i tryed i understood that what i do is to copy the xml to dataset, change it in the dataset and the rewrite the entire file. its look to me as a waste so what i trying to figure is two things:

1) can you copy to the dataset from the xml only the data that you want to view and change (like only one table or so)?
2) are there is something like the dataadaptor.update that only updates te changed data in the xml file?


thanks...
 
Youre stuck updating the whole file. Unless you were to read and write the file yourself, which would get ugly fast, youll have to work with the file as a whole.

If you were to talk to a database and not an XML file (which is, essentially, your database), then the database engine would be updating those parts of the file for you.

Is the XML file so large that you dont want to update it every time? Even at 10 or 20 meg, an XML file "save" should go fast.

-Nerseus
 
Well, as much as i think about it the problem is not the xml, but the dataset it self, lets say i have large (2000 records) customers table, and each one purchased 5 items (10000 records "order" table). do i realy have to read 12000 record and rewrite them to change the adress of one man?

yaniv
 
If youre storing the "database" as one large XML file then yes, youll have to read it and write it as one file - even if you only want to change one little piece. You could always break the XML files down into smaller chunks. For instance, store anyone with a last name that starts with "a" in the file "a.xml".

But, it sounds like youll be better off using a real database. Why not use something like Access, MSDE, MySQL, etc.? Youve already written code to use DataSets so youre more than halfway there :)

-Nerseus
 
Well, i thought that xml will be better to use for easiar internet connection.
What i trying to do is to create a large "card indexing" software that will be updated from several users.
for exemple:

you choose subject to the card index (lets say "v.b") then a lot of members create the subjects of each card ("subject", "defination", "exeples" etc...)
and all together making update to one large file in the web.

for this kind of work i thought xml will be better. dont you think so?
 
Im not sure what you mean by "easier internet connection". Are you intending this to be used by people using a web browser application? Where do you envision the main XML file being stored: on a server somewhere or an indiviual file on every persons machine?

Assuming the common scenario of hosting the file/database on a web server, you could just as easily host a database as an XML file. If youre using web methods or even pure ASP (or whatever server-side language), youll be returning XML to the client (or you probably should). You could return one row, a few rows, or all the rows as a block of XML.

I cant really offer anything more specific without knowing more about the app and what you want it to do. Im not sure what "members" are - database records or actual users of your application? Is the subject of your card index going to return multiple rows or just one row? Anyway, if you need help, ask away :)

-Nerseus
 
The members is the app. users, they are students in some educational institutions, that learn the same, complicated subject. in there study they all go over "subjects" that mantioned in thousands of books, my goal is to make a web site that contain a large index to this subject (like: you type the subject and get the defination from all the places that he is mentioned) since the work is too large for one group to do, i want to create the app. on the web, to let any student to download it, make in is own update and once a month to update the main file, that sits on the web (the server).

I do know how to build it in database (mainly access) but i dont know how to create the comunication to the web. In the .NET documentation, however, i got the feeling that the best way will be to use xml, but i think that it is wrong to ask the members to download the entire xml file every month to update!!

thanks for reading to far!!!:)
yaniv
 
This seems like a fairly decent sized project. I think you may want to study up on WebServices and what they can and should do first...

Having said that, you may want to store things as a database and return the relevent information as XML to each user. Im not sure how much data they would need, youd have to answer that. If they just need the "lookup" values so they can insert new records, then no problem - just return them and have them create records locally. They can upload their additions however and whenever you see fit.

If you have any specific questions once youve got a basic design down, Id be happy to help.

-Ner
 
Back
Top