I have XML Configuration file and I need to load/save it so What are best ways to Parse XML Files for Load/Save configurations other than Serialization as I don't like the option of Serialization
Asked
Active
Viewed 33 times
0
-
why are `Java` and `C#` tagged?. For this use [JaxB](https://es.wikipedia.org/wiki/JAXB) – Jordi Castilla Oct 01 '15 at 10:42
-
You just don't like Serialization? I don't like JavaScript and still have to do it... But whats bad about Serialization? – Alex H Oct 01 '15 at 10:42
-
XML serialization is insecure , it works with public properties and classes, so no data protection thus force you to have exposed properties . – mohamed rauof Oct 01 '15 at 11:00
2 Answers
0
For a Java application I serialized a pretty complex application state using XStream. For the most part this works extremely good. If the object is really simple this should not be a problem. Another simple alternative I often use to transfer data from Object <-> XML is JAXB with annotations on the Objects, or if the XML structure is the master with an XML Schema from which the classes can be generated.

hotzst
- 7,238
- 9
- 41
- 64
0
For C# you could use IXmlSerializable, or DataContract. Multiple answers can be found on SO using both these classes. See this to see how to use DataContract
.

Community
- 1
- 1

Arthur Rey
- 2,990
- 3
- 19
- 42