on-internet
← Community

XmlSerializer to have attribute and prefix in XML file

Stack Overflow ·

I could get this XML file from C# class with XmlSerializer. <?xml version="1.0" encoding="utf-8"?> <Component xmlns:spirit="b" xmlns:chrec="a" MovieName="0" BlocksNotCovered="0"> <ClassInfoList> <chrec:string>hello</chrec:string> <chrec:string>world</chrec:string> </ClassInfoList> <moduleName /> <world> <x>10</x> <y>20</y> </world> </Component> How can I add prefix namespaces for chrec and spriti? For example, how can I get this XML file? <?xml version="1.0" encoding="utf-8"?> <spirit:Component xmlns:spirit="b" xmlns:chrec="a" MovieName="0" BlocksNotCovered="0"> <spirit:ClassInfoList> <chrec:s

Comments

Sign in or sign up to comment and upvote.

No comments yet.