all groups > dotnet xml > july 2006 >
You're in the

dotnet xml

group:

Classes generated by XSD.exe


Classes generated by XSD.exe David Jessee
7/31/2006 4:33:01 AM
dotnet xml:
I have a schema that I've used to generate a class structure vis the xsd.exe
utility. I'm having to manually validate the resultant XML since the
resultant document is not necessarily compliant with the structure defined by
the original XSD.

Here's what I'm wondering, though.....
I have a server process that is going to have to process these documents
rather quickly. At the end of the document, there are going to be attached
files (base64encoded). During this processing, there isn't any sense in
loading up the entire XML statement into a DOM document because I only ned
the first few nodes in order to determine what to do.

The logical choice: Use a SAX parser (XmlReader).

My original XSD defined a number of complex types that consisted of
sequences of elements. According to a strict interpretation of the schema
(which would help SAX parsing) those elements would have to occur in that
exact order. This would REALLY simplify parsing the document via SAX. I
don't see anything in the generateds class that indicates an element's
cardinality, though.

Can I assume that even though the original schema stated that a sequence of
elements must ccur in a specified order, that does not necessarily mean that
the XmlSerializer will honor that definition?
Is there a way to control this, or do I have to take the route of loading
the entire document into a XmlDocument (in memory) instead of just pulling
the information I need out of a stream?

Re: Classes generated by XSD.exe dickster
7/31/2006 4:48:20 AM
I believe the order of elements generated by the XSD.exe is based on
the order the public properties (or public variables) appear in the
class.

Dickster
Re: Classes generated by XSD.exe John Saunders
8/1/2006 11:26:25 AM
[quoted text, click to view]

I'm confused. What are you using the XmlSerializer for?

Also, if you're processing XML, why not just stick with XML and not play
with XSD.EXE-generated classes? Are your first few complextype elements that
complicated?

John

AddThis Social Bookmark Button