Solved

how do I fix a xml error?

Posted on 2011-09-29
7
238 Views
Last Modified: 2012-05-12
I inherited a console app that reads in an xml file. However, when I run the app, I get an error: "There is an error in XML document (2, 2)." The inner exception error is {"<ArrayOfQF_DOW_Weight xmlns=''> was not expected."}. I am attaching the xml file for viewing. I am a xml newbie so not real familiar.

thanks. WeightsAndAdders.xml
0
Comment
Question by:bschave2
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 3
7 Comments
 
LVL 77

Expert Comment

by:slightwv (䄆 Netminder)
ID: 36817695
If this is strictly XML related can I move this to more appropriate zones?
0
 
LVL 77

Expert Comment

by:slightwv (䄆 Netminder)
ID: 36817702
The XML file looks correct.  What is throwing that error?
0
 

Author Comment

by:bschave2
ID: 36817750
public class QfDowWeights
      {
            public List<QfDowWeight> DayOfWeekWeights { get; set; }
            public QfDowWeights()
            {
                  var dataFilePath = Environment.CurrentDirectory + "\\WeightsAndAdders.xml";
                  var serializer = new XmlSerializer(typeof(List<QfDowWeight>));

                  using (var fs = new FileStream(dataFilePath, FileMode.Open, FileAccess.Read))
                  {
                try
                {

                    DayOfWeekWeights = serializer.Deserialize(fs) as List<QfDowWeight>;
                }
                catch (Exception ex)
                {
                    throw (ex);
                }
                        fs.Close();
                  }
            }
      }
0
Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

 

Author Comment

by:bschave2
ID: 36817766
List<QfDowWeight> has the three properties. dayofweek, lookbackday and weight....taking the xml data and putting it into list of the QfDowWeight object.
0
 
LVL 77

Expert Comment

by:slightwv (䄆 Netminder)
ID: 36817773
I would like to move this to more appropriate zones.  It does not appear to be Oracle or ASP (the zone you selected is straight ASP not ASP.Net) related.
0
 

Accepted Solution

by:
bschave2 earned 0 total points
ID: 36931546
i fixed this by using xml reader.
0
 

Author Closing Comment

by:bschave2
ID: 36954269
nobody commented, so I figured it out for myself.
0

Featured Post

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

How to Unravel a Tricky Query Introduction If you browse through the Oracle zones or any of the other database-related zones you'll come across some complicated solutions and sometimes you'll just have to wonder how anyone came up with them.  …
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
This video explains at a high level with the mandatory Oracle Memory processes are as well as touching on some of the more common optional ones.
This video shows how to copy an entire tablespace from one database to another database using Transportable Tablespace functionality.
Suggested Courses

622 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question