xml-serialization

Serialize Datetime without GMT in C#

Hello, I have generated classes from xsd and want to serialize the DateTime. My class looks like private System.DateTime timeGMT; [System.Xml.Serialization.XmlElementAttribute(DataType="time")] public System.DateTime TimeGMT { get { return this.timeGMT; } set { this.timeGMT= value; } }...

Dictionary<K,V> that implements IList<V>

I find myself often faced with this problem: I have a dictionary where the key is some simple numeric ID and the value is an object. The ID is also contained in a specific property of that value object. Then, I want to be able to deserialize some (format-inflexible) XML that looks like: <listitem> <id>20359</id> <someotherval>f...

How do I add content to an existing XML file??

I do have an xml generator written in PHP. sample is given below but few lines only due to space issues. $output = '<?xml version="1.0" encoding="UTF-8"?>'."\n"; $output .= '<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns="http://purl.org/rss/1.0/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:ta...

C# - Xml serializing ambiguous complex types

I have a problem that can perhaps be solved in a more efficient or clean way, than my current solution. Over the past days I have gotten a fairly good understanding of how Xml serialization can be controlled via attributes, but one part of the Xml structure is so obscure, that I have not been able to find a smart solution. I have been ...

What is the best way to change python object into XML?

I've tried lxml and eventually had to write the whole code for saving object as xml which isn't perfect. I suppose there is a neat way to do it but I just can't find it. I'm looking for something more like pyxser. Unfortunately pyxser xml code looks different from what I need. For instance I have my own class Person Class Person: ...

Parsing an XML file -options?

I'm developing a system to pick up XML attachments from emails, via Exchange Web Services, and enter them into a DB, via a custom DAL object that I've created. I've manage to extract the XML attachment and have it ready as a stream... they question is how to parse this stream and populate a DAL object. I can create an XMLTextReader and...

.NET Parent/Child XML Deserialization Help

Hi, I have a XML doc with parent/child references that I want to deserialize into .NET objects but am unable to do so. Below is the XML snippet: <family> <parents> <parent id="1" name="Sam" /> <parent id="2" name="Beth" /> <parent id="3" name="Harry" /> </parents> <children> <child id="100" name="Tom"> <paren...

XmlDocument.Load(xml) generates No Root Element error from XmlSerializer serialized code.

I have a class like so: [XmlRoot"MyMessageType")] public class MyMessageType : BaseMessageType { [XmlElement("MessageId")] //Property for MessageId ... <snip> //end properties. } This class contains a static method to create an XmlDocument instance to pass to a BizTalk server. Like so: public static XmlDocument...

WPF Navigation Between Windows

I have designed 5 windows and all of them are having tab controls. Is there a better way or other ways to navigate between them ? I am now doing it like window1 w = new Window1(); w.Show(); this.Close(); also I am serializing an ApplicationContext class to an xml file which I have created to store all of the information of the appli...

Boost serialization fails in release mode while working in debug

I am using boost serialization with xml files with a C++ program. When I test my program in debug mode, it is working fine. Then I try with the exact same file in release mode, but my program fails when loading the files. I even tried to generate the xml files with my program in release mode, load them back, and it crashes as well. The...

how to convert sql server 2008 database to its xml form?

Hi, I have a database in sql server 2008. I want to convert it in it's xml format. What I have to do? What is the procedure ? Please guide me. I don't want to write the code for this in any language. Is there any facility given in sql server 2008 ? ...

What is the fastest way to generate lots of XML data?

I'm working on a Java utility that generates a bunch of XML documents matching a specific DTD using slightly randomized layout generation (so, for example, the document might look like <a><b><c /></b></a> or it might look like <a><b/><b><c>text</c></b></a>. Right now, I've gotten it to the point where I can generate roughly 32,000 docum...

How can I XML Serialize a DateTimeOffset Property?

The DateTimeOffset property I have in this class doesn't get rendered when the data is represented as Xml. What do I need to do to tell the Xml serialization to render that proper as a DateTime or DateTimeOffset? [XmlRoot("playersConnected")] public class PlayersConnectedViewData { [XmlElement("playerConnected")] public PlayersC...

Write Serialized XML to String and Display in Browser

I have a serialized object which needs to be sent as an encrypted XML string. I am able to save the serialized object to a well-formed XML file, but this is not what I want. I have already got Rijndael encrypt/decrypt working for a sample string. Person person = new Person("Irish", "Chieftain"); XmlSerializer xmlSerializer = new XmlSeri...

How to change the name of a collection of a custom class upon XML serialization?

I'm serialising a List of a class and I'm not happy about the generated XML output. [Serializable()] public class Foo { [XmlAttribute] public String Property1 { get; set; } public Foo() { } } public class Foo2 { List<Foo> _list = new List<Foo>() { new Foo(){ Property1="hello"} }; // ... // code f...

WPF, XML databinding into dependent/cascading ComboBoxes

I have an XML file with the following structure: <Products> <Product name="MyProduct1"> <Components> <Component name="MyComponent1"> <SubComponents> <SubComponent name="MySubComponent1"/> <SubComponent name="MySubComponent2"/> ...more SubComponent nodes... </SubComponents> ...

Storing/serializing list of objects

I oftem run into this case of what is the correct way to store a list of objects as a property in a class and how to properly serialize them into XML. For instance, we have a TabGroup class which will contain zero or multiple Tabs. Is it better to a have a list of Tabs property or a list of references to Tabs? Provided that Tabs are id...

DataContractSerializer and its issues - search for better serializer

We've already established previously that DCS serializes/deserializes objects alphabetically. However, after further investigation I've discoverred this is not entirely true. If we have a structure like this: [DataContract] public class Content { [DataMember] public string Title; [DataMember] public string Slug; [D...

Store And Replay WCF Messages

Hi all, I want to store WCF messages in some storage and read them later on in order to "replay" them again. Attached some code parts: private void WriteMessage(Message message, string path) { FileStream fileStream = new FileStream(path, FileMode.Create); using (XmlDictionaryWriter writer = XmlDictionaryWriter.CreateBinaryWriter...

De-serializing some XML (via a Stream) into Parent/Child objects

I have a fairly simple DAL assembly that consists of an SalesEnquiry Class which contains a List<T> of another Vehicle class. We'll be receiving XML files by email that I'm wanting to use to populate instances of my SalesEnquiry class, so I'm trying to use de-serialization. I've added XMLRoot/XMLElement/XMLIgnore attributes to both cla...