xml-serialization

Is there something in C# that lets me keep a .XML file (with its content and everything) in memory, then save the document to disc as a regular XML file?

I'm going to be doing some webscraping and my plan is to have something like this: public class Searcher { public void Search(string searchTerm) { } private void Search(string term) { //Some HTMLAgilityPack Voodoo here } private void SaveResults() { //Actually save the results as .XML f...

Load XML file into object. Best method?

Hello, We are receiving an XML file from our client. I want to load the data from this file into a class, but am unsure about which way to go about it. I have an XSD to defining what is expected in the XML file, so therefore i can easily validate the XML file. Can i use the XSD file to load the data into a POCO, using some sort of ser...

XML Serialization and Soap Serialization

Hi I think even if we will not need interoperability between applications, and even we do not communicate with web services, it is easier to serialize using SoapFormatter than XmlSerializer because SOAP will serialize the private members by default, while XmlSerializer will work on public properties and fields. actually I cannot find a...

Unqualifing a xml in c#

Hello, Is there an smart way of unqualifing (clean namespaces references) a XML in c#? All the xml references the same schema. Thanks in advance. ...

How to specify the order of XmlAttributes, using XmlSerializer

XmlElement has an "Order" attribute which you can use to specify the precise order of your properties (in relation to each other anyway) when serializing using XmlSerializer. Is there a similar thing for XmlAttribute? I just want to set the order of the attributes from something like <MyType end="bob" start="joe" /> to <MyType star...

"Wrapping" a BindingList<T> propertry with a List<T> property for serialization.

I'm writing an app that allows users search and browse catalogs of widgets. My WidgetCatalog class is serialized and deserialized to and from XML files using DataContractSerializer. My app is working now but I think I can make the code a lot more efficient if I started taking advantage of data binding rather then doing everything manuall...

Getting ActiveRecord (Rails) to_xml to use xsi:nil and xsi:type instead of nil and type

The default behavior of XML serialization (to_xml) for ActiveRecord objects will emit 'type' and 'nil' attributes that are similar to XML Schema Instance attributes, but aren't set in a XML Namespace. For example, a model might produce an output like this: <user> <username nil="true" /> <first-name type="string">Name</first-name> <...

XMLSerialization Floating Point Accuracy

Is it guaranteed that the binary representation of singles, doubles, and floats will be identical to the original after serializing and deserializing? ...

Is that a RESTFUL MVC Web Service?

I am aware of Web Services and WCF but I have generic question with services. I have a ASP.NET MVC Application which does some basic functionality. I just have a controller in which I am passing it the records and serializing the information to XML using XML Serializer. Then I return this information to the browser and it displays me ...

Delphi 2010 - Decode Base64 encoded image from XML doc

I am trying to decode a base64 encoded EMF image from an XML document in my application and render it on screen, however, it never seems to appear. If I copy/paste the data from the XML document into Notepad++ and use the Base64 Decode option and save the file as a .emf it opens fine in mspaint. So I think the issue is how I am decoding...

How to change the Array Element names in XmlSerialization?

Hi Guys, Consider the following code: [Serializable] public class Human { public string Name { get; set; } } Then, using (MemoryStream ms = new MemoryStream()) { Human[] mans = new Human[] { new Human() { Name = "Moim" } }; XmlSerializer xs = new Xm...

How to rename WSDL complex schema elements type?

Folks, I am running out an issue. I am creating a web service in C# that should be consumed by an existing client (written with ATL). Actually this client used to invoke a ATL based web service before, now I need to change the URL of the client so that it can invoke a different web service which I am about to write with C#. I found some...

Best way to generate a soap xml message?

What is the best way to generate soap xml in c#? I prefer to use xml-serialization if possible. Also, I need to add some custom attributes to the soap header, so not sure if this complicates things. One more note: I'm connecting to a soap server on a linux server over TCP - the soap server was built in C++. Also, the soap server do...

XML serialization in .NET - problem deserializing to xsd.exe-generated C# class

I'm working with data consumed from a RESTful service that looks like the following: <?xml version="1.0" encoding="UTF-8"?> <couponfeed> <link type="TEXT"> ... </link> <link type="TEXT"> ... </link> ... </couponfeed> I have the xsd, and I generated C# classes from it using the xsd.exe utility. Here is the relevant pa...

XML to Type - Quick way?

Team; How are you doing? Im breaking my head trying to do this that seems simple but I can't figure it out... Suppose I have this XML as a string: <calles> <calle> <nombre>CALLAO AV.</nombre> <altura>1500</altura> <longitud>-58.3918617027</longitud> <latitud>-34.5916734896</latitud> <barrio>Recoleta</barrio> </calle>...

Can objects be (de)serialized in richfaces xhtml?

Can Richfaces (de)serialize objects? Say for instance, I have a row of data being displayed in a richfaces table. Can I serialize the row of data to a string and later deserialize it back into a row? ...

Serializing a list of Key/Value pairs to XML

I have a list of key/value pairs I'd like to store in and retrieve from a XML file. So this task is similar as described here. I am trying to follow the advice in the marked answer (using a KeyValuePair and a XmlSerializer) but I don't get it working. What I have so far is a "Settings" class ... public class Settings { public int s...

How to deserialize an element as an XmlNode?

When using Xml serialization in C#, I want to deserialize a part of my input XML to an XmlNode. So, given this XML: <Thing Name="George"> <Document> <subnode1/> <subnode2/> </Document> </Thing> I want to deserialize the Document element to an XmlNode. Below is my attempt which given the XML above, sets Document to the 's...

svcutil, XmlSerializer and xsd:list

I'm using svcutil to generate classes from service metadata. This XML schema <xsd:complexType name="FindRequest"> ... <xsd:attribute name="Significance" type="Significance" use="optional" /> </xsd:complexType> <xsd:simpleType name="Significance"> <xsd:list> <xsd:simpleType> <xsd:restriction base="xsd:int"> ...

Problem serializing primitive data using WCF

Scenario: WCF client app, calling a web-service (JAVA) operation, wich requires a complex object as parameter. Already got the metadata. Problem: The operation has some required fields. One of them is a enum. In the SOAP sent, isnt the field above (generated metadata) - Im using WCF diagnostics and Windows Service Trace Viewer: [System...