Package org.sbml.jsbml.util.compilers

Examples of org.sbml.jsbml.util.compilers.MathMLXMLStreamCompiler


      element.setIndentation(whitespaces, indent + indentCount, indentCount);

      // Creating an SMOutputElement to be sure that the previous nested element tag is closed properly.
      SMNamespace mathMLNamespace = element.getNamespace(ASTNode.URI_MATHML_DEFINITION, ASTNode.URI_MATHML_PREFIX);
      SMOutputElement mathElement = element.addElement(mathMLNamespace, "math");
      MathMLXMLStreamCompiler compiler = new MathMLXMLStreamCompiler(
          writer, createIndentationString(indent + indentCount));
      boolean isSBMLNamespaceNeeded = compiler.isSBMLNamespaceNeeded(m.getMath());

      // TODO: add all other namespaces !!

      if (isSBMLNamespaceNeeded) {
        // writing the SBML namespace
        SBMLDocument doc = null;
        SBase sbase = m.getMath().getParentSBMLObject();
        String sbmlNamespace = SBMLDocument.URI_NAMESPACE_L3V1Core;
       
        if (sbase != null) {
          doc = sbase.getSBMLDocument();
          sbmlNamespace = doc.getSBMLDocumentNamespaces().get("xmlns");
         
          if (sbmlNamespace == null) {
            logger.warn("writeMathML: the SBML namespace of this SBMLDocument" +
                " could not be found, using the default namespace (" +
                SBMLDocument.URI_NAMESPACE_L3V1Core + ") instead.");
            sbmlNamespace = SBMLDocument.URI_NAMESPACE_L3V1Core;
          }
        }
        writer.writeNamespace("sbml", sbmlNamespace);
      }
     
      mathElement.setIndentation(createIndentationString(indent + 2), indent + indentCount, indentCount);
     
      writer.writeCharacters(whitespaces);
      writer.writeCharacters("\n");

      compiler.compile(m.getMath());

      writer.writeCharacters(whitespaces);
    }
  }
View Full Code Here


      element.setIndentation(whitespaces, indent + indentCount, indentCount);

      // Creating an SMOutputElement to be sure that the previous nested element tag is closed properly.
      SMNamespace mathMLNamespace = element.getNamespace(ASTNode.URI_MATHML_DEFINITION, ASTNode.URI_MATHML_PREFIX);
      SMOutputElement mathElement = element.addElement(mathMLNamespace, "math");
      MathMLXMLStreamCompiler compiler = new MathMLXMLStreamCompiler(
          writer, createIndentationString(indent + indentCount));
      boolean isSBMLNamespaceNeeded = compiler.isSBMLNamespaceNeeded(m.getMath());

      // TODO : add all other namespaces !!

      if (isSBMLNamespaceNeeded) {
        // writing the SBML namespace
        SBMLDocument doc = null;
        SBase sbase = m.getMath().getParentSBMLObject();
        String sbmlNamespace = SBMLDocument.URI_NAMESPACE_L3V1Core;
       
        if (sbase != null) {
          doc = sbase.getSBMLDocument();
          sbmlNamespace = doc.getSBMLDocumentNamespaces().get("xmlns");
         
          if (sbmlNamespace == null) {
            logger.warn("writeMathML : the SBML namespace of this SBMLDocument" +
                " could not be found, using the default namespace (" +
                SBMLDocument.URI_NAMESPACE_L3V1Core + ") instead.");
            sbmlNamespace = SBMLDocument.URI_NAMESPACE_L3V1Core;
          }
        }
        writer.writeNamespace("sbml", sbmlNamespace);
      }
     
      mathElement.setIndentation(createIndentationString(indent + 2), indent + indentCount, indentCount);
     
      writer.writeCharacters(whitespaces);
      writer.writeCharacters("\n");

      compiler.compile(m.getMath());

      writer.writeCharacters(whitespaces);
    }
  }
View Full Code Here

      element.setIndentation(whitespaces, indent + indentCount, indentCount);

      // Creating an SMOutputElement to be sure that the previous nested element tag is closed properly.
      SMNamespace mathMLNamespace = element.getNamespace(ASTNode.URI_MATHML_DEFINITION, ASTNode.URI_MATHML_PREFIX);
      SMOutputElement mathElement = element.addElement(mathMLNamespace, "math");
      MathMLXMLStreamCompiler compiler = new MathMLXMLStreamCompiler(
          writer, createIndentationString(indent + indentCount));
      boolean isSBMLNamespaceNeeded = compiler.isSBMLNamespaceNeeded(m.getMath());

      // TODO : add all other namespaces !!

      if (isSBMLNamespaceNeeded) {
        // writing the SBML namespace
        SBMLDocument doc = null;
        SBase sbase = m.getMath().getParentSBMLObject();
        String sbmlNamespace = SBMLDocument.URI_NAMESPACE_L3V1Core;
       
        if (sbase != null) {
          doc = sbase.getSBMLDocument();
          sbmlNamespace = doc.getSBMLDocumentNamespaces().get("xmlns");
         
          if (sbmlNamespace == null) {
            logger.warn("writeMathML : the SBML namespace of this SBMLDocument" +
                " could not be found, using the default namespace (" +
                SBMLDocument.URI_NAMESPACE_L3V1Core + ") instead.");
            sbmlNamespace = SBMLDocument.URI_NAMESPACE_L3V1Core;
          }
        }
        writer.writeNamespace("sbml", sbmlNamespace);
      }
     
      mathElement.setIndentation(createIndentationString(indent + 2), indent + indentCount, indentCount);
     
      writer.writeCharacters(whitespaces);
      writer.writeCharacters("\n");

      compiler.compile(m.getMath());

      writer.writeCharacters(whitespaces);
    }
  }
View Full Code Here

TOP

Related Classes of org.sbml.jsbml.util.compilers.MathMLXMLStreamCompiler

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.