Convert InputStream which is a zip file into HashMap<String,Element> — oracle-tech

    Forum Stats

  • 3,681,448 Users
  • 2,238,014 Discussions
  • 7,831,224 Comments

Discussions

Convert InputStream which is a zip file into HashMap<String,Element>

30527143052714 Posts: 53
edited September 2019 in Code One

I have a screen where a zip file is uploaded.  The zip file has

a.xml

b.xml

c.xml 

etc..

I have handle to InputStream, but how do I convert the InputStream to HashMap<String,Element>  or Hashtable<String,Element>

Answers

  • 40849164084916 Posts: 2
    edited September 2019

    First you need to read each XML file, I would start by unziping the file and iterate through each XML file.

    Then you can use DOM or SAX style XML parser to read the xml files into the memory.  Now you can pick up

    the elements that you want from XML document into any Java collection.

Sign In or Register to comment.