473,890 Members | 1,953 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

serialization XML problem

There is an error in XML document (1, 2).
I used XML spy to create the XML and XSD. When I asked to
have the XML validated it said it was OK.

I used the .net SDK to generate the class. I have done
this before but this time I have no idea why I am getting
the error. Any ideas ?? THANKS !

<qcsttatus>
<manual sourcerootfolde r="" manualname="">
<pmainfo pmapath=""/>
<stateaction qcdate="" qcwho=""/>
</manual>
<manual sourcerootfolde r="" manualname="">
<pmainfo pmapath=""/>
<stateaction qcdate="" qcwho=""/>
</manual>
</qcsttatus>

This is my class that was generated:
//---------------------------------------------------------
---------------------
// <autogenerate d>
// This code was generated by a tool.
// Runtime Version: 1.0.3705.209
//
// Changes to this file may cause incorrect behavior
and will be lost if
// the code is regenerated.
// </autogenerated>
//---------------------------------------------------------
---------------------

//
// This source code was auto-generated by xsd,
Version=1.0.370 5.209.
//
namespace qcstatus
{
using System.Xml.Seri alization;
/// <remarks/>
[System.Xml.Seri alization.XmlRo otAttribute(Nam espace="",
IsNullable=fals e)]
public class manual {

/// <remarks/>
public pmainfo pmainfo;

/// <remarks/>
public stateaction stateaction;

/// <remarks/>
[System.Xml.Seri alization.XmlAt tributeAttribut e()]
public string sourcerootfolde r;

/// <remarks/>
[System.Xml.Seri alization.XmlAt tributeAttribut e()]
public string manualname;
}

/// <remarks/>
[System.Xml.Seri alization.XmlRo otAttribute(Nam espace="",
IsNullable=fals e)]
public class pmainfo {

/// <remarks/>
[System.Xml.Seri alization.XmlAt tributeAttribut e()]
public string pmapath;
}

/// <remarks/>
[System.Xml.Seri alization.XmlRo otAttribute(Nam espace="",
IsNullable=fals e)]
public class stateaction {

/// <remarks/>
[System.Xml.Seri alization.XmlAt tributeAttribut e()]
public string qcdate;

/// <remarks/>
[System.Xml.Seri alization.XmlAt tributeAttribut e()]
public string qcwho;
}

/// <remarks/>
[System.Xml.Seri alization.XmlRo otAttribute("qc sttatus",
Namespace="", IsNullable=fals e)]
public class qcsttatus {

/// <remarks/>
[System.Xml.Seri alization.XmlEl ementAttribute
("manual")]
public manual[] manual;
}
}
Nov 15 '05 #1
1 4367
Hi Andrew,

Firstly, let me confirm: The XML deserialization is giving you this error right? What is the type that you are sending to the XMLSerializer?
Since the root is qcstatus, sending that should work. It did when I tried. I got the same error you did if I set the type as 'manual' instead.
Maybe that's what's going wrong?...

So, doing the below on your xml file should work:

XmlSerializer serializer = new XmlSerializer(t ypeof(qcstatus. qcsttatus));
string fileName = @"c:\qcstatus.x ml";
FileStream fs = new FileStream(file Name, FileMode.Open);
qcstatus.qcstta tus results = (qcstatus.qcstt atus)serializer .Deserialize(fs );
fs.Close();

(remember to put try catch blocks for File exception or deserialization exception)

HTH.
Thanks
Swati
--------------------
Content-Class: urn:content-classes:message
From: "andrewcw" <an************ @boeing.com>
Sender: "andrewcw" <an************ @boeing.com>
Subject: serialization XML problem
Date: Fri, 25 Jul 2003 14:51:46 -0700
Lines: 97
Message-ID: <04************ *************** *@phx.gbl>
MIME-Version: 1.0
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: 7bit
X-Newsreader: Microsoft CDO for Windows 2000
X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4910.0300
Thread-Index: AcNS9vGG2cqUjZQ QRwCJrXSKBhXbcQ ==
Newsgroups: microsoft.publi c.dotnet.langua ges.csharp
Path: cpmsftngxa06.ph x.gbl
Xref: cpmsftngxa06.ph x.gbl microsoft.publi c.dotnet.langua ges.csharp:1719 42
NNTP-Posting-Host: TK2MSFTNGXA09 10.40.1.161
X-Tomcat-NG: microsoft.publi c.dotnet.langua ges.csharp

There is an error in XML document (1, 2).
I used XML spy to create the XML and XSD. When I asked to
have the XML validated it said it was OK.

I used the .net SDK to generate the class. I have done
this before but this time I have no idea why I am getting
the error. Any ideas ?? THANKS !

<qcsttatus>
<manual sourcerootfolde r="" manualname="">
<pmainfo pmapath=""/>
<stateaction qcdate="" qcwho=""/>
</manual>
<manual sourcerootfolde r="" manualname="">
<pmainfo pmapath=""/>
<stateaction qcdate="" qcwho=""/>
</manual>
</qcsttatus>

This is my class that was generated:
//---------------------------------------------------------
---------------------
// <autogenerate d>
// This code was generated by a tool.
// Runtime Version: 1.0.3705.209
//
// Changes to this file may cause incorrect behavior
and will be lost if
// the code is regenerated.
// </autogenerated>
//---------------------------------------------------------
---------------------

//
// This source code was auto-generated by xsd,
Version=1.0.37 05.209.
//
namespace qcstatus
{
using System.Xml.Seri alization;
/// <remarks/>
[System.Xml.Seri alization.XmlRo otAttribute(Nam espace="",
IsNullable=fal se)]
public class manual {

/// <remarks/>
public pmainfo pmainfo;

/// <remarks/>
public stateaction stateaction;

/// <remarks/>
[System.Xml.Seri alization.XmlAt tributeAttribut e()]
public string sourcerootfolde r;

/// <remarks/>
[System.Xml.Seri alization.XmlAt tributeAttribut e()]
public string manualname;
}

/// <remarks/>
[System.Xml.Seri alization.XmlRo otAttribute(Nam espace="",
IsNullable=fal se)]
public class pmainfo {

/// <remarks/>
[System.Xml.Seri alization.XmlAt tributeAttribut e()]
public string pmapath;
}

/// <remarks/>
[System.Xml.Seri alization.XmlRo otAttribute(Nam espace="",
IsNullable=fal se)]
public class stateaction {

/// <remarks/>
[System.Xml.Seri alization.XmlAt tributeAttribut e()]
public string qcdate;

/// <remarks/>
[System.Xml.Seri alization.XmlAt tributeAttribut e()]
public string qcwho;
}

/// <remarks/>
[System.Xml.Seri alization.XmlRo otAttribute("qc sttatus",
Namespace="" , IsNullable=fals e)]
public class qcsttatus {

/// <remarks/>
[System.Xml.Seri alization.XmlEl ementAttribute
("manual")]
public manual[] manual;
}
}

--

This posting is provided "AS IS" with no warranties, and confers no rights. Use of included script samples are subject to the terms specified
at http://www.microsoft.com/info/cpyright.htm

Note: For the benefit of the community-at-large, all responses to this message are best directed to the newsgroup/thread from which they
originated.

Nov 15 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
2121
by: David K | last post by:
we are having a problem when trying to serilalize and deserialize DataTable When replacing the container to be ListArray or HashTable everything works fine The code is very straight forward ( see below), however when comparing the DataTable before and after the serialize, it is not the same The DataTable after the serialization contains only the string of class type ( Vclass in this class) but not the class itself Any idea ?
37
5043
by: Ben | last post by:
Hi, there. Recently I was working on a problem where we want to save generic closures in a data structure (a vector). The closure should work for any data type and any method with pre-defined signature. When developing this lib, I figured that the pointer-to-member-function, although seemingly an attractive solution, does not work well for us.
0
1245
by: ktn | last post by:
Hi all, I'm a .NET beginner and I've got a problem on a program where I try to do an XML serialization. I get the following error : "An unmanaged exception of type 'System.IO.FileNotFoundException' occured in mscorlib.dll Additonal information : the file or asssembly named n9gu4-bo.dll or one of its dependencies cannot be found"
2
2360
by: ofer | last post by:
Hi, I am working with the beta version of the new .net framework (Whidbey) and I encountered a problem with serialization that did'nt exist in the .net 2003 the situation is like this : I have a class that inherits from dataset, and I want to serialize it , so I created a serialization constructor that forwards the call to the base class (the dataset) serialization constructor, normally, for this action to succeed I am supposed to put...
0
2509
by: umhlali | last post by:
I get the following exception when my VB.NET app calls a Java web service that returns an array of objects. The same call works for a single object though. So looks like there is no problem serializing the object but there seems to be a problem serializing an array of objects. Any help will be appreciated "Cannot assign object of type System.Object to an object of type ElectronicWallet.C2PTest.PaymentItem." :...
5
6038
by: Harold Howe | last post by:
I am having a problem deserializing objects from a library when the following conditions exist: 1- The library is strongly named 2- The serialized file was created with version 1.0 of the assembly 3- I am trying to deserialize from an EXE that references version 2.0 of the assembly 4- Both version 1.0 and 2.0 of the assembly reside in the GAC (no policy redirects exist).
2
1638
by: Norman Chong | last post by:
Hiddeldi ho, I want to save an object so that I can use its content after I restart my program. I tried to solve this with serialization because someone told me that this is the correct way for this. So I wrote the following code to serialize\deserialize the object, but now I have the problem that the object has a generic list and when I'm trying to deserialize it, I get an error. <System.Serializable()Public Class TestClass
4
11421
by: mijalko | last post by:
Hi, I have inherited my class from System.Drawing.Printing.PrintDocument and I wish to serialize this object using XmlSerializer. And I get exception "There was an error reflecting type ...". If I look at innerException it says: "Cannot serialize member 'System.ComponentModel.Component.Site' of type 'System.ComponentModel.ISite'. OK it is problem to serialize all data so I'll implement my Serialization. I implemented ISerializable...
2
5575
by: mkvenkit.vc | last post by:
Hello, I hope this is the right place to post a question on Boost. If not, please let me know where I can post this message and I will do so. I am having a strange problem with std::string as I am trying to read from a binary archive using Boost serialization. I am new to this, and it is possible that I have not understood the usage. In the code below, the string "faultblock" seems to be causing the problem. The code crashes in the ia...
0
9976
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
11214
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10801
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10903
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10449
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9616
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6034
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4659
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
3266
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.