Solved

how do I fix a xml error?

Posted on 2011-09-29
7
235 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
  • 4
  • 3
7 Comments
 
LVL 76

Expert Comment

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

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
PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

 

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 76

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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Ideas for Displaying a hierarchy of data in ASP.NET (Org chart in table or tree format) 1 34
defining NULL or 0 10 44
Html CheckBox obtain Its Value 5 27
Read XML values 8 41
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
Performance in games development is paramount: every microsecond counts to be able to do everything in less than 33ms (aiming at 16ms). C# foreach statement is one of the worst performance killers, and here I explain why.
This video shows information on the Oracle Data Dictionary, starting with the Oracle documentation, explaining the different types of Data Dictionary views available by group and permissions as well as giving examples on how to retrieve data from th…
This video explains what a user managed backup is and shows how to take one, providing a couple of simple example scripts.

808 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