Changeset 4033
- Timestamp:
- 2003-03-28T13:50:51+12:00 (21 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gsdl3/src/java/org/greenstone/gsdl3/service/GATEServices.java
r4024 r4033 240 240 241 241 // Remove the surrounding HTML tags 242 annotated_text = annotated_text.substring( 25, annotated_text.length() - 7);242 annotated_text = annotated_text.substring(49, annotated_text.length() - 13); 243 243 // System.out.println("GATE result:\n" + annotated_text); 244 content_text.setNodeValue(annotated_text); 244 245 annotated_text = "<nodeContent>" + annotated_text + "</nodeContent>"; 246 Element annotated_content = converter_.getDOM(annotated_text).getDocumentElement(); 247 doc_node.replaceChild(doc_node.getOwnerDocument().importNode(annotated_content, true), content); 245 248 } 246 249 … … 271 274 272 275 // Extract all the annotations 273 // AnnotationSet annSet = outputAnnotationSetName == null ||274 // outputAnnotationSetName.length() == 0 ?275 // doc.getAnnotations() :276 // doc.getAnnotations(outputAnnotationSetName);277 276 AnnotationSet annSet = doc.getAnnotations(); 278 // String result = doc.toXml(annSet, false);279 277 280 278 // Return the desired annotations … … 283 281 Factory.deleteResource(doc); 284 282 285 // Replace all the annotations with div tags 283 // 1. Escape the GATE result 284 result = GSXML.xmlSafe(result); 285 286 // 2. Unescape the annotation tags 286 287 Iterator setIterator = annotationTypesToExport.iterator(); 287 288 while (setIterator.hasNext()) { 288 289 String annotationType = (String) setIterator.next(); 289 result = result.replaceAll(" <" + annotationType + ">",290 "< span class=\"" + annotationType + "\">");291 result = result.replaceAll(" </" + annotationType + ">",292 "</ span>");290 result = result.replaceAll("<" + annotationType + ">", 291 "<annotation type=\"" + annotationType + "\">"); 292 result = result.replaceAll("</" + annotationType + ">", 293 "</annotation>"); 293 294 } 294 295 295 // System.out.println("Result:\n" + result);296 296 return result; 297 297 }
Note:
See TracChangeset
for help on using the changeset viewer.