xml-deserialization

XML Deserialization Not Setting Class Values

I am not seeing what I am doing wrong. To see what was being done, I changed the constructor values to "TEST", after the XML gets read in (I verified what the XML is), the class values are still stuck to "TEST". Any more Ideas? I am doing this process already in another class that works fine, neither me nor some co-workers could find the...

xml- Deserialize

I am try to deserialize my class, that normally serialized. public class MyClass { private List<Section> sections = new List<Section>(); public List<Section> Sections { get { return this.sections; } } } public class Section1: Section { public string MyProperty {get;set;} } public class...

C# XML Deserialization W/ Default Values

I've got an object that is being serialized / deserialized via the XmlSerializer in C#, .NET 3.5. One of the properties (and more in the future) is a collection: List where T is an enum value. This serializes / deserializes fine. We are also using a "default values" mechanism to provide default values for the object, in case the seriali...

C# XML string element with Name attribute

Hi, I am trying to create a c# object for serialization/deserialization with a string property. The property needs to generate an element and also have an attribute: eg: ... <Comment Name="CommentName"></Comment> ... If the property is a string, I cant see how to add the attribute, and if the comment is an object with Name and Value...

C# XML Insert comment into XML after xml tag

I am using a C# object to Serialize/Deserialize XML. I would like to add a comment to the XML file whilst serializing, this comment will be a basic <!-- comment --> after the standard xml tag <?xml version="1.0" encoding="UTF-8"?> This comment does not need to be deserialized, its a basic comment to indicate the product and version th...

System.InvalidOperationException was unhandled - XMl Serialization C#

Hi I made an xml document by using XML Serialization. It looks like this <?xml version="1.0" encoding="utf-8"?> <Course xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"&gt; <courseName>Comp 1510</courseName> <backgroundColor>#ffffff</backgroundColor> <fontColor>#ffffff</fontColor...

WCF, XmlRoot, and optional parameters

I have a WCF service and cannot use DataContracts since I need more control over the XML received and sent to this service. As such, I use XmlRoot, and XmlElement... the problem I'm running into now is that my class that the receiving xml gets deserialized into and the serialized response both need to have the same root name, and when I ...

XStream: How do I map xml mixed attributes and elements to POJOs?

This must be a newbie question, but I could not get it from http://xstream.codehaus.org. Well, I have the following xml string <cat age="4" > <name>Garfield</name> </cat> which needs to be mapped to: class Cat { int age; String name; } Is there a simple way to do that using XStream? If not, what else could I try? Thanks in...

Casting xml to inherited class

I have 2 class: public class ClassA public class ClassB (from another namespace) : ClassA I have xml files fill with ClassA. How to cast it to ClassB while deserialization. is it possible ?? ...

Deserializing to create WebControls?

I'm trying to use an XML definition to describe a form. I'd like to use the XmlSerializer to Deserialize a file to create custom WebControls. However, it looks like I'm getting a namespace conflict: when I make my class inherit from Control, I get "The XML element 'EnableTheming' from namespace '' is already present in the current scop...

XML deserialization problem (attribute with a namespace)

hi, I'm trying to deserialize the following XML node (RDF actually) into a class. <rdf:Description rdf:about="http://d.opencalais.com/genericHasher-1/dae360d4-25f1-34a7-9c70-d5f7e4cfe175"&gt; <rdf:type rdf:resource="http://s.opencalais.com/1/type/em/e/Country"/&gt; <c:name>Egypt</c:name> </rdf:Description> [Serializable] ...

Iterate through deserialized xml object

I have a deserialized xml c# objet. I need to iterate through the oject to display all items, in this case there's just one, and display the name, colors and sizes for each item. The xml: <?xml version="1.0" encoding="utf-8"?> <Catalog Name="Example"> <Items> <Item Name="ExampleItem"> <Colors> <Color Name="Black" Va...

XML Deserialization of complex object

I have xml structure like this: <Group id="2" name="Third" parentid="0" /> <Group id="6" name="Five" parentid="4" /> <Group id="3" name="Four" parentid="2" /> <Group id="4" name="Six" parentid="1" /> parent is denotes Group's Id. The Constructor of Group reads like: public Group(string name, int ID, Group parent) While De-seri...

XML deserialization doubling up on entities

I have an XML file that I am attempting to deserialize into it's respective objects. It works great on most of these objects, except for one item that is being doubled up on. Here's the relevant portion of the XML: <Clients> <Client Name="My Company" SiteID="1" GUID="xxx-xxx-xxx-xxx"> <Reports> <Report Name="Fi...

How to deserialize "<MyType><StartDate>01/01/2000</StartDate></MyType>"

How to deserialize "<MyType><StartDate>01/01/2000</StartDate></MyType>" below is the MyType definition [Serializable] public class MyType { DateTime _StartDate; public DateTime StartDate { set { _StartDate = value; } get { return _StartDate; } } } ...

How to Deserialize XMLDocument to object in C#?

I have a .Net webserivce that accepts XML in string format. XML String sent into the webserivce can represent any Object in the system. I need to check the first node to figure out what object to deserialize the XML string. For this I will have to load the XML into an XMLDocument (Don't want to use RegEx or string compare). I am wonderin...

XML Deserialization in VB/VBA

I have a set of VBA classes in an MS Access database. I have an xml string with data I want to create new classes with. Other than setting each property individually, is there an easy way to deserialize the XML into my object? I've seen the code using the TypeLib library Public Sub ISerializable_Deserialize(xml As IXMLDOMNode) Dim...

Issue allowing custom Xml Serialization/Deserialization on certain types of field

I've been working with Xml Serialization/Deserialization in .net and wanted a method where the serialization/deserialization process would only be applied to certain parts of an Xml fragment. This is so I can keep certain parts of the fragment in Xml after the deserialization process. To do this I thought it would be best to create a ne...

writing a Simplest XML DeSerialization class for the simplest xml file. How to avoid the nesting? deserialize at root?

Hi, I want to deserialize an xml file which has to be just in this form <Basket> <Fruit>Apple</Fruit> <Fruit>Orange</Fruit> <Fruit>Grapes</Fruit> </Basket> Out of the examples I read on internet the least possible format I could find was the following <Basket> <FruitArray> <Fruit>Apple</Fruit> </FruitArray> <FruitArr...

Question about XML deserialization in .net

Hi, I'm trying to deserialize an XML that comes from a web service but I do not know how to tell the serializer how to handlke this piece of xml: <Movimientos> <Movimientos> <NOM_ASOC>pI22E7P30KWB9KeUnI+JlMRBr7biS0JOJKo1JLJCy2ucI7n3MTFWkY5DhHyoPrWs</NOM_ASOC> <FEC1>RZq60KwjWAYPG269X4r9lRZrjbQo8eRqIOmE8qa5p/0=</FEC1> <IDENT_CLIE>IYbofEiD...