Handle the case of trying to view the auctions list when there are no items in it, by creating a tiny, faux auctions.xml file in memory.
| 625 | 957 | |
|---|---|---|
| 54 | 54 | } |
| 55 | 55 | |
| 56 | 56 | public static StringBuffer outputHTML(String loadFile, String xmlOutputFile) { |
| 57 | FileInputStream xmlIn = null; | |
| 57 | InputStream xmlIn = null; | |
| 58 | 58 | InputStream xslIn = null; |
| 59 | 59 | FileOutputStream htmlOut = null; |
| 60 | 60 | |
| --- | --- | |
| 63 | 63 | // Java input stream/reader |
| 64 | 64 | try { |
| 65 | 65 | //String xmlInputFile = "myXMLinput.xml"; |
| 66 | xmlIn = new FileInputStream(loadFile); | |
| 66 | try { | |
| 67 | xmlIn = new FileInputStream(loadFile); | |
| 68 | } catch(FileNotFoundException fnfe) { | |
| 69 | xmlIn = new StringBufferInputStream( | |
| 70 | "<?xml version=\"1.0\"?>\n" + | |
| 71 | "\n" + | |
| 72 | "<!DOCTYPE auctions SYSTEM \"http://www.jbidwatcher.com/auctions.dtd\">\n" + | |
| 73 | "<jbidwatcher format=\"0101\">" + | |
| 74 | "<auctions count=\"0\">" + | |
| 75 | "</auctions>" + | |
| 76 | "</jbidwatcher>" | |
| 77 | ); | |
| 78 | } | |
| 67 | 79 | Source xmlSource = new StreamSource(xmlIn); |
| 68 | 80 | |
| 69 | 81 | // create the XSLT Stylesheet input source |
