xml-serialization

Mapping collection to XML in Castor

Hi, I'm trying to map a POJO to XML using Castor. Let's say I have a Order that has a collection of Items... is there any way of achieving an xml like the following: <order> ...order attributes <items> <item> ..item attributes </item> <item> ..other item </item> </items> </order> I could make something similar but wit...

Is it possible to get any database's elements as a set queriable classes with EF?

Hello, I'm trying to make an application in which both the developer and the end user are allowed retrieve data from a relational DB (chosen at runtime) without writing any SQL code at all (and preferably no string concatenations when interacting with the database). The purpose of the application is to two things: a GUI to an expression...

How to preserve the table schema when you write dataset out as XML

The heading pretty much explains what I would like to achieve, but here is an example to elaborate further: Given the following table: CREATE TABLE [CustSchema].[TestTable]( [Desc] [varchar](50) NOT NULL ) ON [PRIMARY] When I load this table into a DataTable, and then spit it out again using DataSet.WriteXml(), I get the followin...

.NET XML serialization in 2009

Possible Duplicate: Replacement for XML Serialization Is something new besides old XmlSerializer on the world of xml serialization in .Net universe? Update: This is probably duplicate of better asked question. ...

Parsing slightly off-kilter XML in C# with XmlSeralizer

I've been given some "XML" files that don't quite have a proper schema (I think that's the problem) and the medical device that generates them cannot be changed to generate easy-to-parse XML. (With such a tantalizingly small modification (extra wrapping Images tags around the Image entries) it would be trivial to read these files---isn't...

What types of Exceptions can the XmlSerializer.Deserialize method throw?

Hello everyone, For this method, XmlSerializer.Deserialize, what kinds of exception may be thrown? XmlException? InvalidOperationException? I did not find any exception description information from this method. My question is what kinds of exception could be thrown from this method? http://msdn.microsoft.com/en-us/library/dsh84875.aspx...

Xml Serialize Object (HttpBrowserCapabilities)

There is a native framework object called HttpBrowserCapabilities. I'd like to Serialize this to XML. Any ideas of the best way to go about it? My first thought was to create my own class that inherits it then decorate all the properties with XML and then serialize it. I was wondering if there was a simpler (magical) way to do this. ...

Xml Serialize Object and Add Elements even when missing values

I've created an object with 100+ elements and not all of them are showing up in the final XML after serialization. What can I add to the [XmlElement] decorator to make sure it is in the final XML even if it is empty? ...

The easiest way to populate a collection from XML file in .NET

I have the following XML file: <?xml version="1.0" encoding="utf-8" ?> <scripts> <ScriptName> <name> "My Name" </ScriptName> <ScriptBody> "body contents" </ScriptBody> </script> </scripts> And the following object: public class DbScript { #region Constructors public DbScript() ...

Serialize to XML - private properties

Hello. I'm looking for a way to serialize a POCO that contains some read-only properties. In some Google and StackOverflow searches, I've seen the following suggestions: use DataContractSerializer; or use SoapFormatter or BinaryFormatter; or replace my readonly properties by read/write properties; My classes are very simple, they loo...

XmlSerialization problems on compact framework 3.5

Hello, I am doing a finger exercise and trying to write a application that lets my computer and windows mobile phone communicate over bluetooth trough serial port. Now I have ran into a snag with the serialization of objects. Binary seralization is not supported by .Net Compact Framework so I am opting for XmlSerialization. I have writt...

XML Serialization woes in Mono

Here's my class: [Serializable()] [XmlRootAttribute("Language")] public class Language : ISerializable { string Id { get; set; } string Part2B { get; set; } string Part2T { get; set; } string Part1 { get; set; } string Scope { ...

XML deserialization fail

I am deserializing the following XML file. Using XML serializer with VSTS 2008 + C# + .Net 3.5. Here is the XML file. <?xml version="1.0" encoding="utf-8"?> <Person><Name>=b?olu</Name></Person> Here is the screen snapshot for the display of the XML file and binary format of the XML file, If there are some solutions to accept suc...

default xmlns serializing as blank on string object

I'm using a Serializable Dictionary code object. For some reason when I serialize the object in a SOAP web service the the string object serializes with a blank namespace. I cannot get it to go away.: XmlSerializer valueSerializer = new XmlSerializer(typeof(TValue)); foreach (TKey key in this.Keys) { writer...

Getting XML serialization to automagically ignore non-serializable properties

I'm using the .NET serialization classes to XML serialize and log argument values that get passed to certain functions in my application. To this end I need a means to XML serialize the property values of any classes that get passes, but ignoring any properties that cannot be XML serialized (e.g. any Image type properties). I could go t...

How do you serialize a string as CDATA using XmlSerializer?

Is it possible via an attribute of some sort to serialize a string as CDATA using the .Net XmlSerializer? ...

XML Serialization/Deserialization in C++

I am using C++ from Mingw, which is the windows version of GNC C++. What I want to do is: serialize C++ object into an XML file and deserialize object from XML file on the fly. I check TinyXML. It's pretty useful, and (please correct me if I misunderstand it) it basically add all the nodes during processing, and finally put them into a...

How do I ignore an [XMLIgnore] Attribute

I'm trying to serialize some objects obtained from a 3rd Party .NET Lib to an XML File. When I Go To Definition for the object, some of the Properties of that object are marked as [XMLIgnore] Is there any way to tell my System.Xml.Serialization.XmlSerializer to ignore the fact that some properties have that attribute and that it shoul...

Implementing IXmlSerializable on a collection object

I have an xml file looking somewhat like this: <xml> <A>value</A> <B>value</B> <listitems> <item> <C>value</C> <D>value</D> </item> </listitems> </xml> And I have a two objects representing this xml: class XmlObject { public string A { get; set; } public string B { get; set; } List<Item> listitems {...

When reflecting: Should set property or directly set value? (Objective-C)

I'm writing an xml serialization class for objective-c. The point is to give the class a class type and an xml file. It should return an instance with data. I've got it working, and it does quite a bit - handles primitives (+nsstring), user defined classes and nsarrays. Doesn't handle pointers or C-arrays. Obviously this relies heavily ...