Examples of SMNamespace


Examples of org.codehaus.staxmate.out.SMNamespace

  public void serialize( @NotNull T object, @NotNull OutputStream out ) throws IOException {
    try {
      SMOutputDocument doc = StaxMateSupport.getSmOutputFactory().createOutputDocument( out );

      String nameSpaceUri = getNameSpaceUri();
      SMNamespace nameSpace = doc.getNamespace( nameSpaceUri );

      SMOutputElement root = doc.addElement( nameSpace, getDefaultElementName() );
      serialize( root, object );
      doc.closeRoot();
    } catch ( XMLStreamException e ) {
View Full Code Here

Examples of org.codehaus.staxmate.out.SMNamespace

  public void serialize( @Nonnull T object, @Nonnull OutputStream out ) throws IOException {
    try {
      SMOutputDocument doc = StaxMateSupport.getSmOutputFactory().createOutputDocument( out );

      String nameSpaceUri = getNameSpace();
      SMNamespace nameSpace = doc.getNamespace( nameSpaceUri );

      SMOutputElement root = doc.addElement( nameSpace, getDefaultElementName() );
      serialize( root, object, getFormatVersion() );
      doc.closeRoot();
    } catch ( XMLStreamException e ) {
View Full Code Here

Examples of org.codehaus.staxmate.out.SMNamespace

    String SBMLNamespace = JSBML.getNamespaceFrom(sbmlDocument.getLevel(),
        sbmlDocument.getVersion());
    SMOutputContext context = outputDocument.getContext();
    context.setIndentation("\n" + createIndentationString(indentCount), 1, 2);
    SMNamespace namespace = context.getNamespace(SBMLNamespace);
    namespace.setPreferredPrefix("");
    outputDocument.addCharacters("\n");

    /*
     * Write a comment to track which program created this SBML file and
     * which version of JSBML was used for this purpose.
View Full Code Here

Examples of org.codehaus.staxmate.out.SMNamespace

      SMRootFragment outputDocument = SMOutputFactory.createOutputFragment(writer);

      // create the sbmlNamespace variable
      String sbmlNamespace = JSBML.getNamespaceFrom(sbase.getLevel(), sbase.getVersion());
      SMOutputContext context = outputDocument.getContext();
      SMNamespace namespace = context.getNamespace(sbmlNamespace);
      namespace.setPreferredPrefix("");
     
      // all the sbml element namespaces are registered to the writer in the writeAnnotation method

      // call the writeAnnotation, indicating that we are building an xml fragment
      writeAnnotation(sbase, outputDocument, writer, 0, true);
View Full Code Here

Examples of org.codehaus.staxmate.out.SMNamespace

      XMLStreamWriter writer, int indent, boolean xmlFragment)
    throws XMLStreamException, SBMLException {
   
    // create the sbmlNamespace variable
    String sbmlNamespace = JSBML.getNamespaceFrom(sbase.getLevel(), sbase.getVersion());
    SMNamespace namespace = element.getContext().getNamespace(sbmlNamespace);

    namespace.setPreferredPrefix("");
    Annotation annotation = sbase.getAnnotation();
    SMOutputElement annotationElement;
    String whiteSpaces = createIndentationString(indent);
   
    if (xmlFragment) {
View Full Code Here

Examples of org.codehaus.staxmate.out.SMNamespace

      element.addCharacters("\n");
      // set the indentation for the math opening tag     
      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());
View Full Code Here

Examples of org.codehaus.staxmate.out.SMNamespace

    element.addCharacters("\n");
    // set the indentation for the next element
    element.setIndentation(whitespaces, indent + indentCount, indentCount);

    // Creating an SMOutputElement to be sure that the previous nested element tag is closed properly.
    SMNamespace sbmlSMNamespace = element.getNamespace();
    SMOutputElement messageElement = element.addElement(sbmlSMNamespace, "message");
    messageElement.setIndentation(createIndentationString(indent + 2), indent + indentCount, indentCount);

    writer.writeCharacters(whitespaces);
    writer.writeCharacters("\n");
View Full Code Here

Examples of org.codehaus.staxmate.out.SMNamespace

      SMOutputElement annotationElement, XMLStreamWriter writer,
      int indent) throws XMLStreamException {
    // Logger logger = Logger.getLogger(SBMLWriter.class);

    String whiteSpace = createIndentationString(indent);
    SMNamespace namespace = annotationElement.getNamespace(
        Annotation.URI_RDF_SYNTAX_NS, "rdf");
    annotationElement.setIndentation(whiteSpace, indent, indentCount);
    SMOutputElement rdfElement = annotationElement.addElement(namespace,
        "RDF");

    /*
     * TODO: Check which name spaces are really required and add only those;
     * particularly, if name spaces are missing and it is known from the
     * kind of RDF annotation, which name spaces are needed, these should be
     * added automatically here.
     */
    Map<String, String> rdfNamespaces = annotation.getRDFAnnotationNamespaces();

    for (String namespaceURI : rdfNamespaces.keySet()) {
     
      if (!namespaceURI.equals(namespace.getURI())) {
        writer.writeNamespace(rdfNamespaces.get(namespaceURI), namespaceURI);
      }
    }

    // Checking if all the necessary namespaces are defined
View Full Code Here

Examples of org.codehaus.staxmate.out.SMNamespace

          SMOutputElement newOutPutElement = null;
          if (parentXmlObject.isSetName()) {
            boolean isClosedMathContainer = false, isClosedAnnotation = false;
           
            if (parentXmlObject.isSetNamespace()) {
              SMNamespace namespaceContext = smOutputParentElement
                  .getNamespace(
                      parentXmlObject.getNamespace(),
                      parentXmlObject.getPrefix());
              newOutPutElement = smOutputParentElement
                  .addElement(namespaceContext,
View Full Code Here

Examples of org.codehaus.staxmate.out.SMNamespace

    String SBMLNamespace = JSBML.getNamespaceFrom(sbmlDocument.getLevel(),
        sbmlDocument.getVersion());
    SMOutputContext context = outputDocument.getContext();
    context.setIndentation("\n" + createIndentationString(indentCount), 1, 2);
    SMNamespace namespace = context.getNamespace(SBMLNamespace);
    namespace.setPreferredPrefix("");
    outputDocument.addCharacters("\n");

    /*
     * Write a comment to track which program created this SBML file and
     * which version of JSBML was used for this purpose.
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.