Hi all
I have a scenario, where I need to validate incoming XML against an XSD, and
deserialize it (if valid). This is going to happen quite often
(concurrently on a server), and I need to make it as effecient as possibly
(that is, not do anything obviously wrong/slow). The xsd is quite large, so
the validating operation is potentially timeconsuming (as is the
deserialization).
I understand that I should be able to
1) create an XmlSchemaSet
2) create an XmlReaderSettings (using the SchemaSet)
3) create an XmlReader (using the settings)
4) create an XmlSerializer
5) pass the XmlReader to the XmlSerializer.Deserialize method and have it
deserialize and validate at the same time.
Now, regarding concurrency and object reuse: The docs state, that the
XmlReaderSettings can be used to create several XmlReaders. Is that true,
even if they are created concurrently? Is an XmlSchemaSet and
XmlReader "stable" when used by multiple threads? In other words, can I do
something like:
at app startup: 1 + 2
in each thread (threads serve requests): intially 4, for each request 3 + 5
?
Can anyone tell from the docs, if that is safe? (I fear it is not, but I am
not completely sure).
Regards,
Mads
--
Med venlig hilsen/Regards
Systemudvikler/Systemsdeveloper cand.scient.dat, Ph.d., Mads Bondo
Dydensborg
Dansk BiblioteksCenter A/S, Tempovej 7-11, 2750 Ballerup, Tlf. +45 44 86 77
34