Examples of XmiCasSerializer


Examples of org.apache.uima.cas.impl.XmiCasSerializer

        throwCoreException(e);
      } catch (SAXException e) {
        throwCoreException(e);
      }
    } else if (DocumentFormat.XMI.equals(format)) {
      XmiCasSerializer xmiSerializer = new XmiCasSerializer(mCAS.getTypeSystem());

      XMLSerializer xmlSerialzer = new XMLSerializer(out, true);

      try {
        xmiSerializer.serialize(mCAS, xmlSerialzer.getContentHandler());
      } catch (SAXException e) {
        throwCoreException(e);
      }
    } else {
      throw new CoreException(new Status(IStatus.ERROR, CasEditorPlugin.ID, IStatus.OK,
View Full Code Here

Examples of org.apache.uima.cas.impl.XmiCasSerializer

    FileOutputStream out = null;

    try {
      // write XMI
      out = new FileOutputStream(name);
      XmiCasSerializer ser = new XmiCasSerializer(aCas.getTypeSystem());
      XMLSerializer xmlSer = new XMLSerializer(out, false);
      ser.serialize(aCas, xmlSer.getContentHandler());
    } finally {
      if (out != null) {
        out.close();
      }
    }
View Full Code Here

Examples of org.apache.uima.cas.impl.XmiCasSerializer

    if (useBinaryCas) {
      Serialization.serializeWithCompression(jcas.getCas(), bos, jcas.getTypeSystem());
    }
    else {
      // write XMI
      XmiCasSerializer ser = new XmiCasSerializer(jcas.getTypeSystem());
      XMLSerializer xmlSer = new XMLSerializer(bos, false);
      ser.serialize(jcas.getCas(), xmlSer.getContentHandler());
    }
    bos.flush();
      zos.closeEntry();
  } catch (Exception e) {
        throw new AnalysisEngineProcessException(e);
View Full Code Here

Examples of org.apache.uima.cas.impl.XmiCasSerializer

    public void process(JCas jCas) throws AnalysisEngineProcessException {
      File xmiFile = getXMIFile(this.xmiDirectory, jCas);
      try {
        FileOutputStream outputStream = new FileOutputStream(xmiFile);
        try {
          XmiCasSerializer serializer = new XmiCasSerializer(jCas.getTypeSystem());
          ContentHandler handler = new XMLSerializer(outputStream, false).getContentHandler();
          serializer.serialize(jCas.getCas(), handler);
        } finally {
          outputStream.close();
        }
      } catch (SAXException e) {
        throw new AnalysisEngineProcessException(e);
View Full Code Here

Examples of org.apache.uima.cas.impl.XmiCasSerializer

          throw new IllegalArgumentException("No documentID for CAS:\n" + jCas);
        }
        File outFile = toXMIFile(options, new File(documentID));
        FileOutputStream stream = new FileOutputStream(outFile);
        ContentHandler handler = new XMLSerializer(stream).getContentHandler();
        new XmiCasSerializer(jCas.getTypeSystem()).serialize(jCas.getCas(), handler);
        stream.close();
      }
    }
  }
View Full Code Here

Examples of org.apache.uima.cas.impl.XmiCasSerializer

        if (documentID == null) {
          throw new IllegalArgumentException("No documentID for CAS:\n" + jCas);
        }
        File outFile = new File(this.outputDirectory, documentID + ".xmi");
        ContentHandler handler = new XMLSerializer(new FileOutputStream(outFile)).getContentHandler();
        new XmiCasSerializer(jCas.getTypeSystem()).serialize(jCas.getCas(), handler);
      } catch (CASRuntimeException e) {
        throw new AnalysisEngineProcessException(e);
      } catch (SAXException e) {
        throw new AnalysisEngineProcessException(e);
      } catch (FileNotFoundException e) {
View Full Code Here

Examples of org.apache.uima.cas.impl.XmiCasSerializer

    File outFile = new File(outputDirectory, id );
    FileOutputStream out = null;

    try {
      out = new FileOutputStream(outFile);
      XmiCasSerializer ser = new XmiCasSerializer(aCas.getTypeSystem());
      XMLSerializer xmlSer = new XMLSerializer(out, false);
      ser.serialize(aCas, xmlSer.getContentHandler());
    }
    finally {
      if (out != null) {
        out.close();
      }
View Full Code Here

Examples of org.apache.uima.cas.impl.XmiCasSerializer

      typeSystem = aCAS.getTypeSystem();
    XMLSerializer xmlSer = new XMLSerializer(stream, false);
    if (encoding != null)
      xmlSer.setOutputProperty(OutputKeys.ENCODING, encoding);

    XmiCasSerializer ser = new XmiCasSerializer(typeSystem);

    ser.serialize(aCAS, xmlSer.getContentHandler());
  }
View Full Code Here

Examples of org.apache.uima.cas.impl.XmiCasSerializer

  public String serializeCasToXmi(CAS aCAS, XmiSerializationSharedData serSharedData)
          throws Exception {
    Writer writer = new StringWriter();
    try {
      XMLSerializer xmlSer = new XMLSerializer(writer, false);
      XmiCasSerializer ser = new XmiCasSerializer(aCAS.getTypeSystem());
      ser.serialize(aCAS, xmlSer.getContentHandler(), null, serSharedData);
      return writer.toString();
    } catch (SAXException e) {
      throw e;
    } finally {
      writer.close();
View Full Code Here

Examples of org.apache.uima.cas.impl.XmiCasSerializer

  public String serializeCasToXmi(CAS aCAS, XmiSerializationSharedData serSharedData, Marker aMarker)
          throws Exception {
    Writer writer = new StringWriter();
    try {
      XMLSerializer xmlSer = new XMLSerializer(writer, false);
      XmiCasSerializer ser = new XmiCasSerializer(aCAS.getTypeSystem());
      ser.serialize(aCAS, xmlSer.getContentHandler(), null, serSharedData, aMarker);
      return writer.toString();
    } catch (SAXException e) {
      throw e;
    } finally {
      writer.close();
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.