avatar

957

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.

by mrs, 17 Jun, 2009 06:42 PM
625 957  
5454   }
5555 
5656   public static StringBuffer outputHTML(String loadFile, String xmlOutputFile) {
57     FileInputStream xmlIn = null;
57     InputStream xmlIn = null;
5858     InputStream xslIn = null;
5959     FileOutputStream htmlOut = null;
6060 
------
6363     // Java input stream/reader
6464     try {
6565       //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       }
6779       Source xmlSource = new StreamSource(xmlIn);
6880 
6981       // create the XSLT Stylesheet input source