XSD.exe: Serialization/Deserialization and XSL

XSD.exe: Serialization/Deserialization and XSL

Post by Steve » Thu, 27 Sep 2001 08:20:24



I'm having some difficulty sifting through the .NET
classes to accomplish what I think is a relatively simple
task.  I have classes that were generated by XSD.exe.  I
use these classes to compose XML by setting properites of
the objects etc.  When it comes time to generate the XML
that these objects represent, I would like to use the
XmlSerializer.Serialize method but I would like to store
the output either in a String, or an output stream which I
can use later because I then need to perform an XSL
transformation on the XML.  There are plenty of examples
of doing XSL transformations with XML that is stored in
files, but in this case I have XML that is coming from
some XSD.exe classes.  Does anyone have some samples of
how to accomplish this task?  There are lots of
possibilities, but I can't quite get it right.  Do I need
to make an XmlDocument out of the output from the
Serialize method? etc. etc.

Thanks,
Steve

 
 
 

XSD.exe: Serialization/Deserialization and XSL

Post by Chris Lovet » Thu, 27 Sep 2001 18:00:06


Serialize into a System.IO.MemoryStream object, then you can load your
XmlDocument from that stream.  You may need to call Seek() on the memory
stream to reset it back to zero before loading the XmlDocument.


Quote:> I'm having some difficulty sifting through the .NET
> classes to accomplish what I think is a relatively simple
> task.  I have classes that were generated by XSD.exe.  I
> use these classes to compose XML by setting properites of
> the objects etc.  When it comes time to generate the XML
> that these objects represent, I would like to use the
> XmlSerializer.Serialize method but I would like to store
> the output either in a String, or an output stream which I
> can use later because I then need to perform an XSL
> transformation on the XML.  There are plenty of examples
> of doing XSL transformations with XML that is stored in
> files, but in this case I have XML that is coming from
> some XSD.exe classes.  Does anyone have some samples of
> how to accomplish this task?  There are lots of
> possibilities, but I can't quite get it right.  Do I need
> to make an XmlDocument out of the output from the
> Serialize method? etc. etc.

> Thanks,
> Steve