470,615 Members | 2,105 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,615 developers. It's quick & easy.

XML file loaded and stored as cached dataset?

Have loaded balanced web servers that we do not allow to connect to our
database. Content is created and pushed to these sites. I want to add a web
service that may get multiple requests a second depending on peak access. I
have built an XML file from SQL DB and pushed this file to web server. I
want to load XML file at application startup and leave it cached if possible
(it will vary in size from 1-2MB) and treat it like an SQL table (rows &
columns) that I can filter on and send XML subset back to caller. Maybe I
should keep XML document loaded as XML Doc and pull my nodes/data from there
and send it out.

I'm concerned also about limitations caused by concurrent access to data.

regards,

doug
Mar 16 '07 #1
7 3210
Hi Doug,

Have you considered loading data from XML file as Dataset and caching it?
About how to load dataset from xml, you can reference.
http://msdn2.microsoft.com/en-us/library/fx29c3yd.aspx
[Loading a DataSet from XML]

If you use XML document rather than Dataset, I think you will lose many
useful features such as relationships, primary key, foreign key, and the
data type...
Additionally, It will become very difficult for you to get related rows.
You will lose the ability to know what type for each column. ..

Have a great weekend,
Sincerely,
Wen Yuan

Mar 16 '07 #2
I'll give it a try. Thanks. May take a few days to respond back.

doug

""WenYuan Wang"" wrote:
Hi Doug,

Have you considered loading data from XML file as Dataset and caching it?
About how to load dataset from xml, you can reference.
http://msdn2.microsoft.com/en-us/library/fx29c3yd.aspx
[Loading a DataSet from XML]

If you use XML document rather than Dataset, I think you will lose many
useful features such as relationships, primary key, foreign key, and the
data type...
Additionally, It will become very difficult for you to get related rows.
You will lose the ability to know what type for each column. ..

Have a great weekend,
Sincerely,
Wen Yuan

Mar 16 '07 #3
I have asked our web support group to verify thier standards are current.
Current standards state "absolutely NO View State" and Datasets should NOT be
used for web service or any high performance tasks. Is their another option?
Recall, no direct access to RDBMS, just a pre-built and staged XML file to
filter on to send XML packet response.

doug

""WenYuan Wang"" wrote:
Hi Doug,

Have you considered loading data from XML file as Dataset and caching it?
About how to load dataset from xml, you can reference.
http://msdn2.microsoft.com/en-us/library/fx29c3yd.aspx
[Loading a DataSet from XML]

If you use XML document rather than Dataset, I think you will lose many
useful features such as relationships, primary key, foreign key, and the
data type...
Additionally, It will become very difficult for you to get related rows.
You will lose the ability to know what type for each column. ..

Have a great weekend,
Sincerely,
Wen Yuan

Mar 20 '07 #4
Hi Doug,
Thanks for your reply.

As far as I know, we have four choices for your scenario.
(DataSet/DataTable, XMLDocument/ XmlReader, XMLDataDocument, XML
Serialization). DataSet is the way to represent data as relational view
and XMLDocument is another way to represent data as hieratical view.
Additionally, the XmlDataDocument class is derived from the XmlDocument
class, providing a hierarchical view of data as well as a relational view
by binding it to a DataSet. The primary purpose of XML serialization in the
..NET Framework is to enable the conversion of XML documents and streams to
common language runtime objects and vice versa.

In general, I would like to suggest you consider using DataSet/DataTable,
but it seems like your current standards restrict you from
DataSet/DataTable. However, now, the choices for us are
XMLDocument/XMLReader and XML serialization, as you said in initial post.
XMLTextReader is the fastest way to get the data via the pull-model XML
parsers.

I noticed there is a question very closed to your issue in WebQA article. I
highly recommend you may reference it.
http://msdn.microsoft.com/msdnmag/issues/02/12/webQA/
Q I'm looking for tips on getting the best performance from my use of the
System.Xml classes in an ASP.NET Web Service. Would I see a benefit from
long-term caching and reuse of System.Xml objects, like XmlDocument?

Additionally, you may meet an issue when using XmlDocument elements passed
to or returned from WebMethods. The following KB will tell the story for
you.
http://support.microsoft.com/kb/330600

Hope this helps. If you still have anything unclear, please feel free to
update here.
Have a great day,
Sincerely,
Wen Yuan

Mar 22 '07 #5
Wen Yuan,

Okay, got web service loading up XML file into dataset and I can send
dataset back to new XML document and return that as my result.

I have 5 layers on my XML. Users will want to select specific level 2 and
level 3 nodes plus child nodes 4 and 5, and parent 1. They will be passing
in an XML packet that has filter criteria level2='6' and level3='B'. I
assume I will load this into dataset also and use the two datasets maybe as a
join where node level values are equal?

How do I select rows from the dataset?

So far, not much code. Very clean. I am enjoying the project.

doug
""WenYuan Wang"" wrote:
Hi Doug,
Thanks for your reply.

As far as I know, we have four choices for your scenario.
(DataSet/DataTable, XMLDocument/ XmlReader, XMLDataDocument, XML
Serialization). DataSet is the way to represent data as relational view
and XMLDocument is another way to represent data as hieratical view.
Additionally, the XmlDataDocument class is derived from the XmlDocument
class, providing a hierarchical view of data as well as a relational view
by binding it to a DataSet. The primary purpose of XML serialization in the
.NET Framework is to enable the conversion of XML documents and streams to
common language runtime objects and vice versa.

In general, I would like to suggest you consider using DataSet/DataTable,
but it seems like your current standards restrict you from
DataSet/DataTable. However, now, the choices for us are
XMLDocument/XMLReader and XML serialization, as you said in initial post.
XMLTextReader is the fastest way to get the data via the pull-model XML
parsers.

I noticed there is a question very closed to your issue in WebQA article. I
highly recommend you may reference it.
http://msdn.microsoft.com/msdnmag/issues/02/12/webQA/
Q I'm looking for tips on getting the best performance from my use of the
System.Xml classes in an ASP.NET Web Service. Would I see a benefit from
long-term caching and reuse of System.Xml objects, like XmlDocument?

Additionally, you may meet an issue when using XmlDocument elements passed
to or returned from WebMethods. The following KB will tell the story for
you.
http://support.microsoft.com/kb/330600

Hope this helps. If you still have anything unclear, please feel free to
update here.
Have a great day,
Sincerely,
Wen Yuan

Mar 28 '07 #6
Hi Doug,
Thanks for your reply.

Dataset will load the xml file into datatables.
For each table, you can select the rows by the method DataTable.Select()
http://msdn2.microsoft.com/en-us/library/det4aw50.aspx
[DataTable.Select Method (String) ]

Additionally, get the rows( from Child/Parent table) related to your
selected rows.
DataRow.GetChildRows
http://msdn2.microsoft.com/en-US/library/hbt8xha8.aspx

DataRow.GetParentRows
http://msdn2.microsoft.com/en-us/library/7bssayw4.aspx

Hope this helps, please feel free to let me know if you still have anything
unclear. I'm glad to assist you.
Have a great day,
Sincerely,
Wen Yuan

Mar 29 '07 #7
This is kind of what I imagined, but hoped it would be simplier. Will give
it a try.

Thanks.

"WenYuan Wang [MSFT]" wrote:
Hi Doug,
Thanks for your reply.

Dataset will load the xml file into datatables.
For each table, you can select the rows by the method DataTable.Select()
http://msdn2.microsoft.com/en-us/library/det4aw50.aspx
[DataTable.Select Method (String) ]

Additionally, get the rows( from Child/Parent table) related to your
selected rows.
DataRow.GetChildRows
http://msdn2.microsoft.com/en-US/library/hbt8xha8.aspx

DataRow.GetParentRows
http://msdn2.microsoft.com/en-us/library/7bssayw4.aspx

Hope this helps, please feel free to let me know if you still have anything
unclear. I'm glad to assist you.
Have a great day,
Sincerely,
Wen Yuan

Mar 29 '07 #8

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

4 posts views Thread by DJTB | last post: by
4 posts views Thread by JASV | last post: by
2 posts views Thread by ALPO | last post: by
5 posts views Thread by Guadala Harry | last post: by
reply views Thread by Craig G | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.