I recently got an exception while parsing a XML file with XMLBeans 2.x. During the parse of the file I received the exception:
XMLException: Unexpected element: CDATA with XMLBeans 2.x
I called the xxxDocument.Factory.parse(String xmlAsString) method with a string argument pointing to the path of the XML file to parse. Well, at that time, I expected to use the "xmlAsString" parameter as a string object pointing to the path of my XML file (should have read the API docs more carefully). That was totally wrong!
After realizing my mistake I tried the xxxDocument.Factory.parse(File file) method which I called with a File object of the XML document to parse and that did the trick!
Well, I learned my lesson: Read the API docs carefully :-)