gpt4 book ai didi

org.apache.uima.util.XMLizable.toXML()方法的使用及代码示例

转载 作者:知者 更新时间:2024-03-19 02:18:40 25 4
gpt4 key购买 nike

本文整理了Java中org.apache.uima.util.XMLizable.toXML()方法的一些代码示例,展示了XMLizable.toXML()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。XMLizable.toXML()方法的具体详情如下:
包路径:org.apache.uima.util.XMLizable
类名称:XMLizable
方法名:toXML

XMLizable.toXML介绍

[英]Writes this object's XML representation as a string in UTF-8 encoding.
[中]以UTF-8编码将此对象的XML表示形式写入字符串。

代码示例

代码示例来源:origin: org.apache.uima/ruta-core

private void toFile(XMLizable desc, File destination) throws SAXException, FileNotFoundException {
 destination.getParentFile().mkdirs();
 OutputStream out = new FileOutputStream(destination);
 XMLSerializer sax = new XMLSerializer(out);
 ContentHandler ch = sax.getContentHandler();
 ch.startDocument();
 desc.toXML(ch);
 ch.endDocument();
}

代码示例来源:origin: org.apache.uima/uimaj-tools

/**
  * Converts a given <code>XMLizable</code> object to String. This method is useful for
  * debugging.
  * 
  * @param content
  *          The given <code>XMLizable</code> object
  * @return A String that represents the given <code>XMLizable</code> object.
  */
 static String toXmlString(XMLizable content) {
  StringWriter sWriter = new StringWriter();
  PrintWriter oWriter = null;
  try {
   oWriter = new PrintWriter(sWriter);
   content.toXML(oWriter);
   oWriter.flush();
  } catch (Exception exc) {
  } finally {
   if (oWriter != null) {
    try {
     oWriter.close();
    } catch (Exception e) {
    }
   }
  }
  return sWriter.toString();
 }
}

代码示例来源:origin: apache/uima-uimaj

/**
 * Serialize an element named name, with the indicated attributes and value.
 * 
 * @param name
 *          is the element name
 * @param attributes
 *          are the attributes...serializer is free to add more.
 * @param value
 *          is the value
 * @param context
 *          is the SerializationContext
 */
public void serialize(QName name, Attributes attributes, Object value,
    SerializationContext context) throws IOException {
 if (value instanceof XMLizable) {
  try {
   // System.out.println("AxisResourceServiceSerializer::serialize(" + name + ")");
   context.startElement(name, attributes);
   SerializerContentHandler contentHandler = new SerializerContentHandler(context);
   ((XMLizable) value).toXML(contentHandler);
   context.endElement();
  } catch (SAXException e) {
   throw new IOException("SAXException: " + e.getMessage());
  }
 } else {
  throw new IOException("Can't serialize a " + value.getClass().getName()
      + " with an XmlSerializer.");
 }
}

代码示例来源:origin: apache/uima-uimaj

/**
 * Serialize an element named name, with the indicated attributes and value.
 * 
 * @param name
 *          is the element name
 * @param attributes
 *          are the attributes...serializer is free to add more.
 * @param value
 *          is the value
 * @param context
 *          is the SerializationContext
 */
public void serialize(QName name, Attributes attributes, Object value,
    SerializationContext context) throws IOException {
 if (value instanceof XMLizable) {
  try {
   // System.out.println("AxisResourceServiceSerializer::serialize(" + name + ")");
   context.startElement(name, attributes);
   SerializerContentHandler contentHandler = new SerializerContentHandler(context);
   ((XMLizable) value).toXML(contentHandler);
   context.endElement();
  } catch (SAXException e) {
   throw new IOException("SAXException: " + e.getMessage());
  }
 } else {
  throw new IOException("Can't serialize a " + value.getClass().getName()
      + " with an XmlSerializer.");
 }
}

代码示例来源:origin: org.apache.uima/uimaj-json

jch.withoutNl();
object.toXML(jch);

代码示例来源:origin: org.apache.uima/uimaj-ep-configurator

aed.toXML(contentHandler, true, true);
} else
 trueDescriptor.toXML(contentHandler, true);
contentHandler.endDocument();
writer.close();

代码示例来源:origin: apache/uima-uimaj

for (int j = 0; j < arr.length; j++) {
 XMLizable elem = (XMLizable) arr[j];
 elem.toXML(sc.ch);
 ((XMLizable) val).toXML(sc.ch);
} finally {
 serializer.deleteNodeStore();

代码示例来源:origin: apache/uima-uimaj

((XMLizable) val).toXML(sc.ch);

代码示例来源:origin: apache/uima-uimaj

((XMLizable)curElem).toXML(sc.ch);
} else if (curElem instanceof XMLizable) {
 ((XMLizable) curElem).toXML(sc.ch);

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com