473,804 Members | 3,163 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

There was an error generating the XML document.

Hi All,

I have a DLL contains two classes, first one which is to be serialized
and other one is a UserControl class have code to serialize as below:-

class XYZ: System.Windows. Forms.UserContr ol
{

public XYZ()
{
string _preferencesFil e = "c:\test_xml.xm l";

XMLTest.PrefDat a _preferences = new XMLTest.PrefDat a();

XmlTextWriter writer = new XmlTextWriter(_ preferencesFile ,
System.Text.Enc oding.UTF8);
XmlSerializer serializer = null ;
writer.Formatti ng = Formatting.Inde nted;
serializer = new XmlSerializer(t ypeof(XMLTest.P refData));
//serializer.Seri alize(writer,pr eferences);
serializer.Seri alize(writer,(X MLTest.PrefData )_preferences);
writer.Flush();
writer.Close();
}

.......

Now If I create the object of XYZ like below

System.Windows. Forms.UserContr ol xyz = new XYZ();

the code written in the constructor works fine.

But I load this usercontrol thru reflection then it throw the error
"There was an error generating the XML document. " and inner exception
as "Specified cast is not valid";

Assembly asmAssemblyCont ainingForm = Assembly.LoadFr om("XMLTest.dll ");
Type typeToLoad = asmAssemblyCont ainingForm.GetT ype("XMLTest.XY Z");
System.Windows. Forms.UserContr ol allocationInsta nce =
(System.Windows .Forms.UserCont rol)Activator.C reateInstance(t ypeToLoad);

Please let me know if there are thoughts to solve this problem.

Thanks,
Utkarsh

Mar 8 '06 #1
0 2035

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

Similar topics

1
1501
by: Abby Lee | last post by:
My page runs fine...I just get the yeld sign with a "!" in it. Ok, I asked this question in the VBscript group and they tell me it's a JavaScript issue even though I don't get the error until I introduce the VBscript to the page. Please look at it. I'm getting the following error message on my page. The function function formatCurrency(strValue)
0
9725
by: Riley Phelps | last post by:
When I use the XML Serializer in the following example, the first Serialize (with the class Pets) works, but the second (with the cplaa Pets2) fails. Which arrtubute nedds to be applied to make the second Serialize work namespace SerializeTes public class Class args Test _test = new Test() _test.TestAnimal()
5
7772
by: schnell | last post by:
I'm getting an error that I'm very confused about. I'm trying to generate an XML file completely from scratch in code. Here is the code fragment that is causing me headaches: Dim mBOEDOC as xml.xmldocument dim inode as xml.xmlnode dim iNode2 as xml.Xmlnode mboedoc=new xml.xmldocument
3
1601
by: Alejandro Penate-Diaz | last post by:
Hi. While trying to create a a word document in one of my asp.net pages I keep getting an ASP.NET permission error. first I thought it was been caused while trying to save the document, and I added permissions for the ASP.NET account to my folders. after that I realized that the error was being launche at the very first line of my function: Word.ApplicationClass WordApp = new Word.ApplicationClass(); any ideas on how to solve this?...
3
9444
by: Raed Sawalha | last post by:
Hello when I serialize an object an error generated using this function public string SerializeObject(object oClassObject,System.Type oClassType) { XmlSerializer oSerializer = new XmlSerializer(oClassType); System.Text.StringBuilder strBuilder = new System.Text.StringBuilder(); System.IO.TextWriter writer = new System.IO.StringWriter(strBuilder); try { oSerializer.Serialize(writer,oClassObject); }
8
2831
by: Thirsty Traveler | last post by:
I have a WebMethod as follows: public XmlDocument OrderContract(XmlDocument doc) { return OrderBLL.OrderContract(doc); } However, the client is generating a compile error when the following lines are used:
4
2879
by: Steve | last post by:
hi all, i'm using DHTML to generate a dynamic table with adding removing and sorting rows the thing is after a row has been added at a position that i specify, if i try to delete it i get this error ! here's a chunk of code <script language='javascript' type='text/css' > function removeElement(divNum,arrayCode,elementId) {
0
2016
Sakalicek
by: Sakalicek | last post by:
Hi all, I have following problem in my application. I have Web Service and project which uses methods from this Web Service. I created proxy WsProxy by wsdl.exe and put it into that project. But when I try to use Web Service method, error occurs. I get: "There was an error generating the XML document" "Unable to cast object of type WsProxy.AAA to type WsProxy.AAA"
2
3121
by: rajuk | last post by:
Hi i have following code,when i execute this code i got unterminated string constant error.any javascript guru can you look into this please. raju /* The link details */ var links = new Array ("link1", "link2", "link3"); var links_text = new Array ("Link 1", "Link 2", "Link 3"); var links_url = new Array ("link1.htm", "link2.htm","link3.htm"); /* Resolve the location */ var loc=String(this.location);
8
2741
by: trappedIntoCode | last post by:
Hi Everyone, Here is a part of javascript code that works well in FF2 but shows above error in IE6 and error "missing name after . operator" . function PopUp(idf,stepX,stepY,speed){ this.idf=idf; this.popXStep=stepX; this.popYStep=stepY; this.popSpeed=speed; this.popLeft=0;
0
9707
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
10586
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
10338
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...
0
9161
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...
1
7622
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5525
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5658
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3823
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2997
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.