KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > ozoneDB > core > xml > TestXML2Object


1 // You can redistribute this software and/or modify it under the terms of
2
// the Ozone Core License version 1 published by ozone-db.org.
3
//
4
// The original code and portions created by SMB are
5
// Copyright (C) 1997-@year@ by SMB GmbH. All rights reserved.
6
//
7
// $Id: TestXML2Object.java,v 1.3 2002/09/18 06:54:17 per_nyfelt Exp $
8

9 package org.ozoneDB.core.xml;
10
11 import org.apache.xerces.parsers.SAXParser;
12 import org.xml.sax.*;
13
14 import java.io.FileInputStream JavaDoc;
15 import java.io.InputStream JavaDoc;
16
17 /**
18  * This class is for testing Object2XML.
19  *
20  * @version $Revision: 1.3 $
21  * @author <a HREF="http://www.softwarebuero.de">SMB</a>
22  */

23 public class TestXML2Object implements XML2ObjectDelegate {
24
25     public TestXML2Object() {
26     }
27
28     public static void main(String JavaDoc [] args) throws Exception JavaDoc {
29         FileInputStream JavaDoc istream = new FileInputStream JavaDoc("ausgabe.xml");
30         InputStream JavaDoc instream = istream;
31
32         ContentHandler contentHandler = new XML2ObjectContentHandler(new TestXML2Object());
33         long start = System.currentTimeMillis();
34
35         XMLReader parser = new SAXParser();
36         parser.setContentHandler(contentHandler);
37         parser.parse(new InputSource(instream));
38
39         long end = System.currentTimeMillis();
40         System.out.println("Zeit: " + (end-start));
41     }
42
43     public void handleObject(ObjElement oe) {
44         System.out.println(oe.getObject().toString());
45         System.out.println("Name... " + oe.getClassName());
46         System.out.println("ID..... " + oe.getId());
47         System.out.println("OOName. " + oe.getOzoneObjectName());
48         System.out.println("OOId... " + oe.getOzoneObjectId());
49     }
50 }
51
Popular Tags