473,386 Members | 1,812 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

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

XmlValidatingReader memory behaviour

I need to validate a number of different XML documents against the same
schema, but the behaviour of XmlValidatingReader seems to make this very
expensive in memory terms.

We loaded about 150 XML files via XmlDocument.Load, which took around about
3Mb of allocations, but the XmlValidatingReader added another 69Mb of
allocations during Schema.Add

What would be nice is if you could create a validating reader and assign the
schema and then have it process multiple XML documents; currently the reader
has to be passed in via the constructor so you can't re-use the internal
schema set up that's expensive in memory terms.

Paul
Nov 12 '05 #1
2 966
You can add all your schemas to an XmlSchemaCollection and then re-use this
schema collection with multiple XmlValidatingReaders that are created over
your multiple XML documents. This will ensure that the schemas are compiled
only once.

Thanks,
Priya

"Paul Hatcher" <ph******@spamless.cix.co.uk> wrote in message
news:%2****************@TK2MSFTNGP12.phx.gbl...
I need to validate a number of different XML documents against the same
schema, but the behaviour of XmlValidatingReader seems to make this very
expensive in memory terms.

We loaded about 150 XML files via XmlDocument.Load, which took around about 3Mb of allocations, but the XmlValidatingReader added another 69Mb of
allocations during Schema.Add

What would be nice is if you could create a validating reader and assign the schema and then have it process multiple XML documents; currently the reader has to be passed in via the constructor so you can't re-use the internal
schema set up that's expensive in memory terms.

Paul

Nov 12 '05 #2
Priya

Thanks a lot for that - saved me a lot of hassle

Regards

Paul

"Priya Lakshminarayanan [MSFT]" <pr****@online.microsoft.com> wrote in
message news:42********@news.microsoft.com...
You can add all your schemas to an XmlSchemaCollection and then re-use
this
schema collection with multiple XmlValidatingReaders that are created over
your multiple XML documents. This will ensure that the schemas are
compiled
only once.

Thanks,
Priya

"Paul Hatcher" <ph******@spamless.cix.co.uk> wrote in message
news:%2****************@TK2MSFTNGP12.phx.gbl...
I need to validate a number of different XML documents against the same
schema, but the behaviour of XmlValidatingReader seems to make this very
expensive in memory terms.

We loaded about 150 XML files via XmlDocument.Load, which took around

about
3Mb of allocations, but the XmlValidatingReader added another 69Mb of
allocations during Schema.Add

What would be nice is if you could create a validating reader and assign

the
schema and then have it process multiple XML documents; currently the

reader
has to be passed in via the constructor so you can't re-use the internal
schema set up that's expensive in memory terms.

Paul


Nov 12 '05 #3

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

Similar topics

18
by: Vlad | last post by:
I have the following code: I have a local copy of the DTD that I need to validate incoming XML documents against. The XML document has the <!DOCTYPE myname SYSTEM "myfile.dtd"> define. When the...
4
by: Jesse Elve | last post by:
I am using an XmlValidatingReader which uses an XSD for xml validation. The code has been performing reliably for months. Yesterday it failed for the first time with the following exception: ...
1
by: Brecht Yperman | last post by:
Hi, I'm reading in an xml-file that has to be validated by it's dtd (code below). This works fine, except from some weird behaviour. <!ELEMENT STRUCT (FIELD+)> <!ATTLIST STRUCT sname CDATA...
0
by: Harold Putman | last post by:
The XmlValidatingReader seems to have changed drastically in .Net Frameworks 1.0 SP3 and beyond with regards to validating XML files that are XML Schemas. Consider the following code: ---...
9
by: jason | last post by:
how do you use the XmlValidatingReader to validate an XML document that is passed into the XmlValidatingReader constructor? it looks like the normal process is to use an underlying reader, as...
5
by: Geoff | last post by:
I am using an XMLValidatingReader to validate an XML file received via a web service. I want to verify that the incoming file matches the XML schema. When testing the validation routine, the...
1
by: Plop69 | last post by:
need some help on following: xml file 1 <TEST xmlns="http://test" > <OK>mlkddflmkj</OK> </TEST> xml file 2
12
by: Plop69 | last post by:
need some help on following: xml file 1 <TEST xmlns="http://test" > <OK>mlkddflmkj</OK> </TEST>
2
by: Phil Hobgen | last post by:
Hi, I am using the XmlValidatingReader Class in VS.Net 2003 (targeting dotNet v1.1) to validate an xml message against a set of schemas. Within the schema a type is defined as follows ...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.