Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / Compact Framework / January 2006

Tip: Looking for answers? Try searching our database.

XmlTextReader or XmlDocument or SQLCE

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Safae - 05 Jan 2006 12:10 GMT
Hi.

Im using DataSet.readXml/WriteXml for read/write data but is too slow
(the size of my XML file is between 200,500ko)
I want to use XMLTextWriter & Reader but i don't know if i can
manipulate Data easily(read element,update element...)
in My application I make a several calls to the XML file (update, read,
insert elements) and I must save changes in XML file after each call.in
this case what is the better and faster  way to read/write data :
XmlTexReader or XmlDocument or i must work with the SQL CE

sorry for my bad English and Thank you for all your help

Regards
Simon Hart - 05 Jan 2006 13:04 GMT
200-500 kilobytes? if so then using any XML class in CF will be dog slow
when XmlTextReader.

SQL CE will improve performance no-end. I find just reading an XML config
file in my app very slow and it is only around 300 bytes.

Cheers
Simon.

> Hi.
>
[quoted text clipped - 10 lines]
>
> Regards
Safae - 05 Jan 2006 19:00 GMT
Thanks for your help,

but if I reduce the size of my XML file to 150 ko,200ko, I will have
the same Problem? can I still work with XML file because SQl CE is not
appropriate to me ?

by using dataset functions the real problem is not in readxml function
but in WriteXML because I must after each change of data call this
function. that's mean if I update one record of dataset the function
WriteXMl rewrite all the file.  there is no possibility to save changes
in XML file by another way for example by XMLTextWriter?instead of
Dataset.writeXml?    

Regards
Ilya Tumanov [MS] - 05 Jan 2006 19:39 GMT
Actually, this "dog slow" idea is mostly from combination of unrealistic
expectations (e.g. my desktop with 3+GHz superscalar fully featured CPU with
2GB or extremely fast RAM does that in 1 seconds, why it takes 2 minutes on
puny 200 MHz RISC processor with slow 16 bit 32 MB RAM?), older hardware
(e.g. 100MHz PPC 2000), older versions of NETCF (V1 RTM instead of SP2+ or
V2) and improper ways of working with XML (e.g. using inference to load XML
into DataSet or using DOM to get a single value from a big file).

It is very possible to achieve adequate performance on relatively modern
hardware running NETCF V1 SP3 or V2.

With XmlTextReader it should take about a second to read 200K document node
by node.

DataSet.ReadXml() would load it in about 2-3 seconds assuming schema is
used.

This data is for NETCF V2 running in PXA 255@400 MHz on PPC 2003. It's about
twice as long for NETCF V1 SP3.

So, it should be OK to use DataSet.ReadXml() with 200-500K XML.

Just make sure:

- You're using schema (typed DataSet, created programmatically, loaded from
separate file or embedded into the XML).

- Avoid using DateTime fields as they are very slow to parse.

- Use related tables instead of nested tables.

As to saving XML file after each change, simply don't do that. Imagine Word
would save each time you type one character, now that would be terrible.

DataSet is especially designed so you don't have to do that. It cashes data
in memory so you can access and change it as needed and persist it from time
to time.

Save it only on user request, on timer or if your application closes.

And no, there's no way to update part of XML with any class, it can only be
rewritten as a whole.

This is indeed a big disadvantage of XML compared to even comma separated
file; you can at least add records to it which is not possible with XML.

Best regards,

Ilya

This posting is provided "AS IS" with no warranties, and confers no rights.

*** Want to find answers instantly? Here's how... ***

1. Go to
http://groups-beta.google.com/group/microsoft.public.dotnet.framework.compactfra
mework?hl=en

2. Type your question in the text box near "Search this group" button.
3. Hit "Search this group" button.
4. Read answer(s).

> Thanks for your help,
>
[quoted text clipped - 10 lines]
>
> Regards
Simon Hart - 05 Jan 2006 20:11 GMT
I wouldn't really call it "unrealistic expectations", I would call it
experience, and testing. I would love to see a 1 second response time
reading a single node from a 200k XML file on any version of CF running on
any processor.

It's really a no brainer, why give yourself so much work when a tool such as
SQL CE does it (and does it a lot better - with more options) without having
to do hardly any work.

> Actually, this "dog slow" idea is mostly from combination of unrealistic
> expectations (e.g. my desktop with 3+GHz superscalar fully featured CPU
[quoted text clipped - 73 lines]
>>
>> Regards
Safae - 09 Jan 2006 14:54 GMT
Thanks for your help.

I'm trying to test both of solutions :Dataset and SQL ce.
about Dataset: I have installed SP2 and load a schema from seperate
file xsd and Im not using DateTimeFields, so Dataset.readXML takes 7s
instead of 28s for reading xml file with 200 Ko. but I dont understand
how can I Use related tables instead of nested tables.
I have one table who has a child table. Should I add PrimaryKey and
foreing Key for those tables in the xsd file ? I have tried to do this
but it generate an exception.
I have already read an utility who reformat The Xml file buy modifing
DataColumn.ColumnMapping to MappingType.Attribute.
what should I do for using related table?

Best Regards
Ilya Tumanov [MS] - 10 Jan 2006 19:36 GMT
You should consider having primary key/foreign keys in any case; it's a must
for any DB.

As to relations, you can change relation type from nested to related in
schema editor.

Also, I've posted source code for utility which does that a while ago.
Should be easy to find using link below.

Best regards,

Ilya

This posting is provided "AS IS" with no warranties, and confers no rights.

*** Want to find answers instantly? Here's how... ***

1. Go to
http://groups-beta.google.com/group/microsoft.public.dotnet.framework.compactfra
mework?hl=en

2. Type your question in the text box near "Search this group" button.
3. Hit "Search this group" button.
4. Read answer(s).

> Thanks for your help.
>
[quoted text clipped - 11 lines]
>
> Best Regards

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.