* Transform a XML document into a JAVA object.
*
*/
public class Unmarshaller {
public CommentsDocument unmarshall(IDavinciProject project) {
CommentsDocument commentsDoc = new CommentsDocument(project);
try {
IStorage file = project.getCommentsFileStorage();
Document document = initCommentsFile(file);
Node node = document.getFirstChild();
NodeList children = node.getChildNodes();
Comment comm;
for (int i = 0; i < children.getLength(); i++) {
node = children.item(i);
if (node.getNodeType() == Node.ELEMENT_NODE
&& CommentsDocument.COMMENT.equalsIgnoreCase(node
.getNodeName())) {
comm = unmarshallComment(node);
if (null != comm) {
comm.setProject(project);
commentsDoc.getCommentList().add(comm);
}
}
}
} catch (SAXException e) {
// TODO Auto-generated catch block