I need to have XML encoding and version at the top of my XML document which I am making with XDocument.
I have this but it is in lowercase, and it needs to be in uppercase.
What do I need to do?
I declare a new XML document using the XDocument class called ‘doc’.
I save this to a file using doc.Save();.
I have tried:
doc.Declaration.Encoding.ToUpper();- Declaring a new
XDeclaration - Typing the Encoding in uppercase and setting my
doc.Declarationto myXDeclaration.
It still comes through in lowercase.
You can create custom
XmlTextWriter, e.g.:Then use it: