KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > ozoneDB > xml > OOXMLDOMFactory


1 // Copyright 1997-1999 by softwarebuero m&b (SMB). All rights reserved.
2
//
3
// You can redistribute this software and/or modify it under the terms of
4
// the Ozone Library License version 1 published by softwarebuero m&b (SMB).
5
//
6
// $Id: OOXMLDOMFactory.java,v 1.2 2003/11/20 23:18:42 per_nyfelt Exp $
7

8 package org.ozoneDB.xml;
9
10 import org.w3c.dom.Document JavaDoc;
11 import org.ozoneDB.xml.*;
12 import org.ozoneDB.*;
13
14
15 public class OOXMLDOMFactory extends DOMFactory {
16
17
18     public static Document JavaDoc createDocument( Class JavaDoc docClass, OzoneInterface ozoneDB, String JavaDoc docName ) {
19         try {
20             // Returns the document type which is either docClass (must extend
21
// Document), or the class from the properties file, or XMLDocument.
22
docClass = getDocClass( docClass );
23
24             // Instantiate a new document, report any error encountered and default
25
// to XMLDocument is necessary.
26
if (docClass != null && docClass != Document JavaDoc.class && docClass != XMLDocument.class) {
27                 return (Document JavaDoc)ozoneDB.createObject( docClass.getName(), 0, docName );
28             } else {
29                 return (Document JavaDoc)ozoneDB.createObject( org.ozoneDB.xml.dom.DocumentImpl.class.getName(), 0, docName );
30             }
31         } catch (Exception JavaDoc except) {
32             except.printStackTrace();
33             return null;
34         }
35     }
36
37 }
38
Popular Tags