Re: Serialize a class adding a stylesheet
- From: "Kevin Spencer" <kevin@xxxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Wed, 16 Nov 2005 09:04:30 -0500
I can give it another shot. First, if you serialize a class, the class name
element is going to be the root element of the serialized class. Now, you
can certainly create an XML file from the class, but if you want the
style*** to appear before the class element, it can not be a member of the
class, but would have to be inserted into the XML file. What exactly is the
requirement you are trying to fulfill here? Because if serializing a class
is the requirement, you're barking up the wrong tree. But if creating an XML
document from a serialized class is your goal, that is certainly doable. The
XML document will not *be* the serialized class, but may *contain* the
serialized class.
--
HTH,
Kevin Spencer
Microsoft MVP
..Net Developer
If you push something hard enough,
it will fall over.
- Fudd's First Law of Opposition
"Pazza" <Pazza@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:2D8C553C-016D-4795-8A01-18406D9B45FA@xxxxxxxxxxxxxxxx
> Help!!, is there anyone out there who can help with this please.
>
> "Pazza" wrote:
>
>> Kevin,
>>
>> Thanks for your reply.
>>
>> I created a schema and generated the class using xsd.exe.
>> I then created an instance of the class and serialized it out to a file.
>> The result was the following:
>>
>> <?xml version="1.0" encoding="utf-8"?>
>> <className xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>> xmlns:xsd="http://www.w3.org/2001/XMLSchema">
>> <stylesheet type="text/xsl" href="stylesheets/abc.xsl" />
>> <Header>
>> etc
>> etc
>>
>> I have two problems with this ...
>> (1) The <style***> element is not formed properly ie. it is missing the
>> ?
>> from the start and end. And
>> (2) I want the <style***> element to appear before the root elment
>> <className>.
>>
>> Can you offer any advice on how to correct (1) and how to achive (2)
>> please?
>>
>> Pazza
>> "Kevin Spencer" wrote:
>>
>> > If you serialize a class, only class members will be serialized. As an
>> > XSL
>> > style*** is a string, you have the option of creating a member of the
>> > class (which represents the style***) that can be serialized with it.
>> > Otherswise, use an external style***.
>> >
>> > --
>> > HTH,
>> >
>> > Kevin Spencer
>> > Microsoft MVP
>> > ..Net Developer
>> > Complex things are made up of
>> > Lots of simple things.
>> >
>> > "Pazza" <Pazza@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
>> > news:CED9C30E-5967-4F70-8B30-3E632E649F60@xxxxxxxxxxxxxxxx
>> > > Hi,
>> > >
>> > > I need to be able to serialize my class such that the XML file
>> > > contains a
>> > > style*** directive after the XML definition as below:
>> > >
>> > > <?xml version="1.0" ?>
>> > > <xml-style*** type="test/xsl" href="abc.xsl"?>
>> > > <root>
>> > > etc
>> > > etc
>> > >
>> > > Can anyone tell me how to do this please?
>> > >
>> > > Pazza.
>> >
>> >
>> >
.
- Follow-Ups:
- Re: Serialize a class adding a style***
- From: Pazza
- Re: Serialize a class adding a style***
- References:
- Re: Serialize a class adding a style***
- From: Kevin Spencer
- Re: Serialize a class adding a style***
- From: Pazza
- Re: Serialize a class adding a style***
- Prev by Date: Re: When where the first .Net Beta's released
- Next by Date: Re: How can I read the files of a directory on a web server?
- Previous by thread: Re: Serialize a class adding a style***
- Next by thread: Re: Serialize a class adding a style***
- Index(es):