0

I have C# class with this header

[System.SerializableAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
[System.Xml.Serialization.XmlTypeAttribute(AnonymousType = true, Namespace = "http://www.finacle.com/fixml")]
[System.Xml.Serialization.XmlRootAttribute(Namespace = "http://www.finacle.com/fixml", IsNullable = false)]
public partial class FIXML

which produces XML like this

 <?xml version="1.0" encoding="utf-16"?>
  <FIXML xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="https://www.finacle.com/fixml">

Problem is I need to have different header, with custom schemalocation and encoding.
Which attribute I can use to produce this output :

<?xml version="1.0" encoding="UTF-8"?>
<FIXML xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.finacle.com/fixml executeFinacleScript.xsd" xmlns="http://www.finacle.com/fixml" >
Jalle
  • 1,566
  • 5
  • 22
  • 42
  • not sure how you serialize, but you can config that with the xmlwritersettings: https://learn.microsoft.com/en-us/dotnet/api/system.xml.xmlwritersettings?view=net-6.0 – Florian Schmidinger Mar 08 '22 at 10:25
  • https://stackoverflow.com/questions/15809868/how-to-add-xsi-schemalocation-to-root-c-object-xmlserializer will help you with the schema location – Florian Schmidinger Mar 08 '22 at 10:32

0 Answers0