|
I'm in the
process of creating a family tree program in Java which stores
the member data in an XML document. Each member has a set of attributes which if they don't have a value assigned to them are set to "m000" a dummy IDREF to keep the parser happy. The problem facing me is one which concerns multiple additions/deletions before saving the document. Before I was inputting 1 member or deleting it then saving, This works absolutely fine but if I try to do multiple additions (which reference each other) I get a NullPointerException when the program gets to the line Node node = document.getElementById(membID); ... NamedNodeMap nodeMap = node.getAttributes(); -------------------------------------------^ Yet it has got the Node by the IDREF, I checked with some System.out.println() statements, its just it doesn't seem to think it has any attributes which is rubbish because I know for certain it does. Like I said, if I add a member then save and do this however many times, it works fine but if I try to add all the members at once, when it gets to the 2nd one (which references the first and requires the first to be updated) it screws up. I suspect the new updated representation of the Document Element is not being accessed but rather the original one. Any ideas? Steve Using Xerces -J 2.0.1 & Java v1.3.1 |
