xmlserializer

Could not load file or assembly 'MyAssembly.XmlSerializers [duplicate]

孤人 提交于 2019-11-30 14:30:14
问题 This question already has answers here : XmlSerializer giving FileNotFoundException at constructor (18 answers) Closed 3 months ago . I took a memory dump of IIS and while analyzing i found the error that said 'Could not load file or assembly MyAssemblyName.XmlSerializers' . In my code i am using XmlSerializer class to serialize and deserialize xml contents from xml file to custom object. When the project gets build it only creates MyAssembly.dll and MyAssembly.pdb file but not the MyAssembly

C# Deserialize XML to object

喜夏-厌秋 提交于 2019-11-30 13:39:33
Having problems deserializing some xml into an object in C#. The error that I receive is... xmlns=''> was not expected. The XSD that I received to generate my class is as follows... <?xml version="1.0" encoding="UTF-8"?> <xs:schema targetNamespace="xml.AAAAAAA.com/commerce/apres-vente_technique/assistance" xmlns:pgp="xml.AAAAAAA.com/commerce/apres-vente_technique/assistance" xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" attributeFormDefault="unqualified"> <xs:element name="ListeAvisRemboursements"> <xs:annotation> <xs:documentation>Liste des avis de remboursements<

XML Serialisation - When To Use DataContractSerializer / Binary / XMLSerialiser

南楼画角 提交于 2019-11-30 09:55:04
I ve been looking at this for a while now It seems that binary serialisation is discouraged as any change to field names breaks serialisation =? Not Good XMLSerializer is problematic because you have to provide a no arg constructor and public fields although you do have more control over elements being attributes or elements and their naming DataContractSerializer is good but all suclassses need to be explicitly added which is a shame However I stumbled across NetDataContractSerializer which does not have this limitation. If your goal is C# serialisation and no big constraints on size of xml

XML, what is this: null or empty element?

孤者浪人 提交于 2019-11-30 02:56:09
问题 Regarding to my other question: XML deserialize null elements? I've got elements like these from a third-party server for API testing: <Taxable /> <DefaultPurchasePrice /> I just realized that now I am confusing myself about whether elements like that represent null object or empty. Talking about objects, they are same, null object normally means empty object reference right? But trying to map a XML element to a datafield/value, they could be different i.e null string is empty string, but for

C# Deserialize XML to object

吃可爱长大的小学妹 提交于 2019-11-29 19:16:48
问题 Having problems deserializing some xml into an object in C#. The error that I receive is... xmlns=''> was not expected. The XSD that I received to generate my class is as follows... <?xml version="1.0" encoding="UTF-8"?> <xs:schema targetNamespace="xml.AAAAAAA.com/commerce/apres-vente_technique/assistance" xmlns:pgp="xml.AAAAAAA.com/commerce/apres-vente_technique/assistance" xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" attributeFormDefault="unqualified"> <xs

Deserialize random/unknown types with XmlSerializer [duplicate]

谁说胖子不能爱 提交于 2019-11-29 17:21:38
问题 This question already has an answer here : Deserialize XML To Object using Dynamic (1 answer) Closed 4 years ago . I am using XmlSerializer to communicate with a service. This is not a regular SOAP service, it has its own XML object types. For example, I may ask for a <Capabilities> object, but it may return an <Exception> . So, in other words, I have to deal with random XML document types. I do however, know which types I have to deal with. What I am trying to do is to find a generic

Deserializing XML with unknown element order

天涯浪子 提交于 2019-11-29 16:42:04
I'm trying to implement a client for a service with a really deficient spec. It's SOAP-like, although it has no WSDL or equivalent file. The spec also doesn't provide any information about the correct ordering of elements - they're listed alphabetically in the spec, but the service returns an XML parse error if they're out of order in the request (said order to be derived by examining the examples). I can work with this for submitting requests, even if it's a pain. However, I don't know how to handle responses correctly. With both SoapEnvelope and directly with XmlSerializer , if the response

XSD.EXE + JSON.NET - How to deal with xxxSpecified generated members?

陌路散爱 提交于 2019-11-29 16:09:50
When using XSD.EXE to generate classes from an XML Schema, it generates xxxSpecified members of any primitives of a given object: <xs:complexType name ="Foo"> <xs:all> <xs:element name ="Count" type = "xs:integer"/> </xs:all> </xs:complexType> ....generates: public class Foo { public int Count { get; set; } public bool CountSpecified { get; set; } } It appears the latest version of JSON.NET can automatically set these properties when deserializing. string request = "{ Count : 10 }"; var object = JsonConvert.Deserialize<Foo>(request) Assert.IsTrue(object.Count = 10); // Yup Assert.IsTrue(object

XmlSerializer + Polymorphism

让人想犯罪 __ 提交于 2019-11-29 11:47:01
Given a (contrived) base class, and a sub class we want to serialize via WCF using the XmlSerializer. We decorate a collection (see the response class) as per the article: http://msdn.microsoft.com/en-us/library/system.xml.serialization.xmlelementattribute.aspx (see remarks section). Issue is that although the correct WSDL seems to be generated, SVCUtil generates a class file where the GetUserResponse class contains a property named Items. Is this to do with applying [XmlElement] to an array? Although the XmlArray element doesn't have a Type property. Thanks in advance. [Serializable] [XmlType

Prefix SOAP XML Instead direct namespace

折月煮酒 提交于 2019-11-29 11:08:47
I am working with one of our partner to integrate our business services. I am using WCF (.Net 3.5) to communicate with partner web service. I think partner web service is written in Java. Using SVC util I generated proxy class. Instead DataContract serializer, svcutil used xmlserializer. But WSDL provided by partner and the web service response SOAP xml does not match. Since the partner not interested in changing the wsdl, I have changed downloaded WSDL manually to match the response. That issue has been fixed. Now I am running into different problem. When I send a request to the web service,