This tag refers to serialization technologies which use XML as a data format.
0
votes
0answers
7 views
DataContractSerializer not deserializing knowntypes properteis
I have a ASP.Net WebAPI Resource named as Vehicles (VehiclesController) with a POST method. My Client has a legacy system that will generate an xml document and post that xml to my Vehicle Resource. I ...
1
vote
1answer
2k views
Create object based on XmlChoiceIdentifier
I am creating objects dynamically using Activator(C#) and one of these classes looks like:
class Driver
{
Driver() { }
[XmlChoiceIdentifier("ItemElementName")]
[XmlElement("Bit16", typeof(...
0
votes
1answer
51 views
Trying to deserialization XML in C#
hello I am performing an XML deserialization
and I am getting this error:"There was an error reflecting field 'message'"
I think this is because the elements not have to be in the XML.. but no quite ...
0
votes
1answer
29 views
JAXB: easy way to annotate name of element tags for object lists
I was looking into a way to easily change the element name of a list of objects with JAXB when publishing them through a web service. Here is the example:
Say I have an object I want to serialize to ...
12
votes
8answers
8k views
How do you find out when you've been loaded via XML Serialization?
I'm trying to load a tree of objects via XML serialisation, and at the moment it will load the objects in, and create the tree quite happily. My issue revolves around the fact that these classes ...
0
votes
2answers
23 views
C# - XML serialization: omitting a certain element in my XML output
I have a weird XML setup here: I need to interface with a third-party and their XML layout that they're using is beyond my control - no chance to changing anything...
In the scope of a larger XML, I ...
0
votes
1answer
32 views
Serialize a List<KeyValuePair<string, object>>
Let's suppose we have an:
public List<KeyValuePair<string, object>> Items { get; set; }
How can we serialize it as follows:
<!--<SomeEnclosingElement>-->
<Key1>...
4
votes
1answer
3k views
Read XML into xsd.exe generated classes. Good idea?
I have a fairly complex XML coming my way and I have the XSD for it. I generated classes via xsd.exe and read XML into the class structure via the XmlSerializer described here.
It works great. ...
2
votes
2answers
118 views
Generic XML Serializer
I'm trying to implement generic XML serializer as described here:
http://blogs.msdn.com/b/field_notes/archive/2008/06/19/the-last-datacontract-serializer-on-earth.aspx
internal static class ...
0
votes
1answer
22 views
How to have Subclasses serialize parent value differently using XmlSerializer
Say I have the following class structure
abstract class Vehicle
{
string maker;
}
class Car : Vehicle
{
bool automatic;
}
class Motorcycle : Vehicle
{
string style;
}
class Bicycle : ...
4
votes
3answers
10k views
Simple XML deserialization
I am trying out the Simple XML serializer. I am more interested in deserialization from XML->Java. Here is my code as a unit test:
import java.io.StringReader;
import java.io.StringWriter;
import ...
0
votes
1answer
324 views
deserializing xml returns empty array
I am trying to deserialize the following xml:
<?xml version="1.0" encoding="utf-8"?>
<Themes>
<Theme Title="Default" Name="" SpriteCssClass="ThemeDefaultImage"></Theme>
...
0
votes
2answers
4k views
Convert xml as string
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><...
6
votes
1answer
1k views
Prevent serialization of null members in DataContractSerializer
Let me preface by saying I'm fairly new to WCF, and might be using the wrong terminology throughout here. My project has two components:
A DLL containing the classes for Attachment, Extension, ...
0
votes
1answer
16 views
Deserialize giving an error on xml that serialization created
I have created a test to read and write to a license file. Granted, this is a weak licensing but it will work for what we need if I can get it to work.
I found this blog that had serialization of a ...
0
votes
1answer
14 views
Consuming web service Xml.Serialization.XmlArrayItemAttribute
I am trying to send my request in to this TestList method defined in the WSDL:
<System.ServiceModel.MessageBodyMemberAttribute([Namespace]:="[service url here]", Order:=8), _
System.Xml....
1
vote
2answers
38 views
How to serialize a xml node with text value and other child nodes
I have a xml like this:
<xmlRootNode>
<levelOneChildNode>
Some text
<levelTwoChildNode>
<levelThreeChildNode>More text</levelThreeChildNode&...
1
vote
1answer
27 views
C# Get all text from xml node including xml markup using Visual studio generated class
Using xml to c# feature in visual studio converted the below xml markup into C# class.
<books>
<book name="Book-1">
<author>
<name>Author-1<ref>1</ref></name>...
0
votes
1answer
17 views
Parsing SOAP XML with XDocument
I work with legacy system (not my design) and it have some data persisted in db as serialized xml (SOAP).
XML was created with SoapFormatter.
SoapFormatter formatter = new SoapFormatter();
formatter....
1
vote
1answer
23 views
Conditional XML serialization of list items
I would like to know if one can conditionally exclude items in a list from being serialized using the ShouldSerialize* pattern. For example take the two classes:
public class Product{
public int ...
3
votes
2answers
63 views
Changing type of element in XML Serialization
I am having huge problems with XML serialization. I have two classes, both need to be serializeable. In the inherited class, I would like to change the serialization behavior, so that a string ...
8
votes
1answer
4k views
Should I consider the Simple XML Framework for Java?
Lately the Simple XML Framework gained popularity and some sites are presenting it.
I am thinking about replacing Apache Xerces-J with a new framework and I am considering Simple to be its successor.
...
35
votes
7answers
35k views
“Type not expected”, using DataContractSerializer - but it's just a simple class, no funny stuff?
I'm refactoring my XML-serialization, and figured I'd try the DataContractSerializer.
Everything runs smoothly, until it needs to serialize this class:
using System;
using System.Runtime....
1
vote
3answers
3k views
Protecting a sensitive value (password) when using XML serialization?
We have a class that holds the user's logon profiles, it's a simple class that we just serialize to disk. We could certainly encrypt, compress, etc. etc. the serialization process, however, I want to ...
6
votes
6answers
5k views
How do I change root element name while keeping contents using XmlSerializer?
I have an XML document:
<data>
<elmt1>Element 1</elmt1>
<elmnt2>Element 2</elmnt2>
<elmnt3>Element 3</elmnt3>
</data>
I need to ...
123
votes
12answers
197k views
Serialize an object to XML
I have a C# class that I have inherited. I have successfully "built" the object. But I need to serialize the object to XML. Is there an easy way to do it?
It looks like the class has been set up for ...
35
votes
4answers
43k views
Force XmlSerializer to serialize DateTime as 'YYYY-MM-DD hh:mm:ss'
I have a XSD schema for some RESTful service. When used in conjunction with xsd.exe tool to generate C# code, XSD's xs:date generates the following code:
[System.Xml.Serialization.XmlElementAttribute(...
0
votes
0answers
39 views
C# - How to serialize and derialize DataSet correctly?
I cannot deserialize the serialized dataset correctly if it has dates. The result is the dates are considered as a separate table instead of columns itself. It seems that it is not parsed correctly. ...
1
vote
2answers
18 views
How to serialize a XML node of repeated elements
I am trying to deserialize some XML into an array of items.
Here's the XML:
<?xml version=\"1.0\" encoding=\"utf-8\"?>
<items>
<item>
<name>John</name>
&...
22
votes
10answers
39k views
Can I force JAXB not to convert " into ", for example, when marshalling to XML?
I have an Object that is being marshalled to XML using JAXB. One element contains a String that includes quotes ("). The resulting XML has " where the " existed.
Even though this is ...
0
votes
3answers
1k views
Can't successfully clone XMLReader (Unexpected EOF)
I have a really strange problem with XMLReader/XMLTextReader classes.
I have a simple file load:
public void First()
{
XmlTextReader reader = new XmlTextReader(@"C:\MyXMLFile.xml");
...
1
vote
1answer
7k views
XML Serialization Error - There was an error reflecting type
I am trying to serialize few custom settings from configuration file.
Below are my settings:
<FavouriteTools>
<favouriteTool PluginPlaceHolder="FavoriteTool1" PlugInName="Brightness"
...
7
votes
3answers
30k views
How to serialize/deserialize a C# WCF DataContract to/from XML
I am developing a WCF service which will be consumed by multiple different client applications. In order to make one functionality work, the server needs to read an XML file into a C# DataContract ...
0
votes
0answers
47 views
.NET Need to convert XML into another format
I am making an MVC application where I am creating an XML from Dataset. Now I need to convert that XML into another format for repeating ID node as below.
Original XML :
<Requirements>
<...
-1
votes
1answer
27 views
What is the error with the input of the string that it causes nullreferenceexception?
The problem is with the else case, I have commented on the problem lines
static void Main(string[] args)
{
XMLData xmldataExample = new XMLData();
Usergaz usergazExample = new ...
4
votes
1answer
175 views
Why does .Net 4.0 build of client DataContracts cause MethodAccessException in .Net 4.5 application?
I have a class library named WebAccounts.dll that calls some (of my own) WCF web services. I have the web services project automatically build a client version of its data contracts for consumption by ...
2
votes
5answers
1k views
Can anyone give me a list of invalid XML characters
Following is the bug:
http://java.net/jira/browse/JAXB-614
Above said bug, recommends us to use the resolution mentioned in the following link:
http://blog.lesc.se/2009/03/escape-illegal-characters-...
1
vote
0answers
21 views
XmlSerializer removes data when serializing
I have a very annoying issue serializing a large XML object. I have defined a class FetchYearlyInvoiceStatusRequest:
[Serializable]
public class FetchYearlyInvoiceStatusRequest
{
[XmlArray("...
12
votes
3answers
8k views
Remove “d1p1” namespace prefix in DataContractSerializer XML output
I'm using DatacontractSerializer to serialize my domainModel into a xml file.
I'm getting output like below.
<z:anyType xmlns:i="http://www.w3.org/2001/XMLSchema-instance" z:Id="1" xmlns:d1p1="...
0
votes
2answers
1k views
XMLWriter extends attribute name with zdef?
I try to serialize some config classes to xml config files using the XMLMapper.
but I have some trouble with the attribute generation. Actually the generated XML is perfect, but XMLMapper adds ...
0
votes
1answer
30 views
Generate xml from c# class
I appreciate if someone could help me construct an XML in the following format:
<requests>
<row no="1">
<fl val="Subject">Add Records Demo</fl>
<fl val="ContactName">...
0
votes
1answer
24 views
Inherit parent element name into child with C# XmlSerializer
I have a class that looks like this:
public class CustomerType
{
public string Address {get; set;}
public string City {get; set;}
}
And another class like this:
public class CustomerInfo
{
...
1
vote
0answers
12 views
@XmlJavaTypeAdapter not being called when used with @XmlSeeAlso
I can't get the XmlJavaTypeAdapter working when it is set at class-level on a subclass of an abstract class annotated with XmlSeeAlso. The serialization is done but the adapter is never being called.
...
0
votes
1answer
284 views
Issue deserializing XML from SOAP request
I'm having difficulties deserializing XML from a SOAP request to an object.
The XML looks like this (I have control over this, so this can be altered):
<v001:OrderRequest xmlns:v001="http://...
0
votes
1answer
19 views
C# XmlSerializer Problems with serializer.Serialize
Long story short, I am making an ATM application for a school assignment. Bank account information needs to be stored into a file to keep those account balances up to date.
I have two questions - (...
0
votes
1answer
2k views
ERROR errors.GrailsExceptionResolver - Cannot reference implicit element
I am getting the below error when I try to use Xstream to marshal one of my groovy domain classes Employee. Employee hasmany employeDesiredSkills, which belongsTo Skill and Employee
Here is the ...
0
votes
0answers
15 views
Save values in XML Attribute/XML Element Values of Answers for Questionneer
I am making a questioner app for Xamarin iOS iPad App.
When someone open the app, then this shows the Categories, then from Categories this will open sub categories, from sub categories this will open ...
2
votes
1answer
438 views
get xml as string instead of class with xstream
I have xml something like
<parent>
<message>
<type>15</type>
</message>
</parent>
Instead of creating a message object inside parent object, I need to ...
0
votes
0answers
42 views
WCF XML response serialization - how to control prefixes structure and namespaces
I am having trouble with response xml structure and prefixes.
Original response:
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<ns11:...
0
votes
0answers
30 views
WCF XML structure serialization - how to remove wrapper node in array
I am having trouble with xml structure in array.
Original xml (what i need):
<!--1 or more repetitions:-->
<per:PERSON_DOC>
<!--Optional:-->
<per:PERSON_DATA>
<!--...