1 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 ; 15 import java.io.InputStream ; 16 17 23 public class TestXML2Object implements XML2ObjectDelegate { 24 25 public TestXML2Object() { 26 } 27 28 public static void main(String [] args) throws Exception { 29 FileInputStream istream = new FileInputStream ("ausgabe.xml"); 30 InputStream 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 |