requester
Class XmlLib


java.lang.Object

  extended byrequester.XmlLib


public class XmlLib
extends java.lang.Object

Title: pathoEdit

Description: Editor für Befundberichte - FU Berlin 2003

Copyright: Copyright (c) 2003

Class Description: various functions around reading and writing the xml files

Company:


Constructor Summary
XmlLib()
           
 
Method Summary
static int calculateSimilarity(java.lang.String s, java.lang.String t)
          calculateSimilarity: calculates edit distance between two strings
static java.lang.String deleteWhitespaces(java.lang.String input)
          deleteWhitespaces, replaces whitespaces and ',' with '_' (naming conventions).
static java.lang.String escapeHTML(java.lang.String s)
           
static java.lang.String generateXMLString(org.w3c.dom.Document doc)
          writes a DOM Document as a XMl String
static org.w3c.dom.Document getNewDocument()
          creates a new empty Document
static java.lang.String killUmlaute(java.lang.String s)
           
static java.lang.String nodes2rdf(java.util.Vector nodes, int individualCount)
          generates a rdf xml string out of a Vector of DOM Nodes.
static org.w3c.dom.Document openFile(java.lang.String filename)
          reads a file into a DOM
static boolean saveFile(org.w3c.dom.Document doc, java.lang.String filename)
          saves a DOM Document to a specified file in XML format, overwrites it if exists
static org.w3c.dom.Document string2xml(java.lang.String s)
          generates a DOM Document out of a XML String
static java.lang.String unescapeHTML(java.lang.String s, int f)
          converts escaped string to real html (e.g.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

XmlLib


public XmlLib()
Method Detail

saveFile


public static boolean saveFile(org.w3c.dom.Document doc,
                               java.lang.String filename)
saves a DOM Document to a specified file in XML format, overwrites it if exists

Parameters:
doc - Document to be saved to a file
filename - output path
Returns:
boolean, returns true if succeeded

killUmlaute


public static java.lang.String killUmlaute(java.lang.String s)

deleteWhitespaces


public static java.lang.String deleteWhitespaces(java.lang.String input)
deleteWhitespaces, replaces whitespaces and ',' with '_' (naming conventions). Important especially for further editing in Protege

Parameters:
input - String
Returns:
String

string2xml


public static org.w3c.dom.Document string2xml(java.lang.String s)
generates a DOM Document out of a XML String

Parameters:
s - input XML String
Returns:
Output DOM Document

escapeHTML


public static final java.lang.String escapeHTML(java.lang.String s)

unescapeHTML


public static final java.lang.String unescapeHTML(java.lang.String s,
                                                  int f)
converts escaped string to real html (e.g. "<" --> "<")

Parameters:
s - String
f - recursive function, start it with 0
Returns:
String

generateXMLString


public static java.lang.String generateXMLString(org.w3c.dom.Document doc)
writes a DOM Document as a XMl String

Parameters:
doc - Document
Returns:
String

nodes2rdf


public static java.lang.String nodes2rdf(java.util.Vector nodes,
                                         int individualCount)
generates a rdf xml string out of a Vector of DOM Nodes. Generates Individuals, setting the rdf:about value. The individualCount represents the actual total number of individuals in the Knowledge Base. The counter is incremented in order to guarantee an unique individual name consisting of the concept name + "_" + individualCount

Parameters:
nodes - Vector
individualCount - actual number of individuals in Knowledge Base for generating individual name.
Returns:
String

openFile


public static org.w3c.dom.Document openFile(java.lang.String filename)
reads a file into a DOM

Parameters:
filename - String
Returns:
Document

getNewDocument


public static org.w3c.dom.Document getNewDocument()
creates a new empty Document

Returns:
Document

calculateSimilarity


public static int calculateSimilarity(java.lang.String s,
                                      java.lang.String t)
calculateSimilarity: calculates edit distance between two strings

Parameters:
s - String
t - String
Returns:
int