clean up Endnote import
[cdmlib.git] / cdmlib-io / src / main / java / eu / etaxonomy / cdm / io / reference / endnote / in / EndNoteImportBase.java
1 /**
2 * Copyright (C) 2007 EDIT
3 * European Distributed Institute of Taxonomy
4 * http://www.e-taxonomy.eu
5 *
6 * The contents of this file are subject to the Mozilla Public License Version 1.1
7 * See LICENSE.TXT at the top of this package for the full license terms.
8 */
9
10 package eu.etaxonomy.cdm.io.reference.endnote.in;
11
12 import org.apache.log4j.Logger;
13 import org.jdom.Element;
14 import org.jdom.Namespace;
15
16 import eu.etaxonomy.cdm.io.common.CdmImportBase;
17
18 /**
19 * @author a.mueller
20 * @created 04.08.2008
21 * @version 1.0
22 */
23 public abstract class EndNoteImportBase extends CdmImportBase<EndnoteImportConfigurator, EndnoteImportState> {
24 private static final Logger logger = Logger.getLogger(EndNoteImportBase.class);
25
26 // protected abstract void doInvoke(EndnoteImportState state);
27
28 protected Element getXmlElement(EndnoteImportConfigurator tcsConfig){
29 Element root = tcsConfig.getSourceRoot();
30
31 if (! "xml".equals(root.getName())){
32 logger.error("Root element is not 'xml'");
33 return null;
34 }
35 if (tcsConfig.getEndnoteNamespace() == null){
36 logger.error("No namespace defined for tcs");
37 return null;
38 }
39 if (! tcsConfig.getEndnoteNamespace().equals(root.getNamespace())){
40 logger.error("Wrong namespace for element 'xml'");
41 return null;
42 }
43 //TODO prevent multiple elements
44
45 return root;
46 }
47 }