Serialization

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • solano
    New Member
    • Aug 2009
    • 4

    Serialization

    Hi!

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

    Code:
    Dim ser As New XmlSerializer(GetType(Skjema))
            ser.Serialize(Console.Out, Skjema_Obj)
    I get

    Code:
    <?xml version="1.0" encoding="Windows-1252"?>
    <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

    Code:
    <?xml version="1.0" encoding="Windows-1252"?>
    and

    Code:
    <Skjema xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" skjemanummer="105" .....
    I want to put

    Code:
    <DataBatch batchId="1000" enterpriseSystemId="10" schemaVersion="1.1" receiptType="OnDemand">
    <DataUnits>
    <DataUnit participantId="955106679" sendersReference="30" parentReference="" completed="0">
    How can I do that?

    Thanks!
    Last edited by Dormilich; Aug 12 '09, 09:53 AM. Reason: Please use [code] tags when posting code
  • Dormilich
    Recognized Expert Expert
    • Aug 2008
    • 8694

    #2
    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

    Comment

    • solano
      New Member
      • Aug 2009
      • 4

      #3
      Thanks!

      Could you explain a little bit more how I can do this?

      Comment

      • Dormilich
        Recognized Expert Expert
        • Aug 2008
        • 8694

        #4
        that depends on your programming language.

        Comment

        • solano
          New Member
          • Aug 2009
          • 4

          #5
          Sorry, I use VB.NET.

          Comment

          • Dormilich
            Recognized Expert Expert
            • Aug 2008
            • 8694

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

            Comment

            Working...