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

  • Home
  • SEARCH
  • 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 8827121
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T07:18:15+00:00 2026-06-14T07:18:15+00:00

yet another XML Deserialization question. I have checked several other threads and tried most

  • 0

yet another XML Deserialization question.

I have checked several other threads and tried most of the solutions there, but to no avail.
The XML I receive can’t be modded (or at least not easily) here it is:

<?xml version=\"1.0\" encoding=\"UTF-8\"?> 
<ActueleVertrekTijden>
    <VertrekkendeTrein>
        <RitNummer>37047</RitNummer>
        <VertrekTijd>2012-11-13T15:40:00+0100</VertrekTijd>
        <EindBestemming>Sneek</EindBestemming>
        <TreinSoort>Stoptrein</TreinSoort>
        <Vervoerder>Arriva</Vervoerder>
        <VertrekSpoor wijziging=\"false\">3</VertrekSpoor>
    </VertrekkendeTrein>
    <VertrekkendeTrein>
        <RitNummer>10558</RitNummer>
        <VertrekTijd>2012-11-13T15:46:00+0100</VertrekTijd>
        <EindBestemming>Rotterdam Centraal</EindBestemming>
        <TreinSoort>Intercity</TreinSoort>
        <RouteTekst>Heerenveen, Steenwijk, Utrecht C</RouteTekst>
        <Vervoerder>NS</Vervoerder>
        <VertrekSpoor wijziging=\"false\">4</VertrekSpoor>
    </VertrekkendeTrein>
    <VertrekkendeTrein>
        <RitNummer>37349</RitNummer>
        <VertrekTijd>2012-11-13T15:59:00+0100</VertrekTijd>
        <EindBestemming>Groningen</EindBestemming>
        <TreinSoort>Sneltrein</TreinSoort>
        <RouteTekst>Buitenpost</RouteTekst>
        <Vervoerder>Arriva</Vervoerder>
        <VertrekSpoor wijziging=\"false\">5b</VertrekSpoor>
    </VertrekkendeTrein>
</ActueleVertrekTijden>

There are more elements (always a minumum of 10)

Now these are the classes I am deserializing too:

[Serializable, XmlRoot(ElementName="ActueleVertrekTijden", DataType="VertrekkendeTrein", IsNullable=false)]
public class ActueleVertrekTijden
{
    [XmlArray("ActueleVertrekTijden")]
    public VertrekkendeTrein[] VertrekLijst { get; set; }
}

[Serializable]
public class VertrekkendeTrein
{
    [XmlElement("RitNummer")]
    public string RitNummer { get; set; }
    [XmlElement("VertrekTijd")]
    public string VertrekTijd { get; set; }
    [XmlElement("EindBestemming")]
    public string EindBestemming { get; set; }
    [XmlElement("Vervoerder")]
    public string Vervoerder { get; set; }
    [XmlElement("VertrekSpoor")]
    public string VertrekSpoor { get; set; }
}

I omitted the others for the time being. The XmlRoot part I added because I got a “xmlsn=”-error. So had to set the XmlRoot.

Now the Deserializer:

        public ActueleVertrekTijden Deserialize<ActueleVertrekTijden>(string s)
    {
        var ser = new XmlSerializer(typeof(ActueleVertrekTijden));
        ActueleVertrekTijden list = (ActueleVertrekTijden)ser.Deserialize(new StringReader(s));

        return list;
    }

It does return a ActueleVertrekTijden class but the VertrekLijst array remains null

  • 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-14T07:18:15+00:00Added an answer on June 14, 2026 at 7:18 am

    You need to omit the wrapper namespace, because your array elements are appearing directly below the container ActueleVertrekTijden class, without any collection wrapper element. i.e. change

     [XmlArray("ActueleVertrekTijden")]
     public VertrekkendeTrein[] VertrekLijst { get; set; }
    

    to

     [XmlElement("VertrekkendeTrein")]
     public VertrekkendeTrein[] VertrekLijst { get; set; }
    

    Reference here

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Yet another PHP question. I've got two arrays: one string-based and the other numeric.
i have a directory which contains the following: -directory -another directory -meta.xml -yet another
Yet another question on this I know, but let me just say I looked
I have yet another issue which the answer is eluding me. I wish to
I'm trying to produce yet another lightbox as much needed HTML/CSS/Javascript practice, but I've
After getting a helpful answer here , I have run into yet another problem:
Someone at the office threw me this weird-yet-interesting question. If I have something like
I need help with a question that I could not answer yet. I have
I have a web-application in java which is invoked by yet another web-application written
Yet another data structure doubt. I will get straight to it. This is what

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.