3 Replies Latest reply: Mar 6, 2007 11:36 AM by DrClap RSS

    find XML file from archive

    807606
      Hi,

      I have one xml file that is packaged in an EAR file and deployed to Websphere.

      I have to read the contents of the xml file.

      How can I do that?
        • 1. Re: find XML file from archive
          DrClap
          How can you do what?

          Your title says something about finding an XML file but the body of your post suggests you want to know how to read it. A more precise question would help.
          • 2. Re: find XML file from archive
            807606
            I have some XML files that are packaged in a EAR file and deployed to Websphere AppServer.

            Ex: WEB-INF/classes/XMLDir/test.xml

            I have to find the location of these files ( relative to Webspere classes dir ) and Parse through these files.

            The below code is not finding xml files (returning NULL ) and throwing Exception.

            String xmlFile = "XMLDir/test.xml";
            InputStream input = this.getClass().getResourceAsStream(xmlFile);

            How can I find these xml files, so that I can parse through these files.
            • 3. Re: find XML file from archive
              DrClap
              Try this instead:
              String xmlFile = "/XMLDir/test.xml";
              The slash at the front tells the method not to treat the name as relative to the name of your class.