Abhinav
Abhinav

Reputation: 1

if my class is not public than XML Encoder and Decoder doesn`t work

Xml is work only class is public.what i do if class is not public?

Upvotes: 0

Views: 64

Answers (2)

mhaller
mhaller

Reputation: 14232

For Java, java.beans.XMLDecoder also only unmarshalls public classes. There is no way to overwrite this behavior and to provide custom object handlers.

There are other libraries, such as XStream, which have various options to encode/decode other types of classes, control the marshalling process or use factory classes to create instances of private classes which were otherwise not accessible.

Upvotes: 0

Darin Dimitrov
Darin Dimitrov

Reputation: 1038930

If you are talking about .NET XML serialization with XmlSerializer then this type can serialize only public classes. You could use DataContractSerializer instead.

Upvotes: 2

Related Questions