Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9173911
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T16:39:46+00:00 2026-06-17T16:39:46+00:00

I know how to serialize an xml. But this following example I have never

  • 0

I know how to serialize an xml. But this following example I have never done yet. And I can’t figure out how to do it either.

 <Products>
   <row **id="10"**>
     <ProductName>Cola</ProductName>
     <Amount>3</Amount>
   </row>
   <row **id="20"**>
     <ProductName>Fanta</ProductName>
     <Amount>6</Amount>
   </row>
 </Products>

So I want use xml serialization, most of the xml is done, but this little part of it remains.

I can’t manage to put the id behind the row. I bet I need to use xmlattribute but I don’t really know how to implement.

Can someone please help me out on how to get the id in “Row” element with xml serialization specifically.

(I did find some way to do it with another way, but since this XML is pretty large and most of it I finished so I would love to continue. And also don’t want to go around any little problem.)

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T16:39:48+00:00Added an answer on June 17, 2026 at 4:39 pm

    You just need to create an ID member in your class and then mark it with the XmlAttribute attribute, for instance:

    Public Class MyRow
    
        <XmlAttribute()> _
        Public Property id() As Integer
            Get
                Return _id
            End Get
            Set(ByVal value As Integer)
                _id = value
            End Set
        End Property
        Private _id As Integer
    
    
        Public Property ProductName() As String
            Get
                Return _productName
            End Get
            Set(ByVal value As String)
                _productName = value
            End Set
        End Property
        Private _productName As String
    
    
        Public Property Amount() As Integer
            Get
                Return _amount
            End Get
            Set(ByVal value As Integer)
                _amount = value
            End Set
        End Property
        Private _amount As Integer
    End Class
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Know this might be rather basic, but I been trying to figure out how
I know that this question has already been asked, but I have strange problem
Now as I know ServiceStack uses .NET's Xml DataContractSerializer to serialize/deserialize XML, but with
I read Apple Programming Guide on this subject but couldn't figure it out. I
I have a class named Dinner, should this domain class know how to serialize
I know that you can't serialize/deserialize using an interface but I'm confused by behaviour
I know how to serialize an object in the following way: void encodeMsg(char **msg,
I know it is possible to serialize and unserialize in PHP and then have
I know you can not set a key value dynamically, but what about the
I'm tryng to serialize an object to XML by using C# with the following

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.