Questions tagged [xml-serialization]

This tag refers to serialization technologies which use XML as a data format.

This tag refers to serialization technologies which use XML as a data format. In the context of .NET, it refers to the XmlSerializer class, less so to the DataContractSerializer class, still less to the SoapFormatter class.

4687 questions
2
votes
1 answer

remove type declaration from XML while serialize

I need to get clear xml without any namespace and type declarations. Here is the serialized xml: ... Need to someway configure…
Alexey Kulikov
  • 1,097
  • 1
  • 14
  • 38
2
votes
5 answers

XML serialization query

I have the following XML which needs deserializing/serializing:
David Neale
  • 16,498
  • 6
  • 59
  • 85
2
votes
2 answers

XmlSerializer How to exclude null value but keep the tag ? c#

My class public MyClass { [DataMemberAttribute(EmitDefaultValue = true)] public decimal? a { get; set; } [DataMemberAttribute(EmitDefaultValue = true)] public DateTime? b { get; set; } …
KingMaker
  • 83
  • 1
  • 1
  • 13
2
votes
1 answer

XML serialization of derived class in a list, need to set member on parent class

As a hobby, I'm making a 2D RPG in XNA and C#. I have a class called ObjectiveData. Its only member is a string called objectiveID. Derived from this are various other classes (GatherItemsObjectiveData, SpeakToNPCObjectiveData, etc) - all of them…
2
votes
1 answer

How to serialize a Linq to Sql object graph without hiding the child's "Parent" member

Without hiding the Child object's reference to the Parent object, has anyone been able to use an XmlSerializer() object to move a Linq to SQL object to an XML document, or is the only appropriate way of handling this to create a custom…
Richard B
  • 1,581
  • 1
  • 15
  • 31
2
votes
1 answer

How would you implement better serilization/deserialization in Haxe for XML?

The server I use at work (out of my control) always uses XML in the responses/requests. So I have to receive XML, parse it (with FAST currently), make all the objects by hand and then send back an XML response after some application activity. It's…
user1261710
  • 2,539
  • 5
  • 41
  • 72
2
votes
1 answer

Add namespace to XmlTextWriter using C#

I have an serializeable class that his root is serizlized to XmlRootAttribute with namespace. I want to add additional namespace to this root elemt, how can i do it? adding XmlAttribute failed to compile. The…
developer
  • 41
  • 3
2
votes
2 answers

"The specified type was not recognized" exception when trying to invoke a webservice call

I'm trying to call a third party webservice using WSE 3.0 as a client in Visual Studio 2005. The call works fine and I can see that I get a good response (I have tracing enabled), but apparently the xml parser chokes over it. I always get an…
2
votes
3 answers

Serialize class with structs of same type name

I'm trying to XML serialize a class that contains two structs with the same name: public class MyClass { public System.Windows.Size WSize = new System.Windows.Size(); public System.Drawing.Size DSize = new Size.Drawing.Size(); } The resulting…
MikeH
  • 4,242
  • 1
  • 17
  • 32
2
votes
3 answers

DataContractSerializer: preserve string member that happens to be raw xml?

I'm a little inexperienced with the DataContract paradigm, and I'm running into a deserialization problem. I have a field that's a string, but it contains xml and it's not being deserialized correctly. I have a feeling that it's because the DCS is…
bwerks
  • 8,651
  • 14
  • 68
  • 100
2
votes
1 answer

Restsharp - Error attempting to serialize xmlns attribute on root node

When attempting to serialize an object to XML using RestSharp that contains an xmlns attribute on the root node, I receive the following exception: The prefix '' cannot be redefined from '' to 'https://someurl.com' within the same start element…
2
votes
1 answer

Protobuf-net Serialize creating hex characters

I'm currently doing a POC to prove that Protobuf-net is faster than the native C# serializer. But I'm experiencing a bug? on the serialize response. Here is the Error nativeResult
DevEstacion
  • 1,947
  • 1
  • 14
  • 28
2
votes
1 answer

Pear XML Serializer and Attributes

is there a way, to "tell" the PEAR XML_Serializer, which properties it should serialize as attribute and which as sub element? For example: class User { public $id; public $name; public $address; } Should be serialized like this:
2
votes
0 answers

Deserialize a property, but do not serialize back again C# Asp.net

I have an xml that contains certain information that was serialized in a certain version. Now in next version, I want that information to be deserialized, but dont serialize it back in the same property/element. That information will be handled in a…
WAQ
  • 2,556
  • 6
  • 45
  • 86
2
votes
2 answers

How do you (de)serialize a list of strings as CDATA using XmlSerializer

I need to serialize a list of strings as CDATA and thought I would follow an answer of How do you serialize a string as CDATA using XmlSerializer. It works like a charm for serializing. My XML file looks as desired:
AHalvar
  • 390
  • 2
  • 10
1 2 3
99
100