Solved

how do I fix a xml error?

Posted on 2011-09-29
7
233 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

This post first appeared at Oracleinaction  (http://oracleinaction.com/undo-and-redo-in-oracle/)by Anju Garg (Myself). I  will demonstrate that undo for DML’s is stored both in undo tablespace and online redo logs. Then, we will analyze the reaso…
Entity Framework is a powerful tool to help you interact with the DataBase but still doesn't help much when we have a Stored Procedure that returns more than one resultset. The solution takes some of out-of-the-box thinking; read on!
This video shows how to copy a database user from one database to another user DBMS_METADATA.  It also shows how to copy a user's permissions and discusses password hash differences between Oracle 10g and 11g.
This video shows how to recover a database from a user managed backup

932 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

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now