c# - What shall I change in my code to get this XML format after serialization -
this class: language.cs (full commented, that's why posted link) targetted code need change:
[serializable] public struct text { private string _key; private string _value; [xmlattribute] public string key { { return _key; } set { _key = value; } } [xmlattribute] public string value { { return _value; } set { _value = value; } } public text(string key, string value) { _key = key; _value = value; } }
currently, when use save() method, xml file that:
<?xml version="1.0" encoding="utf-8"?> <language xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xmlns:xsd="http://www.w3.org/2001/xmlschema"> <name>langname</name> <texts> <text key="welcome" value="welcome {0}!" /> <text key="yourage" value="your age {0} !" /> </texts> </language>
and i'm looking getting file that
<?xml version="1.0" encoding="utf-8"?> <language xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xmlns:xsd="http://www.w3.org/2001/xmlschema"> <name>langname<name/> <texts> <text key="welcome">welcome {0}!<text/> <text key="yourage">your age {0} !<text/> </texts> </language>
do have idea of shall change in code xml format after saving ?
thanks lot :d
look customizing/ configuring xmlserializer
before serialize. need set xmlattributeoverrides, set desired attribute(s) xmltext.
specifically:
Comments
Post a Comment