|
Re: question(bug) about setNodeValue: msg#00120java.enhydra.xmlc
At 04:57 PM 9/18/2003 -0500, you wrote: Accroding to api doc, setNodeVaule can accept null parameter: Ok, I gave my brain some food and all of a sudden things made more sense. Go figure. It says that when the table defines the node value to be "null", then the setting has no effect. Of course, for a node of type "Text", the value is defined to be "content of the text node". So, if one sets uses setNodeValue(null), the "content of the text node" will be "null". As such, it looks as if BaseDOMFormatter#writeText() should be checking for null and just returning immediately if the value is null. Note that Attr nodes which are set to null don't seem to run through this method and end up looking like boolean attributes (eg... 'onclick" rather than then expected and legal onclick=""). I'm not sure currently where those are serialized? I tried the following ways of setting Attr nodes to null... org.w3c.dom.Element node = xmlObj.getElementById("foobar"); node.setAttribute("onclick", null); or... node.getAttributeNode("onclick").setNodeValue(null); In neither case did writeText() get called for serializing those Attr nodes, although other non-modified Attr nodes did pass through writeText(). Hmm.... This seems like bad behavior. If anyone has an idea where this is serialized, it would be nice to know so we can fix it to make it consistent with Text node behavior. Anyway, I'm checking in the null check change which will fix the null pointer exception. The existing Text node value will be wiped out when setting the value to "null" rather than bombing out. Jake
|
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| Previous by Date: | Re: question(bug) about setNodeValue, Jacob Kjome |
|---|---|
| Next by Date: | xmlc.enhydra.org / xmlc.org updated, David H. Young |
| Previous by Thread: | Re: question(bug) about setNodeValue, Jacob Kjome |
| Next by Thread: | xmlc.enhydra.org / xmlc.org updated, David H. Young |
| Indexes: | [Date] [Thread] [Top] [All Lists] |
| News | FAQ | advertise |