ru.biosoft.math.xml
Class MathMLParser
java.lang.Object
ru.biosoft.math.model.AbstractParser
ru.biosoft.math.xml.MathMLParser
- All Implemented Interfaces:
- Parser, ParserTreeConstants
- public class MathMLParser
- extends AbstractParser
- implements ParserTreeConstants
We assume xmlinput has the following format:
- Pendung:
- high csymbol parsing
| Methods inherited from class ru.biosoft.math.model.AbstractParser |
error, fatalError, getContext, getMessages, getStartNode, getVariableResolver, isDeclareUndefinedVariables, processConstant, processVariable, reinit, setContext, setDeclareUndefinedVariables, setOperator, setVariableResolver, warning |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
xmlDoc
protected org.w3c.dom.Document xmlDoc
mathSignsMap
protected java.util.Hashtable mathSignsMap
csymbolMap
protected java.util.Hashtable csymbolMap
lambdaFunctionName
protected java.lang.String lambdaFunctionName
MathMLParser
public MathMLParser()
fillMathSignsMap
protected void fillMathSignsMap()
declareCSymbolAsVariable
public void declareCSymbolAsVariable(java.lang.String name)
declareCSymbolAsFunction
public void declareCSymbolAsFunction(Function function)
parse
public int parse(java.lang.String xmlString)
- Specified by:
parse in interface Parser
parse
public int parse(org.w3c.dom.Element math)
buildTree
public void buildTree()
buildAstTree
protected Node buildAstTree(org.w3c.dom.Node xmlRoot)
processMATH
protected Node processMATH(org.w3c.dom.Node domNodeRoot)
processNode
protected Node processNode(org.w3c.dom.Node domNode)
processAPPLY
protected AstFunNode processAPPLY(org.w3c.dom.Node domNodeRoot)
- -tag is like serialized function call.
The first child element of apply is function name (see mathSignsMap, also may be ).
Then, various qualifier tags can be met. (we concern only , , )
Finally, arguments of the function can also be presented. (, , , )
p.s. is like on-the-fly declaration (not definition)
processCI
protected AstVarNode processCI(org.w3c.dom.Node domNode)
- Atrribute "type" is ignored.
processPI
protected AstConstant processPI(org.w3c.dom.Node domNodePI_EXP)
processEXP
protected AstConstant processEXP(org.w3c.dom.Node domNodeEXP)
processTRUE
protected AstConstant processTRUE()
processFALSE
protected AstConstant processFALSE()
processPIECEWISE
protected AstPiecewise processPIECEWISE(org.w3c.dom.Node domNodePW)
processPIECE
protected AstPiece processPIECE(org.w3c.dom.Node domNodePiece)
processCN
protected AstConstant processCN(org.w3c.dom.Element cnElement)
- We assume that attribute "type" can only be "integer", "real" or "e-notation". Attribute "base" is ignored.
processCSYMBOL
protected Node processCSYMBOL(org.w3c.dom.Node domNode)
processFunction
protected AstFunNode processFunction(org.w3c.dom.Node domNode)
setLambdaFunctionName
public void setLambdaFunctionName(java.lang.String lambdaFunctionName)
processLAMBDA
protected AstFunctionDeclaration processLAMBDA(org.w3c.dom.Node domNodeRoot)
processDEGREE
protected Node processDEGREE(org.w3c.dom.Node domNode)
processLOGBASE
protected Node processLOGBASE(org.w3c.dom.Node domNode)
processBVAR
protected AstVarNode processBVAR(org.w3c.dom.Node domNode)
getFirstChildElement
protected org.w3c.dom.Node getFirstChildElement(org.w3c.dom.Node domNode)
Copyright © 2001-2003 Biosof.Ru. All Rights Reserved.