For that we can use DocumentBuilder class in java. By using the method parse(InputStream)
;
A new DOM Document object will return. InputStream input;
DocumentBuilderFactory factory
= DocumentBuilderFactory.newInstance();
DocumentBuilder parser = factory.newDocumentBuilder();
Document dc= parser.parse(input);
In the above code segment,by using the created Document object,the corresponding XML file for the inputStream can be accessed.
References:
http://www.w3schools.com/dom/dom_intro.asp
http://download.oracle.com/javase/1.4.2/docs/api/javax/xml/parsers/DocumentBuilder.html
I googled this issue and this article came 3rd :) thanks akki :)
ReplyDeleteIt gave me some insights but can you be please more elaborative? I have been following your content. I am new to xml conversion working for a data conversion company:)
ReplyDelete