F
Flack
Hey guys,
Lets say I have an object, MyObject, that has a couple of public properties.
I want to serialize this object and include it in a larger xml message. So,
I have some elements in the xml message that have nothing to do with the
object, whose values are retrieved elsewhere, and some values which are
gotten directly from MyObject.
All of the serialization examples I have seen deal with simply serializing
the entire object to its own xml format. Any suggestions on how to achieve
what I described?
Here is an example of what I am trying to achieve:
- MyObject has properties Name and Count.
- SessionID is an ID which is not stored in the object.
The xml I am looking to create is:
<Request>
<SessionID>12345</SessionID>
<ObjectValues>
<Name>Test</Name>
<Count>2</Count>
</ObjectValues>
</Request>
Notice how the object type, MyObeject, is not used in the xml and that the
root name is also not related to the object. Basically, the info in the
object just needs to be used. Do I have to create such xml manually, using
an XmlWriter? I was hoping there was some way I can define what info from
what source should be used when creating the xml.
Thanks.
Lets say I have an object, MyObject, that has a couple of public properties.
I want to serialize this object and include it in a larger xml message. So,
I have some elements in the xml message that have nothing to do with the
object, whose values are retrieved elsewhere, and some values which are
gotten directly from MyObject.
All of the serialization examples I have seen deal with simply serializing
the entire object to its own xml format. Any suggestions on how to achieve
what I described?
Here is an example of what I am trying to achieve:
- MyObject has properties Name and Count.
- SessionID is an ID which is not stored in the object.
The xml I am looking to create is:
<Request>
<SessionID>12345</SessionID>
<ObjectValues>
<Name>Test</Name>
<Count>2</Count>
</ObjectValues>
</Request>
Notice how the object type, MyObeject, is not used in the xml and that the
root name is also not related to the object. Basically, the info in the
object just needs to be used. Do I have to create such xml manually, using
an XmlWriter? I was hoping there was some way I can define what info from
what source should be used when creating the xml.
Thanks.