By using Serializer class of SimpleXmlConverter library you can do the parsing. Refer below code:
This is the custom model class
import org.simpleframework.xml.Element;
import org.simpleframework.xml.Root;
@Root(name = "notification", strict = false)
public class NotificationModel {
@Element(name = "code")
public String errorCode;
@Element(name = "message")
public String errorMessage;
}
This is the xml string which you want to parse into the model
<notification xmlns:d="http://www.website.com/pref/data">
<code>004</code>
<message>Error during value update</message>
<severity>info</severity>
<target />
</notification>
Use the below code to parse the above xml string
import org.simpleframework.xml.Serializer;
import org.simpleframework.xml.core.Persister;
String xmlString = "above xml string"
try {
Serializer serializer = new Persister();
NotificationModel notificationModel = serializer.read(NotificationModel.class, xmlString);
//TODO: Use notificationModel's variables with filled values
} catch (Exception e) {
e.printStackTrace();
}