novosselovm at 3web.net
Wed Mar 31 22:47:26 PST 2004
I got a few surprises while testing my program. I wrote test XML file in notepad and saved it using UTF-8 encoding. To my surprise I got a parsing exception thrown by SAXBuilder:
root-element is missing. When I saved same file using other encodings - everything worked fine (btw file with UTF-8 encoding had size 3 bytes bigger than others). But, though file was parsed and I could get root's children by calling getChildren(), my atempt to get root's child by using getChild(String name) failed, method returned a null pointer.
Same for getAttribute(String name), though getAttributes() worked fine. In both cases there was only one element and one attribute. I also tried XML file that was written by some one using XML editor (do not know which one) and had encoding UTF-8
(<?xml version.... encoding="UTF-8"?>) to my surprise (again) it worked. Program did not throw parsing exception, as with file that was written using notepad and saved with UTF-8 encoding.
So I'm wondering if it's just me or there is bug, or something.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the jdom-interest