SimpleXMLEncoder and SimpleXMLDecoder
You might have heard or may be used these classes somewhere in your application where you had to deal with XML data. This classes are simple and pretty useful when you have convert some objects to XML or vice versa.
SimpleXMLEncoder:
SimpleXMLEncoder class takes object and encodes them into XML . This public method encodeValue takes the following as argument:
obj:Object – the object to be encoded
qname:QName - the qualified name of the child node
parentNode:XMLNode – XMLNode under which the encoded value is put
Now letz try it out

and the trace should generate output XML:

SimpleXMLDecoder:
The simpleXMLDecoder will the do the exact reverse of the encoder with some changes in implementation.
Here the method is decode which takes in instance of XMLDocument as the argument.Now how its done:

and the trace commands will give the output in the console as :

So this was a simple implementation example of both the classes …. ;-)


thank you again!