Connecting Tech Pros Worldwide Forums | Help | Site Map

Serialization

Newbie
 
Join Date: Aug 2009
Posts: 4
#1: Aug 12 '09
Hi!

I have an autogeneratede class (from a xsd schema). When I serialize this with

Expand|Select|Wrap|Line Numbers
  1. Dim ser As New XmlSerializer(GetType(Skjema))
  2.         ser.Serialize(Console.Out, Skjema_Obj)
I get

Expand|Select|Wrap|Line Numbers
  1. <?xml version="1.0" encoding="Windows-1252"?>
  2. <Skjema xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" skjemanummer="105" spesifikasjonsnummer="8074" blankettnummer="RF-1241" tittel="Oppgave over betaling for pass og stell av barn" gruppeid="4895">
But between

Expand|Select|Wrap|Line Numbers
  1. <?xml version="1.0" encoding="Windows-1252"?>
and

Expand|Select|Wrap|Line Numbers
  1. <Skjema xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" skjemanummer="105" .....
  2.  
I want to put

Expand|Select|Wrap|Line Numbers
  1. <DataBatch batchId="1000" enterpriseSystemId="10" schemaVersion="1.1" receiptType="OnDemand">
  2. <DataUnits>
  3. <DataUnit participantId="955106679" sendersReference="30" parentReference="" completed="0">
How can I do that?

Thanks!

Dormilich's Avatar
Moderator
 
Join Date: Aug 2008
Location: Leipzig, Germany
Posts: 3,662
#2: Aug 12 '09

re: Serialization


I don’t think you can do that along with the serialization. you have to put it in later with your favourite programming language.

PS: the last XML snippet is not valid

PPS: welcome at Bytes.com
Newbie
 
Join Date: Aug 2009
Posts: 4
#3: Aug 12 '09

re: Serialization


Thanks!

Could you explain a little bit more how I can do this?
Dormilich's Avatar
Moderator
 
Join Date: Aug 2008
Location: Leipzig, Germany
Posts: 3,662
#4: Aug 12 '09

re: Serialization


that depends on your programming language.
Newbie
 
Join Date: Aug 2009
Posts: 4
#5: Aug 12 '09

re: Serialization


Sorry, I use VB.NET.
Dormilich's Avatar
Moderator
 
Join Date: Aug 2008
Location: Leipzig, Germany
Posts: 3,662
#6: Aug 12 '09

re: Serialization


in VB.NET there should be string operations (even XML operations)
Reply