01: /*
02: * XmlTableNameResolver.java
03: *
04: * This file is part of SQL Workbench/J, http://www.sql-workbench.net
05: *
06: * Copyright 2002-2008, Thomas Kellerer
07: * No part of this code maybe reused without the permission of the author
08: *
09: * To contact the author please send an email to: support@sql-workbench.net
10: *
11: */
12: package workbench.db.importer;
13:
14: import workbench.log.LogMgr;
15: import workbench.util.WbFile;
16:
17: /**
18: *
19: * @author support@sql-workbench.net
20: */
21: public class XmlTableNameResolver implements TablenameResolver {
22:
23: private String encoding;
24:
25: public XmlTableNameResolver(String enc) {
26: this .encoding = enc;
27: }
28:
29: public String getTableName(WbFile f) {
30: String tablename = f.getFileName();
31: ImportFileHandler handler = new ImportFileHandler();
32: try {
33: handler.setMainFile(f, this .encoding);
34: XmlTableDefinitionParser parser = new XmlTableDefinitionParser(
35: handler);
36: tablename = parser.getTableName();
37: } catch (Exception ex) {
38: LogMgr.logError("XmlTableNameResolver.getTableName()",
39: "Error retrieving table name", ex);
40: } finally {
41: handler.done();
42: }
43: return tablename;
44: }
45:
46: }
|