472,958 Members | 2,597 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,958 software developers and data experts.

Query data (SELECT * FROM table) from XML File

Hi all

On SQL Server tables I use SqlDataReader to query data
like "SELECT * FROM table".

Is there something similar for XML Files ?
I want to use SQL Syntax like "SELECT * FROM table" on
a XML file. After query I want to get something like SqlDataReader
based on Query to loop.
I do not want to use a DataSet. It should be more like streaming
and not loading the whole set into Memory.

Any ideas ?
Thanks for any comments.

Best regards
Frank
Jun 27 '08 #1
9 5115
On May 15, 11:00 am, Frank Uray <FrankU...@discussions.microsoft.com>
wrote:
On SQL Server tables I use SqlDataReader to query data
like "SELECT * FROM table".

Is there something similar for XML Files ?
I want to use SQL Syntax like "SELECT * FROM table" on
a XML file. After query I want to get something like SqlDataReader
based on Query to loop.
I do not want to use a DataSet. It should be more like streaming
and not loading the whole set into Memory.
If you use LINQ to XML you can use SQL-like syntax (though not SQL
itself) and get compile-time checking too.

I don't know if LINQ to XML supports streaming. This post:
http://blogs.msdn.com/xmlteam/archiv...ml-part-1.aspx
suggests that it doesn't, for input. You may be able to search for
some workarounds though.

Of course, using LINQ to XML to start with assumes you're able to
use .NET 3.5 - is that likely to be a problem for you?

Jon

Jun 27 '08 #2
On May 15, 11:11 am, "Jon Skeet [C# MVP] <sk...@pobox.com>"
<sk...@pobox.comwrote:

<snip>
I don't know if LINQ to XML supports streaming. This post: [...]
suggests that it doesn't, for input. You may be able to search for
some workarounds though.
One example:

http://mtaulty.com/CommunityServer/b...9/08/9803.aspx

Jon
Jun 27 '08 #3
You could use LINQ or XPath & XmlReader but I don’t think there is any SQL
over XML provider
--
Misbah Arefin
http://dotnethitman.spaces.live.com
http://www.linkedin.com/in/misbaharefin


"Frank Uray" <Fr*******@discussions.microsoft.comwrote in message
news:E3**********************************@microsof t.com...
Hi all

On SQL Server tables I use SqlDataReader to query data
like "SELECT * FROM table".

Is there something similar for XML Files ?
I want to use SQL Syntax like "SELECT * FROM table" on
a XML file. After query I want to get something like SqlDataReader
based on Query to loop.
I do not want to use a DataSet. It should be more like streaming
and not loading the whole set into Memory.

Any ideas ?
Thanks for any comments.

Best regards
Frank
Jun 27 '08 #4
Frank,

In C# there is not a Linq to XML solution, however what is wrong with the
dataset.

You get mostly an XML file in a dataset with

ds.readXML(path).

The dataset is a very optimized OO collection so I am very interested what
will be the problem?

Every other method will probably consume more memory and at least more
resources.

Cor

"Frank Uray" <Fr*******@discussions.microsoft.comschreef in bericht
news:E3**********************************@microsof t.com...
Hi all

On SQL Server tables I use SqlDataReader to query data
like "SELECT * FROM table".

Is there something similar for XML Files ?
I want to use SQL Syntax like "SELECT * FROM table" on
a XML file. After query I want to get something like SqlDataReader
based on Query to loop.
I do not want to use a DataSet. It should be more like streaming
and not loading the whole set into Memory.

Any ideas ?
Thanks for any comments.

Best regards
Frank

Jun 27 '08 #5
You get mostly an XML file in a dataset with
>
ds.readXML(path).

The dataset is a very optimized OO collection so I am very interested what
will be the problem?
Well, it doesn't work so well with huge volumes...
Every other method will probably consume more memory and at least more
resources.
Well, except XmlReader... I do have a streaming (yield iterator)
XmlReader in my toolkit, but it is quite lengthy and has some
limitations - for example it assumes that all the "fields" are direct
descendents (either elements or attributes) of the element you are
reading, and it takes no account of hierarchy (it just uses
MoveToFollowing to get the next candidate record). Maybe I'll write it
up some time and put it somewhere more public...

Marc
Jun 27 '08 #6
Hi Cor

Thanks for your answer.

I have a application that has online connection
to SQL Server (SqlDataReader ...).
In this application, as a SQL Engineer, I use SQL Syntax.

First is I want SQL Server to select subsets of data,
I dont want to load it all into local Application Memory.
But the real problem is, I want to change application to
be able to run in a offline modus using XML files.

If I would be able to somehow create SqlDataReader from
DataSet and/or XML File, I dont have to change a lot within
the application. Data Syncronizing would not be a big deal.

So, I guess there is no solution to do this and I
have to change the whole application to use DataSet.
Than I am able to use both, online and offline.

Thanks anyway
Frank
"Cor Ligthert [MVP]" wrote:
Frank,

In C# there is not a Linq to XML solution, however what is wrong with the
dataset.

You get mostly an XML file in a dataset with

ds.readXML(path).

The dataset is a very optimized OO collection so I am very interested what
will be the problem?

Every other method will probably consume more memory and at least more
resources.

Cor

"Frank Uray" <Fr*******@discussions.microsoft.comschreef in bericht
news:E3**********************************@microsof t.com...
Hi all

On SQL Server tables I use SqlDataReader to query data
like "SELECT * FROM table".

Is there something similar for XML Files ?
I want to use SQL Syntax like "SELECT * FROM table" on
a XML file. After query I want to get something like SqlDataReader
based on Query to loop.
I do not want to use a DataSet. It should be more like streaming
and not loading the whole set into Memory.

Any ideas ?
Thanks for any comments.

Best regards
Frank


Jun 27 '08 #7
For reference, you might be interested in sync framework:
http://msdn.microsoft.com/en-us/sync/default.aspx
(when it is released, at least...)

Marc
Jun 27 '08 #8
Marc,
Well, it doesn't work so well with huge volumes...
What are in your idea huge volumes, that is very subjective you know?

Cor
Jun 27 '08 #9
What are in your idea huge volumes, that is very subjective you know?

Oh absolutely! That is exacatly why I used a vague term like "huge".
Especially if we include some behemoths on x64 with tons of memory.
As we both know, it depends on too many factors to even go into - but
either way, a streaming API will scale effortlessly, where-as with an
in-memory answer we need to ask "how big"?

But I also agree that streaming APIs aren't necessarily the easiest
from an OO point of view, unless you are just doing aggregates etc.

Marc
Jun 27 '08 #10

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

Similar topics

0
by: B. Fongo | last post by:
I learned MySQL last year without putting it into action; that is why I face trouble in formulating my queries. Were it a test, then you would have passed it, because your queries did help me...
1
by: Rhanda Zak | last post by:
Hi all, my question is maybe so trivial, that I even could not find it in Google's NG seach, so I annoy you now: I simply want to copy the result of a SELECT query to another table which has...
2
by: John T Ingato | last post by:
If I run a query that calculates the sales data for all the inventory level in a table, how do I go about saving that sales data into a permanent table? I plan I using this sales data often, and...
2
by: kilo | last post by:
Hey.. I need someone hwo can help me making my sql table.. I have no php skills. I have payed for a php program that shoud make dictation for people that have some problems reading danish.. with...
12
by: Michel Esber | last post by:
Hello, Db2 Linux LUW FP 15. Consider table A (ID varchar, EXECUTION_DATE date). a) I want to first retrieve all IDs that have not executed during the last 90 days: select distinct ID...
4
by: MGM | last post by:
Hello everyone, I once again have a problem :p I need to write a query to get the total amount of rows in a table. Problem is, the table name is dynamic and part of its value is stored in...
9
by: a | last post by:
Dear friends I want import data from CSV file to mdb file How can I do that in vb.net?
1
by: rahullko05 | last post by:
Hi, i am building a small forum site as my final year project & stuck in a very trivial problem. I have a table which are varchar type of data & i am trying to fetch data from table based on...
5
by: tasawer | last post by:
I need some assistance with SQL query. I will be grateful if you can provide help please. I have a database that records details of a road traffic accident and name of driver. sub-form records...
0
by: lllomh | last post by:
Define the method first this.state = { buttonBackgroundColor: 'green', isBlinking: false, // A new status is added to identify whether the button is blinking or not } autoStart=()=>{
2
by: DJRhino | last post by:
Was curious if anyone else was having this same issue or not.... I was just Up/Down graded to windows 11 and now my access combo boxes are not acting right. With win 10 I could start typing...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 4 Oct 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
0
by: Aliciasmith | last post by:
In an age dominated by smartphones, having a mobile app for your business is no longer an option; it's a necessity. Whether you're a startup or an established enterprise, finding the right mobile app...
0
tracyyun
by: tracyyun | last post by:
Hello everyone, I have a question and would like some advice on network connectivity. I have one computer connected to my router via WiFi, but I have two other computers that I want to be able to...
3
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be using a very simple database which has Form (clsForm) & Report (clsReport) classes that simply handle making the calling Form invisible until the Form, or all...
3
by: nia12 | last post by:
Hi there, I am very new to Access so apologies if any of this is obvious/not clear. I am creating a data collection tool for health care employees to complete. It consists of a number of...
0
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be focusing on the Report (clsReport) class. This simply handles making the calling Form invisible until all of the Reports opened by it have been closed, when it...
0
isladogs
by: isladogs | last post by:
The next online meeting of the Access Europe User Group will be on Wednesday 6 Dec 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, Mike...

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.