I've got a class like this:
[XmlRoot("channel")]
public class Channel
{
[XmlElement("title")]
public String Title { get; set; }
[WhatElseGoesHere]
[XmlArrayItem("item")]
public List<Item> Items { get; set; }
}
My desired output is this:
<channel>
<title>The title</title>
<item>{item content}</item>
<item>{ite...
My Python application currently uses the python-memcached API to set and get objects in memcached. This API uses Python's native pickle module to serialize and de-serialize Python objects. This API makes it simple and fast to store nested Python lists, dictionaries and tuples in memcached, and reading these objects back into the applic...
I leveraging the XmlSerializer to convert to/from XML. Here is an example class:
[XmlRootAttribute("myClass")]
public class MyClass {
private string someField;
[XmlElement("someField")]
public string SomeField {
get {
return someField;
}
set {
someField = value;
}
...
I want to serialize my enum-value as an int, but i only get the name.
Here is my (sample) class and enum:
public class Request {
public RequestType request;
}
public enum RequestType
{
Booking = 1,
Confirmation = 2,
PreBooking = 4,
PreBookingConfirmation = 5,
BookingStatus = 6
}
And the code (just to be sure i'm not doing it w...
Is there a way to get XmlSerialization in .NET to ignore certain properties while serializing?
For example, I have a public bool Property called IsValid and its the only Property of the object that I don't want serialized. How could I do this?
...
Aloha,
I have a 8MB XML file that I wish to deserialize.
I'm using this code:
public static T Deserialize<T>(string xml)
{
TextReader reader = new StringReader(xml);
Type type = typeof(T);
XmlSerializer serializer = new XmlSerializer(type);
T obj = (T)serializer.Deserialize(reader);
return obj;
}
This code runs...
Hi,
Is there a way to customize XML serialization in JAXB, in the same way that it's possible using IXmlSerializable in .NET? (i.e. the ability to directly control serialization of an object using the equivalent of an XmlReader/Writer).
I've taken a look at XmlAdapter and @XmlJavaTypeAdapter, but they just seem to be used to transform ...
Usually I have no problem ticking the box that generates serialization assemblies for my .Net code.
However, I just changed by platform target to 'x86' instead of 'Any CPU' to fix some problems when running on x64 architecture.
Now, I get the error that Trigger.XMLSerialization.dll references Trigger.dll [version=0.0.0.0 culture=neutra...
This is my first time using XML Serialization and this is driving me absolutely nuts after 2 days of trying to troubleshoot this.
I get this error when the deserialization kicks in:
The XML element 'name' from namespace '' is already present in the current scope. Use XML attributes to specify another XML name or namespace for the eleme...
[XmlElement(ElementName = ElementConstants.CreateDate,
Namespace = "http://api.facebook.com/1.0/",
DataType = "date", Type = typeof(DateTime))]
public DateTime CreateDate { get; set; }
And if I try taking out the DataType in the attribute I get : {"The string '1233469624' is not a valid AllXsd value."}
Here is an example of o...
Hi guys: I have to export my data, practically the entire domain model structure into a formal xml file. Does anyone know a visual tool that I can use to map an xml schema to my .NET object model?
...
So I'm working with some XML files that I believe are most likely badly formed, and I'm trying to figure out how and if I can use the XmlSerializer to deserialize this XML into a logical business object. Let's say I have the following XML file:
<Root>
<ArrayType1 Name="Bob"/>
<ArrayType1 Name="Jim"/>
<ArrayType2 Name="Frank">
...
Hi ... I hope that someone can help me with this problem that I've been having with XmlSerializer.
I've already looked through this thread: http://social.msdn.microsoft.com/Forums/en-US/asmxandxml/thread/551cee76-fd80-48f8-ac6b-5c22c234fecf/
The error I am getting is:
System.InvalidOperationException: Unable to generate a temporary c...
Using ASP.NET WebServices, by default you can't pass any IDictionary objects, because xml serialization for IDictionaries isn't supported. I have found various ways to serialized dictionaries (http://weblogs.asp.net/pwelter34/archive/2006/05/03/444961.aspx, http://blogs.msdn.com/psheill/archive/2005/04/09/406823.aspx, http://www.mattber...
Is there a way to generate Ruby classes (maybe even ActiveResource classes) from an XSD so that they contain a way to serialize the classes to xml valid for the initial XSD?
I know that soap4r has xsd2ruby but it appears that the generated ruby classes cannot be easily serialized to xml.
...
I have a loop in a BackgroundWorker that saves some stuff via xml Serialization when needed but this seems to load a new assembly each time
'xxyyzz.Main.vshost.exe' (Managed): Loaded '9skkbvdl'
'xxyyzz.Main.vshost.exe' (Managed): Loaded 'd2k4bdda'
and so on. Why is this happening? Is there any thing i can do about it? Is this...
This is one i struggled with for ages so thought I'd document somewhere. (Apologies for asking and answering a question.)
(C# .net 2.0)
I had a class that was being serialized by XmlSerializer, I added a new public property however it wasn't being included in the output XML.
It's not mentioned in the docs anywhere I could find, but pu...
I have a set of custom XML configuration management classes in .NET.
There are two configuration scopes in my application:
User: the setting applies to the user regardless of the account she's logged into. Stored in a XML config file in the user's directory.
User/Account: the setting applies to the user when logged into a particular ...
<FileTransferSettings>
<UploadPath src="user">C:\uploads</UploadPath>
<DownloadPath src="app">C:\downloads</DownloadPath>
</FileTransferSettings>
I'd want to deserialize this XML into a FileTransferSettings object with 2 properties - UploadPath and DownloadPath. But I also want to preserve the src attribute for each property in a...
A base project contains an abstract base class Foo. In separate client projects, there are classes implementing that base class.
I'd like to serialize and restore an instance of a concrete class by calling some method on the base class:
// In the base project:
public abstract class Foo
{
abstract void Save (string path);
abstra...