Help | Site Map
Connecting Tech Pros Worldwide
 
 
LinkBack Thread Tools
  #1  
Old July 31st, 2006, 12:35 PM
David Jessee
Guest
 
Posts: n/a
Default Classes generated by XSD.exe

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?


  #2  
Old July 31st, 2006, 12:45 PM
dickster
Guest
 
Posts: n/a
Default Re: Classes generated by XSD.exe

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

  #3  
Old August 1st, 2006, 04:15 PM
John Saunders
Guest
 
Posts: n/a
Default Re: Classes generated by XSD.exe

"David Jessee" <DavidJessee@discussions.microsoft.comwrote in message
news:D1ABF838-AF0E-4B7A-AC75-958DFF78FC2B@microsoft.com...
Quote:
>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?
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


 

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over network members.
Post your question now . . .
It's fast and it's free

Popular Articles