xml-deserialization

XML deserializer (Iserialzable)

Hey everybody, I have a class in c# that implements Iserialzable. I'm using a XMLSerializer that produces a XML from instance of that class. I get the following XML: <?xml version="1.0"?> <Configuration xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"&gt; <SessionConfiguration> ...

Serializing XML response from WebService to Object (C#)

I am calling a REST webservice. The response looks something like this: <?xml version=\"1.0\" encoding=\"utf-8\"?> <data> <status>1</status> <message>OK</message> <results> <result> <account>12345</account> <to>012345678</to> <from>054321</from> <message>Testing</message> <flash></flash> <r...

Problem with XML Deserialization C#

I am having trouble with XML deserialization. In a nutshell - I have 2 classes: SMSMessage SMSSendingResponse I call an API that takes a bunch of parameters (represented by SMSMessage class) It returns an XML response. The response looks like this: <?xml version="1.0" encoding="utf-8"?> <data> <status>1</status> <message>OK<...

XmlSerializer - Deserialize different elements as collection of same element

I have the following XML part which schema I can't change. NUMBER, REGION, MENTION, FEDERAL are columns: <COLUMNS LIST="20" PAGE="1" INDEX="reg_id"> <NUMBER WIDTH="3"/> <REGION WIDTH="60"/> <MENTION WIDTH="7"/> <FEDERAL WIDTH="30"/> </COLUMNS> I want to deserialize it to public List<Column> Columns {get;set;} property. So elem...

Why does the OnDeserialization not fire for XML Deserialization?

I have a problem which I have been bashing my head against for the better part of three hours. I am almost certain that I've missed something blindingly obvious... I have a simple XML file: <?xml version="1.0" encoding="utf-8"?> <WeightStore xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org...

Best Practice for Serialize/Deserialize from Java to XML

What is the most appropriate way to serialize Java Classes to XML? I tried JAXB, but it has issues with Interfaces and Generics. What sollution is least intrusive but scalable? ...

Problem deserializing xml file

I auto generated an xsd file from the below xml and used xsd2code to get a c# class. The problem is the entire xml doesn't deserialize. Here is how I'm attempting to deserialize: static void Main(string[] args) { using (TextReader textReader = new StreamReader("config.xml")) { // string temp = text...

How to rebuild C# Class from XML

I would like to save an instance of a c#.NET class in SQL for later retrieval. I am able to use LINQ to SQL to add a record complete with all the xml that makes up the class. Now how do I retrieve that xml and reconstruct the class object instance? ...

Deserializing XML text elements with attributes in XStream

Basically, I want to do the reverse of this question. I'm getting XML from Microsoft's Bing batch Geocode service, and some of the elements look like this (poached from here): <DataflowJob> <Id>5bf10c37df944083b1879fbb0556e67e</Id> <Link role="self">https://spatial.virtualearth.net /REST/v1/dataflows/Geocode/5bf10c37df944083b18...

XML Serialize and Deserialize Problem XML Structure

Camarades, I'm having the following problem. Caught a list Struct, Serialize (Valid W3C) and send to a WebService. In the WebService I receive, transform to a string, valid by the W3C and then Deserializer, but when I try to run it, always occurs error, saying that some objects were not closed. Any help? Sent Code: #region ListToXML ...

Deserialize XMLto array of objects, or singular object

I'm trying to write a generic method that can be used to deserialize xml to an array of objects. Given XML that looks like so: <people> <person> <someElement>content</someElement> </person> <person> <someElement>more content</someElement> </person> </people> Shown in the below code as xmlDoc. And a per...

Namespaces and deserialization issue

UPDATE: You can run the code at the end of this to recreate and see the error I am having and hopefully solve it! UPDATE2: It's not the removal of the xmlns="" that's the issue... as you can remove it from the initial xml string. The problem is with the [XmlType(TypeName = "Systems")] somehow causing it to be added... UPDATE3: Turns ...

Can XmlTextReader tell the difference between <tag> and <tag />

I am reading an XML file using an XMLTextReader. Is there a way to tell the difference between a start tag (like <tag>) and a self-terminating tag (like <tag />) ...

C# XML De serialization and arrays.

Hello, There is next xml file: <element Name="root"> <SubFields> <element Name="subroot"> <SubFields> <element1 Name="element1" customatt1 = "12313" customatt2 = "asdfasfadsfasd"> <subelement Name="subelement" /> </element1> <element1 Name="elem...

using XmlArrayItem attribute without XmlArray on Serializable C# class

I want XML in the following format: <configuration><!-- Only one configuration node --> <logging>...</logging><!-- Only one logging node --> <credentials>...</credentials><!-- One or more credentials nodes --> <credentials>...</credentials> </configuration> I'm trying to create a class Configuration that has the [Serializable] a...

Problem xml-deserializing recursive nested object

Solved: code below is not causing an infinite loop as I thought. the loop was in the code calling the deserialization. this posted code works just fine I am trying to serialize and deserialize to xml the following object public class MessageObjectCollection : List<MessageObject> { public string Serialize() { return XmlO...

XmlSerializer: How can I allow a property to deserialize, but then stop it from serializing?

That is, I'd like my data to go one way - feed into a class, but then prevent it from saving out during a serialize operation. What's the best way to go about that? ...

Populating parent + child objects from SQL Server 2008 (via XML?)

I have simple DAL that consists of a SalesEnquiry object, which includes a List<T> of a Vehicle object, which is used to process incoming enquiries (XML) and write them to a DB. So far so good. However, I'm writing another app that further processes data in this DB, so I'm wanting to use these same DAL objects to retrieve and manipulate...

multiple namespaces deserialize problem

Hello, My problem is kind of hard to explain so I hope the title attracts the right people. I am building an XDocument which I then want to deserialize into a web service object to send to the service. My problem is I don't know how to deserialize the XDocument to match the SOAP Message because of the multiple namespaces. What I am cur...

XmlSerializer deserialize attribute with empty string to zero

I would like to use XmlSerializer and deserialize attributes with empty string values into zeros for ints. Every question I've seen regarding deserializing attributes with empty strings involves setting nullable ints to null - but I want to set non-nullable ints to zero, not null. Is there any easy way to do this without implementing I...