473,698 Members | 2,833 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Deserializing XML

I am trying to use XmlSerializer to serialize the XML string into an object.
I used the XML schema definition to generate the code for the corresponding class (using xsd.exe).
The top level class has references to objects of other classes that are defined in the same schema.

I am trying to deserialize the XML string into an object of the class that was generated as explained above.
Here is my code:
XML string is in this.textBox1.T ext.

private void button1_Click(o bject sender, System.EventArg s e)
{

string strReqInstance = this.textBox1.T ext;
XmlTextReader reqInstanceRead er = new XmlTextReader(n ew StringReader(st rReqInstance));
XmlSerializer instSerializer = new XmlSerializer(t ypeof(request_i nstance));
request_instanc e reqInstance;
reqInstance = (request_instan ce) instSerializer. Deserialize(req InstanceReader) ;
}

When this code is run I am getting an exception on XmlSerializer construction line:

An unhandled exception of type 'System.IO.File NotFoundExcepti on' occurred in mscorlib.dll
Additional information: File or assembly name a2chdxob.dll, or one of its dependencies, was not found.

If I run the similar code within a web service here is the whole callstack (XML is passed through strReqInstance) :

System.IO.FileN otFoundExceptio n: File or assembly name yi7sw1kj.dll, or one of its dependencies, was not found.
File name: "yi7sw1kj.d ll"
at System.Reflecti on.Assembly.nLo ad(AssemblyName fileName, String codeBase, Boolean isStringized, Evidence assemblySecurit y, Boolean throwOnFileNotF ound, Assembly locationHint, StackCrawlMark& stackMark)
at System.Reflecti on.Assembly.Int ernalLoad(Assem blyName assemblyRef, Boolean stringized, Evidence assemblySecurit y, StackCrawlMark& stackMark)
at System.Reflecti on.Assembly.Loa d(AssemblyName assemblyRef, Evidence assemblySecurit y)
at System.CodeDom. Compiler.Compil erResults.get_C ompiledAssembly ()
at System.CodeDom. Compiler.Compil erResults.get_C ompiledAssembly ()
at System.Xml.Seri alization.Compi ler.Compile()
at System.Xml.Seri alization.TempA ssembly..ctor(X mlMapping[] xmlMappings)
at System.Xml.Seri alization.XmlSe rializer.Genera teTempAssembly( XmlTypeMapping xmlTypeMapping)
at System.Xml.Seri alization.XmlSe rializer..ctor( Type type, String defaultNamespac e)
at System.Xml.Seri alization.XmlSe rializer..ctor( Type type)
at ACN_RFDWSI_Temp lateInfo.ACN_RF DWSI_TemplateIn fo.getViews(Str ing def_id, String strReqInstance, String strReqContext) in c:\inetpub\wwwr oot\acn_rfdwsi_ templateinfo\ac n_rfdwsi_templa teinfo.asmx.cs: line 70

=== Pre-bind state information ===
LOG: Where-ref bind. Location = C:\DOCUME~1\SCH USS~1\ASPNET\LO CALS~1\Temp\yi7 sw1kj.dll
LOG: Appbase = file:///c:/inetpub/wwwroot/ACN_RFDWSI_Temp lateInfo
LOG: Initial PrivatePath = bin
Calling assembly : (Unknown).
===

LOG: Policy not being applied to reference at this time (private, custom, partial, or location-based assembly bind).
LOG: Attempting download of new URL file:///C:/DOCUME~1/SCHUSS~1/ASPNET/LOCALS~1/Temp/yi7sw1kj.dll.

What could be the reason for this problem?
Thanks a lot
Alex
Nov 12 '05 #1
0 1702

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

Similar topics

1
2050
by: Justin Armstrong | last post by:
I'm having difficulties deserializing some objects. Consider the following example of what I'm trying to do: ---------------------------------------------------------- class Person { string name; } class Info {
1
1853
by: Thomas | last post by:
Hi, I implemented a composite pattern which should be serializable to xml. After spending some time in the newsgroups, i finally managed serializing, even with utf-8 instead of utf-16, which causes ie problems. But when deserializing the xml into the object structure, the following exception is beeing thrown: There is an error in XML document (3, 701).
4
7510
by: Wayne Wengert | last post by:
Using VB.NET I want to read in an XML file that has an array of objects and then step through the resulting array in code. I build a class to define the structure and I am running code to read in the data but I can't figure out where the data is in the resulting array. Most of the relevant code is below. When I run the code to desrialize I get no errors but if I try to look at some of the data via the command window I get errors such as...
2
3093
by: Earl Teigrob | last post by:
I am saving and restoring value types such as Int32, DateTime and Boolean in strings. I was wondering if there is a mechanism build into .NET for serializing and deserializing these to string format. I can, of course, serialize a class to a file, either binary or XML, but this is not what I am looking for. Currently I am using ToString() or Convert.xxx to do this, but thought that if there was a true serializer, deserializer, that would be...
1
1444
by: Bob Rock | last post by:
Hello, always having to validate an XML stream against a XSD may add up an important overhead. My XMLs are usually the result of serializing a class instance and often in my applications what I end up doing is just deserializing it back into a new instance of the same class. Considering what I just said what I often end up doing is not validating my XML to be deserialized and just try deserializing it into an instance of the class and...
5
3158
by: Daniel Gackle | last post by:
I'm getting a strange ArgumentNullException after deserializing a SortedList. Haven't seen this discussed in the newsgroups, but it looks like a bug - unless I missed something obvious? I've distilled the problem into the following code. Can anybody reproduce/explain the problem? Thanks, Daniel
6
1580
by: Steve Teeples | last post by:
I use serialization to write class data to a file. During my development of this class I need to add properties or fields on occation. After adding a property, when deserializing the data saved to disk I get an exception error indicating that the class data members no longer match. To avoid the exception errors, how can I retrieve data from the disk and populate the existing fields found within the file and set defaults for the new...
0
7797
by: Sivajee Akula | last post by:
Hello All, I am trying to consume a .NET Service from Adobe LiveCycle Workflow. The service deals with complex objects. I am getting the following exception at the time of invocation of the service, and due to which my workflow gets stalled. When I searched the net, I found many posts reporting this error, but none with a solution. There is no code involved in the invocation, everything is handled by Adobe tool itself. I just specify the...
1
11792
by: =?Utf-8?B?SmVyZW15X0I=?= | last post by:
I am working on an order entry program and have a question related to deserializing nodes with nested elements. The purchase order contains multiple line items which I select using an XmlNodeList. I am trying to deserialize the nodes using a foreach as follows: foreach(XmlNode lineItem in LineItemsNodeList) An abbreviated example of the nested lineItem node looks like this:
0
981
by: ullner | last post by:
I have an XML fil that looks like this: <Environment> <AreaOfInterest> <Name>ScenarioMap</Name> <UpperRight> <GDC> <Latitude>-179</Latitude> <Longitude>-179</Longitude>
0
8683
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
8611
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
8904
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
7741
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
4372
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
4624
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3052
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
2
2341
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2007
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.