Class MathMLContentBuilder

    • Constructor Detail

      • MathMLContentBuilder

        public MathMLContentBuilder​(Jep jep)
                             throws javax.xml.parsers.ParserConfigurationException
        Throws:
        javax.xml.parsers.ParserConfigurationException
    • Method Detail

      • newDocument

        public org.w3c.dom.Document newDocument()
        Create an empty document.
        Returns:
        a new empty document
      • newDocumentMathMLDTD

        public org.w3c.dom.Document newDocumentMathMLDTD()
        Create a document with the MathML DTD and a <math> tag as the root element. Use
        Document jepDoc = db.newDocumentMathMLDTD();
                Element e = db.buildChild(jepNode, jepDoc);
                jepDoc.getDocumentElement().appendChild(e);
         
        to add contents.
        Returns:
        a new document
      • newDocumentMathMLDTD

        public org.w3c.dom.Document newDocumentMathMLDTD​(java.lang.String systemID)
        Create a document with the MathML DTD with the specified systemID and a <math> tag as the root element. Use
        Document jepDoc = db.newDocumentMathMLDTD();
                Element e = db.buildChild(jepNode, jepDoc);
                jepDoc.getDocumentElement().appendChild(e);
         
        to add contents.
        Parameters:
        systemID - the systemID to use
        Returns:
        a new document
      • buildDocument

        public org.w3c.dom.Document buildDocument​(Node node)
                                           throws JepException
        Create a document containing an single math tag with a single child, no namespace is used.
        Parameters:
        node - jep node for expression
        Returns:
        a new document
        Throws:
        JepException
      • buildDocument

        public org.w3c.dom.Document buildDocument​(Node node,
                                                  boolean useNamespace)
                                           throws JepException
        Create a document containing an single math tag with a single child, no namespace is used.
        Parameters:
        node - jep node for expression
        useNamespace -
        Returns:
        a new document
        Throws:
        JepException
      • buildDocument

        public org.w3c.dom.Document buildDocument​(Node node,
                                                  boolean useNamespace,
                                                  javax.xml.parsers.DocumentBuilder docb)
                                           throws JepException
        Create a document containing an single math tag with a single child, if useNamespace is set then the standard MathML namespace is used.
        Parameters:
        node -
        useNamespace -
        docb -
        Returns:
        a new document
        Throws:
        JepException
      • buildDocument

        public org.w3c.dom.Document buildDocument​(Node node,
                                                  java.lang.String prefix)
                                           throws JepException
        Builds a document using a given namespace prefix
        Parameters:
        node -
        prefix -
        Returns:
        a new document
        Throws:
        JepException
      • buildDocument

        public org.w3c.dom.Document buildDocument​(Node node,
                                                  java.lang.String prefix,
                                                  javax.xml.parsers.DocumentBuilder docb)
                                           throws JepException
        Throws:
        JepException
      • buildMathElement

        public org.w3c.dom.Element buildMathElement​(Node node,
                                                    org.w3c.dom.Document d,
                                                    boolean useNamespace)
                                             throws JepException
        Builds a <math> element with a single child element, with content mark up for the Jep expression.
        Parameters:
        node - Jep expression
        d - the document
        useNamespace - use the standard MathML namespace
        Returns:
        a new element representing the Jep expression
        Throws:
        JepException
      • buildMathElement

        public org.w3c.dom.Element buildMathElement​(Node[] nodes,
                                                    org.w3c.dom.Document d,
                                                    boolean useNamespace)
                                             throws JepException
        Builds a <math> element with one child element per node.
        Parameters:
        nodes - an array of Jep expressions
        d - the document
        useNamespace - whether to use the standard MathML namespace.
        Returns:
        a new element representing the Jep expression
        Throws:
        JepException
      • buildMathElement

        public org.w3c.dom.Element buildMathElement​(Node node,
                                                    org.w3c.dom.Document d,
                                                    java.lang.String prefix)
                                             throws JepException
        Builds a <math> element with a single child, the standard MathML namespace and a specified namespace prefix
        Parameters:
        node - Jep expression
        d - the document to create elements in
        prefix - the namespace-prefix to use the prefix will be attached to all MathML elements and attributes
        Returns:
        DOM element for the math tag
        Throws:
        JepException
      • buildMathElement

        public org.w3c.dom.Element buildMathElement​(Node[] nodes,
                                                    org.w3c.dom.Document d,
                                                    java.lang.String prefix)
                                             throws JepException
        Builds a <math> element with a single child, the standard MathML namespace and a specified namespace prefix
        Parameters:
        nodes - an array of Jep expressions
        d - the document to create elements in
        prefix - the namespace-prefix to use the prefix will be attached to all MathML elements and attributes
        Returns:
        DOM element for the math tag
        Throws:
        JepException
      • buildChild

        public org.w3c.dom.Element buildChild​(Node n,
                                              org.w3c.dom.Document d)
                                       throws JepException
        Builds a Element representing a Jep sub-expression.
        Specified by:
        buildChild in interface MathMLDocumentBuilder
        Parameters:
        n - the jep node
        d - the document to create the element in.
        Returns:
        element representing the node
        Throws:
        JepException
      • createElement

        public org.w3c.dom.Element createElement​(java.lang.String name,
                                                 org.w3c.dom.Document doc)
        Create an element using the MAthML namespaces if needed. If namespacePrefix is set then MathML namespace will be used and Document.createElementNS is called.
        Specified by:
        createElement in interface MathMLDocumentBuilder
        Parameters:
        name - local name of element without prefix.
        doc - document to create an element in.
        Returns:
        a new Element
      • setAttribute

        public void setAttribute​(org.w3c.dom.Element e,
                                 java.lang.String name,
                                 java.lang.String value)
        Sets an element attribute using namespaces if required. If namespacePrefix is set then MathML namespace will be used and Element.setAttributeNS is called.
        Specified by:
        setAttribute in interface MathMLDocumentBuilder
        Parameters:
        e - element to set an attribut of
        name - name of attribute
        value - value of attribute
      • setNumberBuilder

        public void setNumberBuilder​(NumberBuilder numberBuilder)
      • setVaribleBuilder

        public void setVaribleBuilder​(VariableBuilder varibleBuilder)
      • putConstant

        public java.lang.String putConstant​(java.lang.String key,
                                            java.lang.String value)
      • putEntity

        public java.lang.String putEntity​(java.lang.String key,
                                          java.lang.String value)
      • putOperator

        public java.lang.String putOperator​(Operator key,
                                            java.lang.String value)
      • putFunction

        public java.lang.String putFunction​(java.lang.String key,
                                            java.lang.String value)
      • getDocumentBuilderFactory

        public javax.xml.parsers.DocumentBuilderFactory getDocumentBuilderFactory()
      • setDocumentBuilderFactory

        public void setDocumentBuilderFactory​(javax.xml.parsers.DocumentBuilderFactory dbf)
      • getNamespacePrefix

        public java.lang.String getNamespacePrefix()
      • setNamespacePrefix

        public void setNamespacePrefix​(java.lang.String namespacePrefix)
      • setFunctionBuilder

        public void setFunctionBuilder​(FunctionBuilder functionBuilder)
      • setOperatorBuilder

        public void setOperatorBuilder​(OperatorBuilder operatorBuilder)
      • setDoubleBehaviour

        public void setDoubleBehaviour​(NumberBuilder.DoubleBehaviour doubleBehaviour)
        Sets how double values with integral values are represented.
        • ALLWAYS_DOUBLE <cn>2.0</cn>
        • NO_DECIMALPOINT <cn>2.0</cn>
        • TYPE_INTEGER <cn type="integer">2</cn>
        Parameters:
        doubleBehaviour -