4,685 questions
0
votes
0
answers
34
views
mlSerializer: "Types 'Base.ClassTest' and 'Message1_0.ClassTest' both use the XML type name 'ClassTest'" when serializing inherited classes
I am working with XML serialization in C# where I have multiple versions of a message class that inherit from each other.
Here’s a simplified version of my code:
namespace XMLSerializeProblem.Base
{
...
1
vote
1
answer
71
views
Serializing a value object to XML and back with DataContractSerializer
I'm working with a .NET 8 codebase that uses DataContractSerializer to convert an object model into XML and back again (for storing in a file system). At the moment, none of the classes used in the ...
1
vote
1
answer
47
views
Why does using XmlElement mess up serialization?
I need to generate some .xml given an example file. I notice that some of the nodes break convention and are camelCase instead of PascalCase. I'd like my code models to keep good conventions, but ...
0
votes
0
answers
43
views
Seralizing multiline text from XML with XmlSerializer and newlines
I have a C# class that includes a string property:
public string Location { get => _Location; set => _Location = value; }
private string _Location;
I use XmlSerializer for reading and writing ...
0
votes
2
answers
43
views
C#.NET XML Serialization: XMLAttribute is not setting NameSpace and only Password Element within UserName Object is having Attribute
I am trying to generate this Soap XML:
<soapenv:Envelope xmlns:bsvc="urn:com.workday/bsvc" xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0....
1
vote
1
answer
55
views
Why XmlSerializer.UnknownAttribute/UnknownNode event raised when deserializing child classes?
I have been having problem with deseriailizing XML code genereated by XmlSerializer when child classes are used. The UnknownAttribute and UnknownNode events triggers and I assumed there was an error ...
0
votes
2
answers
64
views
Get rid of xsi:type and use tag names instead
I have some derived classes to serialize to XML:
public void Main()
{
LevelCollection collection = new LevelCollection();
collection.Add(new SubLevel1("aaa"));
...
0
votes
1
answer
32
views
Serialize documents with the same name but different properties into one class
I'm trying to read two Aux files with one class, but I'm having trouble.
I'm getting an error when I try to serialize my class. The xml schema is defined by a third-party and I can't change it.
The ...
0
votes
3
answers
116
views
Is there a good way to handle XML deserialization of files that can have nested nodes with variable names within C#?
I am working on a deserializer in C# for an XML file type for a program I don't have any control over. Unfortunately, the XML file structure completely breaks conventions in two major ways, as far as ...
1
vote
1
answer
111
views
C# - How can I (de)serialize internal classes (from)to XML with attributes?
I want to (de)serialize internal classes.
internal class Data
{
public string? Name { get; set; }
public string? Type { get; set; }
public List<DataWithAttribute> DataList { get; set;...
0
votes
0
answers
163
views
XmlSerializer unable to resolve assembly at constructor
I am calling the following constructor:
var serializer = new XmlSerializer(typeof(List<Slot>));
and end up with this exception in the log :
Unable to resolve assembly System.Private.CoreLib....
2
votes
1
answer
46
views
C# Serialization hide array name of list containing sub classes
My goal is to output XML like the sample below:
<FunctionList name="list1">
<Space title="RoomA">
<Space title="Cabinet1">
<Device title="...
1
vote
1
answer
71
views
How to Handle Optional Xml Elements using C++ boost::serialization
I'm using C++ boost::serialization library to read and write configuration XMLs. To provide backward compatibility to the user, while reading an XML if some XML elements are absent, it needs to have ...
0
votes
0
answers
102
views
ASP.NET Core use dependency injection for custom type in xml output formatter
In my ASP.NET Core project, I have a custom type which needs to be serialized using some external service:
public struct MyCustomType
{
private int value;
public MyCustomType(int value) { ...
0
votes
1
answer
148
views
XML Serialisation - dynamic namespace of root node
This is my class:
[XmlRoot(ElementName = "Package")]
public class Package<T>: MyBase
{
public Messages<T> Messages
{
get { return _messages; }
set { ...