本文整理了Java中org.geotools.xml.Encoder.write()
方法的一些代码示例,展示了Encoder.write()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Encoder.write()
方法的具体详情如下:
包路径:org.geotools.xml.Encoder
类名称:Encoder
方法名:write
暂无
代码示例来源:origin: org.geotools/gt2-xml-core
/**
* Encodes an object, element name pair.
*
* @param object The object to encode.
* @param element The name of the element to encode.
*
* @return The object encoded.
* @throws Exception
*/
protected Document encode(Object object, QName element)
throws Exception {
Configuration configuration = createConfiguration();
XSDSchema schema = configuration.getXSD().getSchema();
Encoder encoder = new Encoder(configuration, schema);
ByteArrayOutputStream output = new ByteArrayOutputStream();
encoder.write(object, element, output);
DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
dbf.setNamespaceAware(true);
return dbf.newDocumentBuilder().parse(new ByteArrayInputStream(output.toByteArray()));
}
代码示例来源:origin: org.geotools/gt2-xml-xsd
/**
* Encodes an object, element name pair.
*
* @param object The object to encode.
* @param element The name of the element to encode.
*
* @return The object encoded.
* @throws Exception
*/
protected Document encode( Object object, QName element ) throws Exception {
Configuration configuration = createConfiguration();
XSDSchema schema = configuration.getSchemaLocator().locateSchema(
null, configuration.getNamespaceURI(), null, null
);
Encoder encoder = new Encoder( configuration, schema );
ByteArrayOutputStream output = new ByteArrayOutputStream();
encoder.write( object, element, output );
DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
dbf.setNamespaceAware( true );
return dbf.newDocumentBuilder().parse(
new ByteArrayInputStream( output.toByteArray() )
);
}
代码示例来源:origin: org.geotools.xsd/gt-core
encoder.write(object, element, output);
内容来源于网络,如有侵权,请联系作者删除!