swpatho.ap1.editor.lib
Class XmlLib


java.lang.Object

  extended byswpatho.ap1.editor.lib.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 org.w3c.dom.Node createSubSection(java.lang.String cap, java.lang.String cont)
          creates an new section with a certain name and content
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 nodes2rdf(java.util.Vector nodes, int individualCount)
          generates a rdf xml string out of a Vector of DOM Nodes.
static java.lang.String normalizeWord(java.lang.String s)
          normalizeString Before a query, the String is normalized, changing the first letter to lower case
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.
static void updateDOM(org.w3c.dom.Document doc, EditableBefundTab tab)
          extracts the text of the new report and updates the DOM
 
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

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

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

escapeHTML


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

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

updateDOM


public static void updateDOM(org.w3c.dom.Document doc,
                             EditableBefundTab tab)
extracts the text of the new report and updates the DOM

Parameters:
doc - the DOM Document, which will be updated and returned
tab - new report, contains all text fields

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

createSubSection


public static org.w3c.dom.Node createSubSection(java.lang.String cap,
                                                java.lang.String cont)
creates an new section with a certain name and content

Parameters:
cap - Caption name
cont - Content to be saved
Returns:
Node

normalizeWord


public static java.lang.String normalizeWord(java.lang.String s)
normalizeString Before a query, the String is normalized, changing the first letter to lower case

Parameters:
s - String
Returns:
String