开发者

How to get xml file over http?

A xml file with data will be sent over http to server my job is to get that xml file and parse it using we开发者_JAVA技巧b service and I am using Netbeans 6.9. How can i get that xml file can anyone tell me ?


Looking for something like this?

URL xmlUrl = new URL("http://www.rekindle.co.za/rss.xml");
InputStream in = xmlUrl.openStream();
Document doc = parse(in);

Taken from a similar question about parsing at http://www.java-forums.org/xml/22674-get-xml-data-url.html


Assuming you're responsible for writing the service using servlets and the xml file will be POSTed to the server, you can access it using HttpServletRequest.getParameter(paramName).


Use HttpClient for the same to recieve the XML , After recieving the xml use JAXB/XMLbeans parser to parse the xml. You must have to sure about xml's xsd before parsing the same. If already you are having xsd against the incoming xml then just created the classes by using using any above mentioned tool.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜