vgritsenko 2003/08/14 20:04:56
Modified: java/examples/guide/src/org/apache/xindice/examples ListCollections.java Log: zap tabs Revision Changes Path 1.3 +27 -31 xml-xindice/java/examples/guide/src/org/apache/xindice/examples/ListCollections.java Index: ListCollections.java =================================================================== RCS file: /home/cvs/xml-xindice/java/examples/guide/src/org/apache/xindice/examples/ListCollections.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- ListCollections.java 7 Aug 2003 20:13:20 -0000 1.2 +++ ListCollections.java 15 Aug 2003 03:04:56 -0000 1.3 @@ -66,34 +66,30 @@ * Simple XML:DB API example to list collections. */ public class ListCollections extends AbstractExample { - - public static void main(String[] args) throws Exception { - Collection collection = null; - try { - collection = getCollection("xmldb:xindice://localhost:8888/db/"); - //collection = getCollection("xmldb:xindice-embed:///db/"); + public static void main(String[] args) throws Exception { + Collection collection = null; + try { + collection = getCollection("xmldb:xindice://localhost:8888/db/"); + //collection = getCollection("xmldb:xindice-embed:///db/"); - String[] childCollections = collection.listChildCollections(); - System.out.println("Children of collection [" + collection.getName() + "]"); - for (int i = 0; i < childCollections.length; i++) { + String[] childCollections = collection.listChildCollections(); + System.out.println("Children of collection [" + collection.getName() + "]"); + for (int i = 0; i < childCollections.length; i++) { - System.out.println("\t" + (i + 1) + ". " + childCollections[i]); - } - } - catch (XMLDBException e) { - System.err.println("XML:DB Exception occured " + e.errorCode + " " + e.getMessage()); - e.printStackTrace(); - } - catch (Exception e) { - System.err.println("Exception occured " + e.toString()); - e.printStackTrace(); - } - finally { - if (collection != null) { - collection.close(); - } - } - } + System.out.println("\t" + (i + 1) + ". " + childCollections[i]); + } + } catch (XMLDBException e) { + System.err.println("XML:DB Exception occured " + e.errorCode + " " + e.getMessage()); + e.printStackTrace(); + } catch (Exception e) { + System.err.println("Exception occured " + e); + e.printStackTrace(); + } finally { + if (collection != null) { + collection.close(); + } + } + } }