# HG changeset patch # User Klaus Thoden # Date 1365781690 -7200 # Node ID 7a2a98655236f6668966bc632d0b46d1e71e5884 # Parent 7d231e4e86e5a73aca1dce9228bb46f10ec132ac Some more changes. Class is now in a stable state. diff -r 7d231e4e86e5 -r 7a2a98655236 src/main/java/de/mpiwg/indexmeta/AnnotateIndexMeta.java --- 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 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"); } }