How to read an XML file using Java?

前端 未结 6 1435
醉梦人生
醉梦人生 2020-12-21 15:55

I need to read an XML file using Java. Its contents are something like


    
        C:/Input.csv         


        
6条回答
  •  自闭症患者
    2020-12-21 16:14

    Check out Java's JAXP APIs which come as standard. You can read the XML in from the file into a DOM (object model), or as SAX - a series of events (your code will receive an event for each start-of-element, end-of-element etc.). For both DOM and SAX, I would look at an API tutorial to get started.

    Alternatively, you may find JDOM easier/more intuitive to use.

提交回复
热议问题