ixmlserializable

XML Serialization, in this case, IXmlSerializable or Attributes

I've done some XML serialization before but i used Attributes, I'm not sure this is doable for my next assignment, here's a brief list of XML manip requirementes. General Purpose XMl manipulation, tied to a treeview, no schema. Load/Save XML. Load/Save Attributes as well as Values (i believe the term is Element Text?), and be mindful o...

IXmlSerializable

Could you guys help me I have a problem with deserialization via IXmlSerializable var ArrayOfAccounts = new Accounts(); //This class structure I'm trying to read Class Accounts:List<Session>{ } Class Shedule{ public DateTime StartAt { get; set; } public DateTime EndAt { get; set; } } Class Session:IXmlSerializable { public strin...

IXmlSerializable, reading xml tree with many nested elements

Could you guys give me an example how to read and write from/to xml like this: <Foolist> <Foo name="A"> <Child name="Child 1"/> <Child name="Child 2"/> </Foo> <Foo name = "B"/> <Foo name = "C"> <Child name="Child 1"> <Grandchild name ="Little 1"/> </Child> </Foo> <Foolist> ...

XmlAttributeOverrides further customization

XmlAttributeOverrides is a good way to override some attributes for serialization. MSDN says: You can control and augment the serialization of objects found in a DLL, even if you do not have access to the source And I have a question is it possible to implement some custom algorithm with XmlAttributeOverrides? For example if you want t...

Will implementing IXMLSerializable create a serializer DLL file in my Temp directory?

Normally, when using the XMLSerializer to automagically serialize an ISerializable object, a .dll file is generated on C:\WINDOWS\Temp. If I implement IXMLSerializable instead, where I'm telling it how to serialize / deserialize, will it also generate this DLL? I have a very simple class to serialize, and I'm trying to avoid this automa...

What is the correct way to serialize nullable types?

I'm implementing IXMLSerializable in one of my classes. It contains a few numeric properties that are nullable (int? double? etc..) What is the correct way to serialize/serialize these through IXMLSerializable? Here's what I'm doing now, which works, but obviously does not seem like the correct way to do it. void IXmlSerializable.Write...

C# : WCF Service with IXMLSerializable member turns into DataSet

.NET I have a web service, one of the data members of a message implements IXmlSerializable, when I do "Add Service Reference" that member becomes a DataSet. I am trying to pass a serialized Expression<TDelegate> as a parameter to the web service. Q: How do I make a DataSet out of the IXmlSerializable instance on the client side? ...

Is it possible to exclude some members of a type from XmlSerializer serialization?

I have some public members I don't want to be serialized, was wondering if there is an attribute for it? ...

IXmlSerializable with valid XmlSchema (XMLSchema:schema' element is not declared..)

Hi, I am trying to implement IXmlSerializable. My class implements serializable and writes a single string. I wish to be able to export an object graph schema using XsdDataContractExporter (the standard one). The class serializes to a simple xml. <Urn ns='http://palantir.co.za/urn'&gt;somestring&lt;/Urn&gt; My implementation of Get...

Should domain objects implement IXmlSerializable?

I'm building a REST API that exposes data as XML. I've got a whole bunch of domain classes in my domain layer that are intended for consumption by both the service layer behind the API, and the client API that we will be providing to customers. (Customers do have the option of interacting directly with the REST API, but the client API si...

Exporting WSDL/XSD schemas for data contract types with IXmlSerializable

I'm creating a WCF service which I want to consume from a Java app. But the question isn't about .net-java interop. The key point is one of types related to a service operation is IXmlSerializable. That type return its XSD schema with static method referenced by XmlSchemaProviderAttribute. The problem is when we get wsdl for the service...

Custom Serialization using XmlSerializer

I have a class that I need to do some custom XML output from, thus I implement the IXmlSerializable interface. However, some of the fields I want to output with the default serialization except I want to change the xml tag names. When I call serializer.Serialize, I get default tag names in the XML. Can I change these somehow? Here is my...

How to revert back to 'default' XML serialization when implementing IXmlSerializable in a base class?

I'm trying to serialize a class that inherits from a base class that implements IXmlSerializable. The base class, called PropertyBag is a class that allows dynamic properties (credits to Marc Gravell). I implemented IXmlSerializable so that the dynamic properties (stored in a Dictionary) are written as normal xml elements. e.g. Whe...

Finding References in IXmlSerializable.

Hi, I am writing elements of a particular type into the outgoing xml using IXmlSerializable. I have implemented the schema, and am writing the items out. The code that follows is an example. public void IXmlSerializable.WriteXml(XmlWriter writer) { // Write Out Class. foreach (var item in myItems) { DataContractSerializer ds = ...

Custome XmlSerialization for nested objects.

Hi, I have a scenario in which I have a class Resource which has two other classes nested in it; Action and ResourceURL. I need to write custom xmlserializer for Resource and Action but not for ResourceURL. I implemented IXmlSerializable for both. The problem is, when Resource is serialized, i call the Action.WriteXML(XmlWriter) to get...

Implementing IXmlSerializable for content containing data with or without CDATA tags

I am trying to figure out a way to parse an xml tag where content is passed in with CDATA tags for some input, but not for all. For example, the following is sample content I would receive for data which contains CDATA tags. But there is some other scenarios where the CDATA tags are ommited. <Data><![CDATA[ <h1>CHAPTER 2<br/> EDUCATION...

How to save a datatable if it contains an object that refuses to serialize?

Hello expert coders, I'm storing GData "Event" objects from the Google API in a datable (Ok, I had to cast them as an object or they wouldn't go in), and I can access all the properties of the events perfectly, and use them to update Google, but I cannot serialize the datatable (or a parent dataset) to file because: Type 'Google.GData.C...

handle null values for string when implementing IXmlSerializable interface

I have the following class that implements IXmlSerializable. When implementing WriteXml(), I need to handle the case where the string members of this class may be null values. What is the best way of handling this? Currently, I am using the default constructor in which all the string properties are initialized to empty string values. ...

IXmlSerializable Dictionary problem

I was trying to create a generic Dictionary that implements IXmlSerializable (credit to Charles Feduke). Here is my trial: Sub Main() Dim z As New SerializableDictionary(Of String, String) z.Add("asdf", "asd") Console.WriteLine(z.Serialize) End Sub Result: <?xml version="1.0" encoding="utf-16"?><Entry key="asdf" value="a...

Is there a way to make a serialized member to serialize as an attribute?

Is there a way to make a serialized member to serialize as an attribute: <Serializable> Public Class Person Public Property Name As String End Class I want than when this class is xml-serialized, it should produce: <Person Name="John Doe" /> And what I mean is that instead of the Name property should be serialized as an elemen...