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 6716161
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T08:42:00+00:00 2026-05-26T08:42:00+00:00

I have an xml file with elements that look like this (abbreviated for clarity):

  • 0

I have an xml file with elements that look like this (abbreviated for clarity):

<post id="1" tags="tag1 tag2 tag3 tag4" />

I want to map this to the following class using Xml Deserialization, but I can’t find a way to map the tags attribute to an actual List(Of String).

<Serializable()> _
<XmlRootAttribute("post")> _
Public Class Post
Private m_id As Integer
Private m_tags As String

<XmlAttribute("id")> _
Public Property Id() As Integer
    Get
        Return m_id
    End Get
    Set(ByVal value As Integer)
        m_id = value
    End Set
End Property

'<XmlAttribute("tags")> _
Public Property Tags() As List(Of String)
    Get
        Return m_tags
    End Get
    Set(ByVal value As List(Of String))
        m_tags = value
    End Set
End Property
End Class

Is there any way to override the default Deserialization?

  • 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-05-26T08:42:01+00:00Added an answer on May 26, 2026 at 8:42 am

    I think the easiest thing to do is to have a RawTags get/set property which gets serialized, and a Tags readonly property which parses the RawTags to a List<string> but gets ignored by the serializer:

    <Serializable()> 
        <XmlRootAttribute("post")> 
        Public Class Post
        Private m_id As Integer
        Private m_tags As String
    
        <XmlAttribute("id")> 
        Public Property Id() As Integer
            Get
                Return m_id
            End Get
            Set(ByVal value As Integer)
                m_id = value
            End Set
        End Property
    
       <XmlAttribute("tags")> 
        Public Property RawTags() As String
            Get
                Return m_tags 
            End Get
            Set(ByVal value As String)
                m_tags = value
            End Set
        End Property
    
        <XmlIgnore>
        Public ReadOnly Property Tags() As List(Of String)
            Get
                Return m_tags.Split(" ").ToList()
            End Get
        End Property
        End Class
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an XML file that starts like this: <Elements name=Entities xmlns=XS-GenerationToolElements> I'll have
I have an XML document that looks like this: <file> <name>NAME_OF_FILE</name> </file> <file> <name>NAME_OF_FILE</name>
I have an xml file from an external system that looks like this. <?xml
I have an xml file that contains its element like <ab:test>Str</ab:test> When I am
I have an XML file, which I open in F# like this: let Bookmarks(xmlFile:string)
I have an XML Schema Definition file .XSD who's elements are in Spanish. I
Do developers have to put certain/extra elements in the feed's XML file or attributes
I have an xml file providing data for a datagrid in Flex 2 that
So I have already imported one XML-ish file with 3000 elements and parsed them
I have a wix installer that will install an XML file and then modify

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.