I have several xml files with different node structure. I want to extract xml content from each of these xml files and store former(xml content) as a single string.
I am using following code to achieve it
String xmlContent = FileUtils.readFileToString(new File("xyz"), "UTF-8");
but i am facing following error
[Fatal Error] :5616:15: The processing instruction target matching "[xX][mM][lL]" is not allowed.
After searching i found that aforesaid error occurs because “” present in between the xml content.
Should i first modify xml files or there is any other way handle this situation?
Edit your xml file using a text editor. At the very beginning of the first line, look for and delete any leading spaces.
The following first line of the xml must not have any spaces or characters before the first “<” in the line.
Try the import again.
refer http://www-01.ibm.com/support/docview.wss?uid=swg21262072