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

Using custom class as JAX-WS parameter: How to write JAXB adapter for type safe enum?

I have some old code (pre Java 1.5) that uses classes to implement type safe enums, something like: public class MyTypeSafeEnum implements java.io.Serializable { private final int value; private MyTypeSafeEnum(int value) { this.value =…
iruediger
  • 933
  • 6
  • 9
2
votes
1 answer

C# Object to XmlElement

What is the best way to convert the C# object to XmlEmenet? Do I just use XmlSerializer and import the XmlNode or is there a better way? This is what I found out there wondering if there is any other better way. public XmlElement…
Natasha Thapa
  • 979
  • 4
  • 20
  • 41
2
votes
1 answer

Add prefix to XML Root Node - Implementation of Scott Hanselman's suggestion?

I would like to add a namespace prefix to the XML root node and I found an entry by Scott Hanselman which details exactly what I would like to achieve. The only problem being the implementation is missing ! Modifying the namespace PREFIX of the…
Preets
  • 6,792
  • 12
  • 37
  • 38
2
votes
2 answers

Oracle logging changes to XML

I want to log data changes in some of Oracle tables. Structure of log table is: (...) olddata (xmltype) newdata (xmltype) Data changes will be logged by triggers on update, insert, delete Is there any easy way to make code below…
piotrpo
  • 12,398
  • 7
  • 42
  • 58
2
votes
2 answers

Enforce constructor called only from Serialization

In our codebase any classes that need to be saved are IXmlSerializable, this means that they all have public parameterless constructors. The problem with this, is I have to stick a remark above each one "Only for serialization purposes" because…
Ian
  • 33,605
  • 26
  • 118
  • 198
2
votes
2 answers

Xml Serialization of a custom XSD type

I have a C# class member like so: class Case { string ID; string JurisdictionID; } the corresponding XSD looks like:
Jeff Swensen
  • 3,513
  • 28
  • 52
2
votes
0 answers

How to ignore exceptions while deserializing xml to an object

I have written a web api which accepts xml and converts to json (a specific object) . Problem Statement: If xml contains wrong data type exception is thrown. Desired situation: xmlserailizer should ignore for the fields where execption is…
Abi Reddy
  • 79
  • 5
2
votes
2 answers

How to partially marshall/unmarshall an object?

I have a class A with attributes B b and C c that I want to marshall and unmarshall in a way that in c instead of having an java object graph, I want a string representation of the XML fragment, i.e. @XmlRootElement(namespace="test") public class A…
ilcavero
  • 3,012
  • 1
  • 31
  • 27
2
votes
2 answers

XML serialization - build a list of child elements of a certain type

I am brand new (day 2) to c# so I apologize ahead of time if my terminology is a bit off. Consider the following XML and class models:
drkstr
  • 609
  • 6
  • 9
2
votes
1 answer

C# XmlSerializer Serialize the same class with different namespaces

Suppose I have a class: using System.Xml; using System.Xml.Serialization; class Foo { [XmlElement(ElementName="Bar")] public string Bar {get; set;} } And now I want to serialize it. But. I want to specify different namespaces, On one…
cicatrix
  • 163
  • 1
  • 10
2
votes
2 answers

How do I create C# class model to get XML serialized request in given format?

I am designing my class model. The serialized message of the class model needs to be in this format: TesterScript CD_20110628133820576
InfoLearner
  • 14,952
  • 20
  • 76
  • 124
2
votes
1 answer

additional attributes in both JSON and XML

I am currently trying to incorporate attributes in the API of my Rails app. The use case is simple. I have a User model: class User < ActiveRecord::Base attr_accessible :email end I have another model, basically linking the users to an…
2
votes
1 answer

List Collection XML Serialization

I've been playing around with the xml serialization for a while and I've hit a problem with serializing the a list collection. I want to serialize a list collection without the upper element wrapping around it. See example below: Result…
madness800
  • 181
  • 1
  • 2
  • 13
2
votes
0 answers

Rails #to_xml don't add root elements

As far as I know, this is valid xml, if not the most elegant: ... ... When parsing this (with HTTParty's built in Crack::XML) I get {:items => {:item => [...]}} Fine, but when I convert this back to…
tfwright
  • 2,844
  • 21
  • 37
2
votes
3 answers

XML in C# to varbinary column in SQL

I have an XmlDocument object that I load from a file. XmlDocument xmlDoc = new XmlDocument(); xmlDoc.Load("C:\\myxml.txt"); I need to convert this XML Document to a format that is compatible with varbinary in a SQL table. How can I achieve this?
jkh
  • 3,618
  • 8
  • 38
  • 66