Olivier Muhring

Olivier Muhring

  • 1.4k
  • 256
  • 7.9k

Uppercase tag names in XML output

May 23 2018 5:17 AM
For a project I once created a web service which generates xml files, for each xml file I created a class, like this:
  1. public class Tsjoeketjoek   
  2. {    
  3.     [XmlAttribute]    
  4.     public string Num;    
  5.     
  6.     [XmlAttribute]    
  7.     public string Type;    
  8.     
  9.     [XmlAttribute]    
  10.     public string Car;    
  11.     
  12.     [XmlAttribute]    
  13.     public string Deel;    
  14.     
  15.     [XmlAttribute]    
  16.     public string Resa;    
  17.     
  18.     [XmlAttribute]    
  19.     public string Prest;    
  20.     
  21.     public FootNote FootNote;    
  22.     
  23.     public List<Station> Rit;    
  24. }  
 For comptability reasons the tag names need to be uppercase. 
 
Now I know I can enforce the tagnames in the code itself, by actually naming each field, I am wondering if there is no better method. There a lot of classes I would have to do this manual change for..
 
For example, can't I write an extension for XmlSerializer so I can enforce uppercase tagnames that way?

Answers (1)