I have some types that I want to serialize/deserialize and generate a UI based on the selected object. The UI will also change the object which in turn I will have to serialize to store it in my app.
So:
[obj_apple stored in the app] -> select obj_apple -> deserialize -> show in UI -> use the UI to change obj_apple -> deselect obj_appl...
I have the following structure in C#:
[Serializable]
public struct Line
{
public Line(Point startPoint, Point endPoint)
{
StartPoint = startPoint;
EndPoint = endPoint;
}
public Point StartPoint;
public Point EndPoint;
}
which I use in another class, that is XmlSer...
Hi,
I'm currently using couchdb to store documents as JSON. One of my clients needs to grab XML (for now). Anyone know any good javascript libraries that can take a javascript object (or json string) and export valid xml?
Thanks!
...
I implement an xml serialization based on Marc's answer.
Should this be part of the class itself, ie Apple.Serialize/Deserialize?
Although Deserialize would be static in that case, as you might not have an instance to call it on.
Or should I have another class for Serialize/Deserialize? If so, these seem to be generic enough? What sho...
Hi,
I need to model in memory a collection web files, but that relationships between them. That is file A (e.g. html) may have a link to file B (e.g. css) and file C (e.g. javascript). Also file D may also require file B. If I wanted to delete file A I would need to make sure any files it uses (e.g. file B) is not also being used ...
I have two XMLDocuments that contain some similar information but there are other nodes that contain different information between the two.
I am using XMLSerialization to put my data into a structure as shown here
I know you can merge XML files by using a DataSet as shown here but I want to somehow serialize the first document I see in...
I'm serializing a class like this
public MyClass
{
public int? a { get; set; }
public int? b { get; set; }
public int? c { get; set; }
}
All of the types are nullable because I want minimal data stored when serializing an object of this type. However, when it is serialized with only "a" populated, I get the following xml
...
I'm currently having a really weird issue and I can't seem to figure out how to resolve it.
I've got a fairly complex type which I'm trying to serialize using the XmlSerializer class. This actually functions fine and the type serializes properly, but seems to take a very long time in doing so; around 5 seconds depending on the data in ...
using System.ComponentModel;
using System.IO;
using System.Xml.Serialization;
namespace SerializerTest {
static class Program {
static void Main() {
using (TextWriter textWriter = new StreamWriter("data.xml")) {
Data data = new Data();
new XmlSerializer(typeof(Data)).Serialize(textWriter, data);
textW...
I am trying to create serializable class but I want to map second level element to my property of class. What's the best way of doing this.
Example xml & class
<SearchResult>
<Head>
<Title q="test">My search Result</Title>
</Head>
<Results>
<Result>...</Result>
<Result>...</Result>
<Result>...</Result>
</Results>
</SearchRe...
Trying to write a list of oracle commands to XML but keep getting this error. This is driving me crazy. Thanks in advance.
"There was an error reflecting type 'System.Data.OracleClient.OracleCommand'."
Friend Sub WriteDataToFile(ByVal Commands As List(Of System.Data.OracleClient.OracleCommand))
Try
Dim PathName As String...
Hello, I'm having a difficult time finding information on how to elegantly serialize ActiveRecord objects.
We would like to use XML as the format because we need to output our objects in such a way that another program will be able to feasibly parse them.
XML-Serialization is usually very easy and straightforward to implement, but the ...
Hi - I'm a bit stumped here. I just really want to XML Serialize an Array<> but I'm getting: "You must implement a default accessor on System.Array because it inherits from ICollection."
A snippet from my code is below. Any idea?
Array a = Files.ToArray();
XmlSerializer serializer = new XmlSerializer(typeof(Array));
TextW...
I have a DataTable with rows of data. I have a class with properties that match the row column names.
How can I have a List that is populated from the DataTable Row information?
Do I call something like (MyType)new XmlSerializer(typeof(MyType)).Deserialize(new XMLReader(Table.WriteXML()));
...
I have an array of elements that I need to serialize using XmlSerializer. The problem I'm having is I have 2 derived classes, and serializing them so they have an element name of the common base, doesn't seem to work.
So, this is how the XML should look:
<Root>
<Base> foo </Base>
</Root>
Instead, I'm getting
<Root>
<Derived...
So im pulling in the XML from Twitter via OAuth
So Im doing a request to http://twitter.com/account/verify%5Fcredentials.xml
Which returns the following XML
<?xml version="1.0" encoding="UTF-8"?>
<user>
<id>16434938</id>
<name>Lloyd Sparkes</name>
<screen_name>lloydsparkes</screen_name>
<location>Hockley, Essex, UK</location>...
I want to save my object to hard disk (like cache) with XmlSerializer. In this case, I don't have any problem.
However, when I want to deserialize this XML to an object, I get an error. Is there any way
to deserialize XML to an unknown object or to an object that I created?
...
I have an xml file that I would like to generate a c# class for. Is there any quick and easy way to do this? I don't have a schema to go with my xml file, it's just raw xml. Any ideas?
Thanks.
...
The following (abysmal) code demonstrates how standard serialize/de-serialize in VB loses the CR when on de-serialize. This can be overcome by applying 'XmlAttribute(DataType:="string")' to Description. Why does it do this? I would like to fix this without applying a 'LF' -> 'CR''LF' in every affected class. This is fixing a bug in exist...
I'm currently searching for an easy way to serialize objects (in C# 3).
I googled some examples and came up with something like:
MemoryStream memoryStream = new MemoryStream ( );
XmlSerializer xs = new XmlSerializer ( typeof ( MyObject) );
XmlTextWriter xmlTextWriter = new XmlTextWriter ( memoryStream, Encoding.UTF8 );
xs.Serialize ( x...