I have that code:
...
request data = new request();
data.username = formNick;
xml = data.Serialize();
...
[System.Serializable]
public class request
{
public string username;
public string password;
static XmlSerializer serializer = new XmlSerializer(typeof(request));
public string Serialize()
{
Strin...
I have an xml as below
<Image Id="23" Name ="image1">
<Used_in Name ="Label1" />
</Image>
Here Image node has been serialized as an object of Image class
[XmlElement(ElementName = "Image")]
public class Image
{
[XmlAttribute]
public string Name
{
getter and setter
}
[XmlAttribute]
public string ID
{
getter and setter
}
}
While...
We have a schema that we serialize and deserialize into an object hierarchy.
Some elements are optional in the schema. The xsd tool creates a cs file that inserts a property for each optional element. This property ends in "Specified", i.e. nameSpecified tells the serializer and deserializer to include the optional "name" element when pr...
Is there a pattern, Xml structure, architecture technique we can use to create simple data holder class code that we can deserialise to/from and do that at runtime?
We're in the early design stage of a .Net project and one of our goals is to make the resulting system extensible through configuration without needing a developer. We need ...
Consider the following serializable classes:
class Item {...}
class Items : List<Item> {...}
class MyClass
{
public string Name {get;set;}
public Items MyItems {get;set;}
}
I want the serialized output to look like:
<MyClass>
<Name>string</Name>
<ItemValues>
<ItemValue></ItemValue>
<ItemValue></ItemValue...
I have an XML document, several actually, that will be editable via a front-end UI. I've discovered a problem with this approach (other than the fact that it is using xml files instead of a database... but I cannot change that right now).
If one user makes a change while another user is in the process of making a change, then the second...
Here are my classes: http://pastebin.com/3dc5Vb1t
When I try to run
BookStore b = new BookStore();
b.LoadFromXML(Server.MapPath("list.xml"));
Label1.Text = b.ToString();
I get the following error:
You must implement a default accessor on System.Collections.Generic.LinkedList`1[[Book, App_Code.cxsacizw, Version=0.0.0.0, Culture=ne...
Hello
I've this strange issue. I've an xml string which looks like below -
<key><int>5</int></key><value><int>10</int>
The above xml is obtained after serializing a Dictionary using Paul's Code. Now i want to convert the xml back to the dictionary.
How can i get the type "int" from the xml and declare the dictionary as follows?
Dic...
<autos>
<cars>
<car>
<type>Toyota</type>
<year>1999</year>
</car>
<car>
<type>Honda</type>
<year>2010</year>
</car>
</cars>
</autos>
i want to extract car object from the above code whats the possible way. can i have the sample code or any example
thanks in advance
...
greetngs,
i have two classes:
[Serializable]
public class FireGridUnit
{
public GridUnit FireGridLocation { get; set; }
}
[Serializable]
public class FireResult: FireGridUnit
{
public bool Hit { get; set; }
public bool ShipDestroyed { get; set; }
public Ship.ValidShips DestroyedShipType {get; set;}
public bool ...
I have a base class with a property called Name, which has an XmlText attribute.
When an inherited class is serialized I get an exception saying:
There was an error reflecting type
'[type name]'. --->
System.InvalidOperationException:
Cannot serialize object of type '[type
name]'. Base type '[base type name]'
has simpleCon...
OK. I'm trying to work on communicating with the Pivotal Tracker API, which only returns data in an XML format. I have the following XML that I'm trying to deserialize into my domain model.
<?xml version="1.0" encoding="UTF-8"?>
<stories type="array" count="2" total="2">
<story>
<id type="integer">2909137</id>
<project_id typ...
My XmlFile looks like this:
<?xml version="1.0"?>
<document-inquiry>
<publication-reference data-format="docdb" xmlns="http://www.epo.org/exchange">
<document-id>
<country>EP</country>
<doc-number>2160088</doc-number>
<kind>A1</kind>
</document-id>
</publication-reference>
</document...
Let's suppose I have xml like this one:
<Server Active="No">
<Url>http://some.url</Url>
</Server>
C# class looks like this:
public class Server
{
[XmlAttribute()]
public string Active { get; set; }
public string Url { get; set; }
}
Is it possible to change Active property to type bool and have XmlSerializer coer...
I have a class I am using for serializing various configuration options for an application I am working on. I'm adding a new property to the class that is a List, and I'd like it to fill this list if it does not exist already in a XML file. My first thought was to check if the list contained zero items, however this is not acceptable bec...
I am trying to XML-serialize a nested class. Both classes have dictionaries which I am serializing using this link.
Serialization works fine but the nested class doesn't get de-serialized.
Can you please let me know how to do it?
...
I have an XmlSerializer object, and I have added 2 event handlers to the UnknownElement and UnknownAttribute events, as below:
XmlSerializer xs = new XmlSerialiser(typeof(MyClass));
xs.UnknownAttribute += new XmlAttributeEventHandler(xs_UnknownAttribute);
xs.UnknownElement += new XmlElementEventHandler(xs_UnknownAttribute);
Each of th...
i have a scenario where in i need to send an xml as a tag content in a SOAP request message to a webservice for example
<arg_1><xml version="1.0" encoding="UTF-8"?><sometag><somemoretag>abcd</somemoretag></sometag></arg_1></code>
arg_1 happens to be an String parameter to a webservice. So i bring in a CDATA section for this
<arg_1><!...
Hi,
I am looking at the examples given at the XML_Serialize pear plugin manual.
I can't figure out what the option 'addDecl' does in this plugin.
What does this do?
I can't seem to find it in their documentation...
...
I'm writing a simple program that will run entirely client-side. (Desktop programming? do people still do that?) and I need a simple way to store trivial amounts of data in a structured form, but really don't see any need to use a database system. What's more, some of the data needs to be serialized and passed around to different users,...