Incorrect XML error until Eclipse project refreshed

I have a web project in Eclipse that is generating an xml file using dom4j methods. The file lands in the WebContent folder, and the filename is sent to the mygrid.loadXML() method. The filename passed is defined relative to the context root (e.g. “/webproject/data/folder/filename.xml”). When the page loads, I get an “Incorrect XML” message. If I then refresh the project in Eclipse, so that the new xml file appears in the project explorer panel, the page will load correctly.

I have tried moving the files to different locations with no success. Instinctively it seems like using an absolute file path would work, but it does not look like the loadXML() method accepts such a parameter.

How do I make the loadXML() method aware of the newly created document without having to manually refresh the web project? Even restarting the server has no effect, I have to refresh the project itself.

loadXML can process both relative and absolute paths, but beware that

  • relative paths, are relative to the html page , on which grid was initialized
  • absolute paths , are paths from web root, which differs from real filesystem root

How do I make the loadXML() method aware of the newly created document without having to manually refresh the web project

LoadXML just makes http request to the provided url - the data which its receive is fully depends on the server, which must return some data for requested url

You have specified that ‘absolute paths , are paths from web root, which differs from real filesystem root’.
Could you please tell me what do you refer as web root with an example for it.

The above statement means that such path as

http://some.com/some.xml

will work correctly, but the next one will not work

file:///D:/some.xml