4,685 questions
0
votes
0
answers
35
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
49
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
2
answers
47
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....
0
votes
2
answers
65
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
3
answers
120
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 ...
0
votes
0
answers
166
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....
1
vote
1
answer
74
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
1
answer
156
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 { ...
0
votes
1
answer
94
views
Boost serialization with empty container
I am using boost ( 1.69.0 ) serialization to generate an XML template file.
The result I want to achieve is unfortunately bad.
This is example code:
struct A
{
struct B
{
int bInt;
...
0
votes
1
answer
46
views
XmlSerializer skipping items in non-pretty format xml
In case my xml file has the non-pretty format:
<ArrayOfColumn><Column><COLUMN_NAME>SomeName1</COLUMN_NAME></Column><Column><COLUMN_NAME>SomeName2</...
0
votes
1
answer
60
views
Infinite loop during XML file serialization (java.beans)
In the process of serializing to XML file, I'm encountering an infinite loop issue. I'm using java.beans, and through XMLEncoder, I'm attempting to serialize three classes: Category, Contact, and ...
0
votes
1
answer
104
views
C# Serialize PSCredential to XML with XmlSerializer
Experienced with PowerShell, but new to C#.
I am creating a Binary PowerShell Cmdlet and have run into an issue when trying to serialize PSCredential to XML with the XmlSerializer.
When I serialize ...
1
vote
2
answers
310
views
XmlSerializer crashes when encountering xml attribute (namespace)
Im trying to Deserialize a XML im getting from a service.
But the XmlSerializer failes when encountering the first attribute.
My shortened xml looks like this:
<?xml version="1.0" ...
2
votes
1
answer
206
views
How to Serialize/Deserialize an unordered_map member of a derived Class
So I'm building a simulated file-system in C++ to study the language better and maybe some system level programming. Im using Boost::Serialization to save the state of the file system when the user ...
-1
votes
1
answer
73
views
C# how to deserialize XML string which has nested same node [duplicate]
<n-hierarchy>
<n name="ABC" n_id="971" />
<n name="XYZ" n_id="972">
<n name="jkl" n_id="973">
...
0
votes
0
answers
71
views
WCF CreateMessage fails on escaped ASCII characters
I am migrating a WCF client application from DotNet Framework to DotNet (Core) 7. The object I am using serializes using ASCII character 0x07 as a separator, which under DotNet Framework would be ...
0
votes
2
answers
100
views
How can I serialize 24 hours time to / from XML using C#?
I know how to serialize a "Date" to / from XML using C#:
[XmlElement(DataType ="date")]
public DateTime LastInvited { get => _LastInvited; set => _LastInvited = value; }
...
0
votes
1
answer
602
views
Unclear why this Swagger UI fails with 'FormatterNotFoundException' exception only for this specific property
How to make the example working in Swagger while still having [Produces("application/json", "application/xml")] definition in controller method.
In .Net Core 6 API, have set up ...
0
votes
0
answers
25
views
How can I selectively return full XML properties in one method and partial in another using the same C# class?
I have a problem with serialization c# in .net
public class User
{
public int Id { get; set; }
public string Name { get; set; }
public string Email { get; set; }
}
Is possible to control ...
1
vote
1
answer
93
views
Deserializing legacy XML class types into new class types
I'm supporting a legacy, internal API that uses two classes that are serialized using XML. Both classes are sub-classes of a common base class:
namespace My.Namespace {
[
Serializable,
...
0
votes
0
answers
223
views
C# - Serializing to XML information as to which function to bind a delegate too
I need to be able to save a delegate with the information of which function it is connected to. Something like this:
In C#:
public class Skill
{
[XmlAttribute("SkillFunction")]
...
1
vote
0
answers
41
views
IXmlSerializable struct throws InvalidProgramException on Deserialize()
I have a pretty simple console application. Ignoring missing checks, the program is as follows:
using System.Drawing;
using System.Xml;
using System.Xml.Schema;
using System.Xml.Serialization;
...
-1
votes
1
answer
368
views
Deserializing XML-file with SOAP-envelope and invalid xsd-address
I want to deserialize this kind of XML-files that have SOAP-envelope and invalid .xsd address in the header that doesn't exist anymore (finvoiceack.xsd). Would like to get the nodes to dataset or into ...
1
vote
1
answer
1k
views
C# Deserialization of xml file returns "'There is an error in XML document (1, 2).'" error
I'm trying to deserialize an xml response I get from a call.
I've used Visual Studios "Paste Special" function to prepare my program for how the file is gonna look, and the only change I've ...
-2
votes
1
answer
789
views
Dynamic XML serializer in C#
Passing the root to the xsd.exe, successfully generates the Classes with the proper structure according to the XSD,
we can now assign values to the objects of those classes and populate them, the ...