xml-serialization

XML Serializing a class with a Dictionary<string, List<string>> object

Is it possible to implement IXmlSerializable and in my XML file capture an object of type Dictionary> ? I have the following public class coolio : IXmlSerializable { private int a; private bool b; private string c; private Dictionary<string, List<string>> coco; public coolio(int _a, bool _b, string _c, Dictionary<string, List<string>>...

Generalised XML Serialization

I apologise for asking a question that's probably been asked hundreds of times before, but I don't seem to be able to find an answer in the archives; probably because my question is too basic. I know that XML Serialization by default only touches public members and properties. Properties very often mask a private variable; particularly ...

How can I implement partial serialization?

I've done a lot of serialization development lately, mostly for sending objects over sockets, but I've run into an interesting question: Is it possible to send just a few of the properties from an object through a serializer? My envisioned scenario is this: You have some sort of "state" object for each client, consisting of many propert...

Best Way To Save Data::Visual C# 2010

In advance, thank you for all of your advice... So I am building a C# app that will save SSH connection settings for users. It kind of resembles Putty allowing a user to enter multiple SSH connections. The user will be able to recall these settings for each connection when launched. I have been Googling today to determine the best way ...

Omit Properties from WebControl Serialization

I have to serialize several objects inheriting from WebControl for database storage. These include several unecessary (to me) properties that I would prefer to omit from serialization. For example BackColor, BorderColor, etc. Here is an example of an XML serialization of one of my controls inheriting from WebControl. <Control xsi:ty...

Deserializing child elements as attributes of parent

I have XML files which I need to deserialize. I used the XSD tool from Visual Studio to create c# object files. the generated classes do deserialize the files except not in the way which I need. I would appreciate any help figuring out how to solve this problem. The child elements named 'data' should be attributes of the parent element...

Serialize boost array

I would like to serialize a boost::array, containing something that is already serializable. If get this error: error C2039: 'serialize' : is not a member of 'boost::array<T,N>' I have tried to include the serialization/array.hpp header but it did not help. Is there another header to include ? Thanks EDIT: Removed a wrong link ...

representing an XML config file with an IXmlSerializable class

I'm writing in C# and trying to represent an XML config file through an IXmlSerializable class. I'm unsure how to represent the nested elements in my config file, though, such as logLevel: <?xml version="1.0" encoding="utf-8" ?> <configuration> <logging> <logLevel>Error</logLevel> </logging> <credentials> <user>user123</u...

How can i call resource file from xml document

how can i call varible from my resource file from a xml document like <items> <item rating="R"> <title>The Matrix</title> <format>"$resources:Format,Dvd"</format> </item> </items> ...

XML parsing design using xmlpp and C++

I would like to use an xml format similar to the following: <CONFIG> <PROFILE NAME="foobar"> <PARAM ID="0" NAME="Foo" CLASS="BaseParam"/> <PARAM ID="2" NAME="Bar" CLASS="StrIntParam"> <VALUE TYPE="STRING">some String</VALUE> <VALUE TYPE="INT">1234</VALUE> </PARAM> </PROFILE> </CONFIG> CONFIG contains a list...

synchronizing XML nodes between class and file using C#

I'm trying to write an IXmlSerializable class that stays synced with an XML file. The XML file has the following format: <?xml version="1.0" encoding="utf-8" ?> <configuration> <logging> <logLevel>Error</logLevel> </logging> ...potentially other sections... </configuration> I have a DllConfig class for the whole XML file an...

Easy XML Serializer for Java

I'm looking for a way to serialize Java objects into XML for use by a RESTful web service. I don't have an XSD. I have looked at the following: JAXB - fairly heavy weight with annotations required on classes and also an ObjectFactory class and/or a jaxb.index file Simple - requires annotations but no other config classes/files. Unfo...

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 ...

Why do we need serialization in web service

I have one webservice: public class Product { public int ProductId { get; set; } public string ProductName { get; set; } } public class Service : System.Web.Services.WebService { public Service () { //Uncomment the following line if using designed components //InitializeComponent(); } [WebMethod]...

Trimmed down JAXB for just unmarshalling?

I'm building an application where space is at a premium. I'd really like to use JAXB's unmarshalling capabilities, but including the whole library is out of the question. Has anyone pared it down so that only the bits needed for unmarshalling are included? ...

JAXB Mapping cyclic references to XML

I have an object graph that contains a cycle. How do I get JAXB to handle this? I tried using the @XmlTransient annotation in the child class but the JAXB marshaller still detects the cycle. @Entity @XmlRootElement public class Contact { @Id private Long contactId; @OneToMany(mappedBy = "contact") private List<Contac...

Marshalling empty list - jaxb

I have the following code int testInt = 2; String stringArg = "test"; List<Activity> activityList = new ArrayList<Activity>(); //activityList.add(new Activity(testInt, testInt, testInt, null, null, null, stringArg, stringArg)); //activityList.add(new Activity(testInt, testInt, testInt, null, null, null, stringArg, stringArg)); Activiti...

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...

Serializing WITHOUT xmlns

I have a couple extension methods that handle serialization of my classes, and since it can be a time consuming process, they are created once per class, and handed out by this method. public static XmlSerializer GetSerializerFor(Type typeOfT) { if (!serializers.ContainsKey(typeOfT)) { var xmlAttributes = new XmlAttribut...

XML Serialization with FSharp

I'm a total FSharp n00b, so I hope i give you enough information. I created a class called record. I create several instances of this class with data from our database. I then add each record to a list of records. i want to make an xml document with those records. //this is the record data type i created. I also created a sender and rec...