Upload xml to webapplication and parse it using Dom4j
Joined: Jun 26, 2001
I have a web page which asks user to upload a xml file from local directory to web application. The webapplication code will take the xml file, parse it and display the contents of the xml. Someone recommend dom4j to me. I guess I can use HTML browse for the local file but not sure how to make the xml file availble to dom4j to parse?
I am new to this, can someone recommend a good approach to do this?
I'm not clear on what you are asking. Are you asking how to upload a file?
And why are you asking about parsing? If you only want to display the XML file on the browser after you upload it, there's no parsing necessary. Just copy the file to the response (HTML-escaping it of course).
And if you do want to parse the XML for some reason, then just use one of the XML parsers which are built into the standard Java API for a start. There's no need to confuse the issue by bringing in other parsers until you are more familiar with how to use XML in Java.