changeset 6:7a2a98655236

Some more changes. Class is now in a stable state.
author Klaus Thoden <kthoden@mpiwg-berlin.mpg.de>
date Fri, 12 Apr 2013 17:48:10 +0200
parents 7d231e4e86e5
children
files src/main/java/de/mpiwg/indexmeta/AnnotateIndexMeta.java
diffstat 1 files changed, 6 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/src/main/java/de/mpiwg/indexmeta/AnnotateIndexMeta.java	Fri Apr 12 14:28:32 2013 +0200
+++ b/src/main/java/de/mpiwg/indexmeta/AnnotateIndexMeta.java	Fri Apr 12 17:48:10 2013 +0200
@@ -29,7 +29,7 @@
         System.out.println("in main");
 
         // Methodenaufruf
-        String filepath = "/Users/kthoden/eclipse/workspace/IndexMetaContextualization/data/index.meta/index.meta_FQPFR8XP";
+        String filepath = "/Users/kthoden/eclipse/workspace/IndexMetaContextualizer/data/index.meta/index.meta_FQPFR8XP";
         // this is a list of all the elements we want to contextualize
         List<String> contextualizableList = Arrays.asList(new String[]{"author","editor","publisher","city","holding-library","keywords"});
         try {xmlParse(filepath,contextualizableList);
@@ -62,7 +62,7 @@
                 NodeList nodeList = doc.getElementsByTagName(contextElement);
                 for(int i=0; i < nodeList.getLength(); i++){
                     Node iter2 = nodeList.item(i);
-                    String currentNodeValue = iter2.getTextContent();
+                    String currentNodeValue = iter2.getFirstChild().getNodeValue();
                     NamedNodeMap attr = iter2.getAttributes();
                     // make a new attribute
                     if (attr.getNamedItem("context-id") == null){
@@ -74,8 +74,8 @@
                     }
                     // Just for comfort. Print it out.
                     System.out.println(contextElement);
-                    if (contextElement == "author") {
-                        findContext(doc, currentNodeValue);
+                    if (contextElement == "author" || contextElement == "editor") {
+                        checkExistingContext(doc, currentNodeValue);
                     }
                     count++;
                 }
@@ -109,7 +109,7 @@
      * @param doc
      * @param currentNodeValue
      */
-    public static void findContext(Document doc, String currentNodeValue) {
+    public static void checkExistingContext(Document doc, String currentNodeValue) {
         // first, define some variables
         String nameOfPerson = "";
         String roleOfPerson = "";
@@ -121,7 +121,7 @@
         // if there are any, we take the liberty of querying them. This is a Nodelist
         NodeList personList = doc.getElementsByTagName("person");
         // Debug information for the human eye.
-        // System.out.println("The current node value is "+ currentNodeValue + ". Let's do something useful in the findContext method.");
+        // System.out.println("The current node value is "+ currentNodeValue + ". Let's do something useful in the checkExistingContext method.");
         // System.out.println("This node list has " + personList.getLength() + " members: " + personList.item(0) + "and" + personList.item(1));
         // Integer personCounter = 1;
         // look at every element in the list of persons
@@ -164,7 +164,6 @@
                 }}
             // personCounter ++;
         }
-        System.out.println("printing author");
     }
 }