/** * Formats a CAS as a String. * @param aCAS the cas to format as an xml string * @return the XML representation of the CAS * @throws CASException - */ public String format(CAS aCAS) throws CASException { return generateXML(aCAS, null); }
public void initialize() throws ResourceInitializationException { mDocNum = 0; mOutputDir = new File(((String) getConfigParameterValue(PARAM_OUTPUTDIR)).trim()); if (!mOutputDir.exists()) { mOutputDir.mkdirs(); } cas2xml = new CasToInlineXml(); mXCAS = (String) getConfigParameterValue(PARAM_XCAS); mTEXT = !("xcas".equalsIgnoreCase(mXCAS) || "xmi".equalsIgnoreCase(mXCAS)); }
CasToInlineXml casToInlineXml = new CasToInlineXml(); casToInlineXml.setFormattedOutput(false); String xmlAnnotations = casToInlineXml.generateXML(defaultView); FileOutputStream outStream = new FileOutputStream(inlineXmlFile); outStream.write(xmlAnnotations.getBytes("UTF-8"));
String xmlAnnotations = new CasToInlineXml().generateXML(defaultView); FileOutputStream outStream = new FileOutputStream(inlineXmlFile); outStream.write(xmlAnnotations.getBytes("UTF-8"));
replaceInvalidXmlChars(docCharArray); pos = nextAnnot.getBegin(); aHandler.startElement("", nextAnnot.getType().getName(), nextAnnot.getType().getName(), getFeatureAttributes(nextAnnot, aCAS));
CasToInlineXml casToInlineXml = new CasToInlineXml(); casToInlineXml.setFormattedOutput(false); String xmlAnnotations = casToInlineXml.generateXML(defaultView); FileOutputStream outStream = new FileOutputStream(inlineXmlFile); outStream.write(xmlAnnotations.getBytes("UTF-8"));
String xmlAnnotations = new CasToInlineXml().generateXML(defaultView); FileOutputStream outStream = new FileOutputStream(inlineXmlFile); outStream.write(xmlAnnotations.getBytes("UTF-8"));
CasToInlineXml casToInlineXml = new CasToInlineXml(); casToInlineXml.setFormattedOutput(false); String xmlAnnotations = casToInlineXml.generateXML(defaultView); FileOutputStream outStream = new FileOutputStream(inlineXmlFile); outStream.write(xmlAnnotations.getBytes("UTF-8"));
String xmlAnnotations = new CasToInlineXml() .generateXML(defaultView); FileOutputStream outStream = new FileOutputStream(inlineXmlFile); outStream.write(xmlAnnotations.getBytes("UTF-8"));
/** * Formats a CAS as a String. Only FeatureStructures matching the given filter will be output. * @param aCAS CAS * @param aFilter a filter to limit the Feature Structures * @return the XML representation * @throws CASException - */ public String format(CAS aCAS, FSMatchConstraint aFilter) throws CASException { return generateXML(aCAS, aFilter); }
@Override public void initialize(UimaContext aContext) throws ResourceInitializationException { super.initialize(aContext); if (xslt != null) { TransformerFactory tf = TransformerFactory.newInstance(); try { URL url = ResourceUtils.resolveLocation(xslt, this, getContext()); transformer = tf.newTransformer(new StreamSource(url.openStream())); } catch (Exception e) { throw new ResourceInitializationException(e); } } cas2xml = new CasToInlineXml(); }
String xmlAnnotations = new CasToInlineXml() .generateXML(defaultView); FileOutputStream outStream = new FileOutputStream(inlineXmlFile); outStream.write(xmlAnnotations.getBytes("UTF-8"));
/** * Generates inline XML from a CAS. * * @param aCAS * CAS to generate from * @return the inline XML version of the CAS * @throws CASException - */ public String generateXML(CAS aCAS) throws CASException { return generateXML(aCAS, null); }
/** * Generates inline XML from a CAS. * * @param aCAS * CAS to generate from * @param aFilter * constraint that determines which annotations are included in the output. If null (or * ommitted), all annotations are included. * @throws CASException - * @return the inline form */ public String generateXML(CAS aCAS, FSMatchConstraint aFilter) throws CASException { ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream(); XMLSerializer sax2xml = new XMLSerializer(byteArrayOutputStream, formattedOutput); generateXML(aCAS, aFilter, sax2xml.getContentHandler()); // return XML string return new String(byteArrayOutputStream.toByteArray()); }
docOS = getOutputStream(aJCas, ".xml"); final String xmlAnnotations = cas2xml.generateXML(aJCas.getCas()); if (transformer != null) { transformer.transform(
outStream = new FileOutputStream(outFile); if (hasDefaultView) { String xmlAnnotations = cas2xml.generateXML(aCAS); outStream.write(xmlAnnotations.getBytes("UTF-8")); } else {