org.activemath.webapp.exercises.tools
Class JDOMUtility

java.lang.Object
  extended by org.activemath.webapp.exercises.tools.JDOMUtility

public class JDOMUtility
extends Object


Field Summary
static org.jdom.output.XMLOutputter outputter
           
 
Constructor Summary
JDOMUtility()
           
 
Method Summary
static boolean areElementsEquivalent(org.jdom.Element element1, org.jdom.Element element2)
           
static org.jdom.Element build(String content)
           
static String Element2string(org.jdom.Element element)
           
static List extractFormula(String text)
           
static boolean isSyntacticallyEqual(org.jdom.Element a, org.jdom.Element b)
          author: Alberto Gonzales Compare two elements syntactically.
static String JdomContent2string(List content)
           
static org.jdom.Element string2jdom(String content)
           
static Collection string2jdomContent(String content)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

outputter

public static org.jdom.output.XMLOutputter outputter
Constructor Detail

JDOMUtility

public JDOMUtility()
Method Detail

Element2string

public static String Element2string(org.jdom.Element element)
                             throws Exception
Throws:
Exception

JdomContent2string

public static String JdomContent2string(List content)
                                 throws Exception
Throws:
Exception

build

public static org.jdom.Element build(String content)
                              throws Exception
Throws:
Exception

string2jdom

public static org.jdom.Element string2jdom(String content)
                                    throws Exception
Throws:
Exception

string2jdomContent

public static Collection string2jdomContent(String content)
                                     throws Exception
Throws:
Exception

areElementsEquivalent

public static boolean areElementsEquivalent(org.jdom.Element element1,
                                            org.jdom.Element element2)

isSyntacticallyEqual

public static boolean isSyntacticallyEqual(org.jdom.Element a,
                                           org.jdom.Element b)
author: Alberto Gonzales Compare two elements syntactically. This is done by recursively matching all subelements and attributes defined in OpenMath. Extra elements or attributes are ignored. If any of the elements is null, the result is "false". OM errors are treated specially: if the head symbol matches, they are considered equivalent regardless of the rest. This allows to match an error class ignoring the accompanying context information.

Parameters:
a - first element.
b - second element.
Returns:
true if equal, false otherwise.

extractFormula

public static List extractFormula(String text)