• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java XMLContext类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.exolab.castor.xml.XMLContext的典型用法代码示例。如果您正苦于以下问题:Java XMLContext类的具体用法?Java XMLContext怎么用?Java XMLContext使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



XMLContext类属于org.exolab.castor.xml包,在下文中一共展示了XMLContext类的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: createXMLContext

import org.exolab.castor.xml.XMLContext; //导入依赖的package包/类
/**
 * Create the Castor {@code XMLContext}. Subclasses can override this to create a custom context.
 * <p>The default implementation loads mapping files if defined, or the target class or packages if defined.
 * @return the created resolver
 * @throws MappingException when the mapping file cannot be loaded
 * @throws IOException in case of I/O errors
 * @see XMLContext#addMapping(org.exolab.castor.mapping.Mapping)
 * @see XMLContext#addClass(Class)
 */
protected XMLContext createXMLContext(Resource[] mappingLocations, Class<?>[] targetClasses,
		String[] targetPackages) throws MappingException, ResolverException, IOException {

	XMLContext context = new XMLContext();
	if (!ObjectUtils.isEmpty(mappingLocations)) {
		Mapping mapping = new Mapping();
		for (Resource mappingLocation : mappingLocations) {
			mapping.loadMapping(SaxResourceUtils.createInputSource(mappingLocation));
		}
		context.addMapping(mapping);
	}
	if (!ObjectUtils.isEmpty(targetClasses)) {
		context.addClasses(targetClasses);
	}
	if (!ObjectUtils.isEmpty(targetPackages)) {
		context.addPackages(targetPackages);
	}
	if (this.castorProperties != null) {
		for (Map.Entry<String, String> property : this.castorProperties.entrySet()) {
			context.setProperty(property.getKey(), property.getValue());
		}
	}
	return context;
}
 
开发者ID:langtianya,项目名称:spring4-understanding,代码行数:34,代码来源:CastorMarshaller.java


示例2: getStatisticDescriptors

import org.exolab.castor.xml.XMLContext; //导入依赖的package包/类
@Override
public List<StatisticDescriptor> getStatisticDescriptors(String filePath)
		throws ParserException {
	try {
		Mapping mapping = new Mapping();
		mapping.loadMapping(FileUtils.findFileAsResource("StatisticDescriptorMapping.xml"));
		XMLContext context = new XMLContext();
		context.addMapping(mapping);
		InputSource source = new InputSource(FileUtils.findFileAsStream(filePath));
		Unmarshaller unmarshaller = context.createUnmarshaller();
		unmarshaller.setClass(StatisticList.class);
		StatisticList list = (StatisticList)unmarshaller.unmarshal(source);
		validate(list.getDescriptors());
		return list.getDescriptors();
	} catch (Exception e) {
		ParserException parserException = new ParserException("Exception parsing statistic descriptor files", e);
		Logger.getLogger(this.getClass()).error(parserException.getMessage(), parserException);
		throw parserException;
	} 
}
 
开发者ID:lafourchette,项目名称:solrmeter,代码行数:21,代码来源:StatisticsParserCastorImpl.java


示例3: createXMLContext

import org.exolab.castor.xml.XMLContext; //导入依赖的package包/类
/**
 * Create the Castor {@code XMLContext}. Subclasses can override this to create a custom context.
 * <p>The default implementation loads mapping files if defined, or the target class or packages if defined.
 * @return the created resolver
 * @throws MappingException when the mapping file cannot be loaded
 * @throws IOException in case of I/O errors
 * @see XMLContext#addMapping(org.exolab.castor.mapping.Mapping)
 * @see XMLContext#addClass(Class)
 */
protected XMLContext createXMLContext(Resource[] mappingLocations, Class[] targetClasses, String[] targetPackages)
		throws MappingException, ResolverException, IOException {

	XMLContext context = new XMLContext();
	if (!ObjectUtils.isEmpty(mappingLocations)) {
		Mapping mapping = new Mapping();
		for (Resource mappingLocation : mappingLocations) {
			mapping.loadMapping(SaxResourceUtils.createInputSource(mappingLocation));
		}
		context.addMapping(mapping);
	}
	if (!ObjectUtils.isEmpty(targetClasses)) {
		context.addClasses(targetClasses);
	}
	if (!ObjectUtils.isEmpty(targetPackages)) {
		context.addPackages(targetPackages);
	}
	if (this.castorProperties != null) {
		for (Map.Entry<String, String> property : this.castorProperties.entrySet()) {
			context.setProperty(property.getKey(), property.getValue());
		}
	}
	return context;
}
 
开发者ID:deathspeeder,项目名称:class-guard,代码行数:34,代码来源:CastorMarshaller.java


示例4: marshal

import org.exolab.castor.xml.XMLContext; //导入依赖的package包/类
/**
 * {@inheritDoc}
 *
 * @see marshalsec.MarshallerBase#marshal(java.lang.Object)
 */
@Override
public String marshal ( Object o ) throws Exception {
    XMLContext context = new XMLContext();
    Marshaller m = context.createMarshaller();
    StringWriter sw = new StringWriter();
    m.setWriter(sw);
    return sw.toString();
}
 
开发者ID:mbechler,项目名称:marshalsec,代码行数:14,代码来源:Castor.java


示例5: unmarshal

import org.exolab.castor.xml.XMLContext; //导入依赖的package包/类
/**
 * {@inheritDoc}
 *
 * @see marshalsec.MarshallerBase#unmarshal(java.lang.Object)
 */
@Override
public Object unmarshal ( String data ) throws Exception {
    XMLContext context = new XMLContext();
    Unmarshaller unmarshaller = context.createUnmarshaller();
    return unmarshaller.unmarshal(new StringReader(data));
}
 
开发者ID:mbechler,项目名称:marshalsec,代码行数:12,代码来源:Castor.java


示例6: getWriteXmlContext

import org.exolab.castor.xml.XMLContext; //导入依赖的package包/类
private XMLContext getWriteXmlContext()
{
	String targetVersion = JRPropertiesUtil.getInstance(jasperReportsContext).getProperty(
			JRXmlBaseWriter.PROPERTY_REPORT_VERSION);
	if (log.isDebugEnabled())
	{
		log.debug("using write mappings for version " + targetVersion);
	}
	
	return getXmlContext(CASTOR_WRITE_XML_CONTEXT_KEY, targetVersion);
}
 
开发者ID:TIBCOSoftware,项目名称:jasperreports,代码行数:12,代码来源:CastorUtil.java


示例7: getReadXmlContext

import org.exolab.castor.xml.XMLContext; //导入依赖的package包/类
private XMLContext getReadXmlContext()
{
	return getXmlContext(CASTOR_READ_XML_CONTEXT_KEY, null);//always reading with the last version mappings
}
 
开发者ID:TIBCOSoftware,项目名称:jasperreports,代码行数:5,代码来源:CastorUtil.java


示例8: AbstractCastorDataFormat

import org.exolab.castor.xml.XMLContext; //导入依赖的package包/类
public AbstractCastorDataFormat(XMLContext xmlContext) {
    this.xmlContext = xmlContext;
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:4,代码来源:AbstractCastorDataFormat.java


示例9: setXmlContext

import org.exolab.castor.xml.XMLContext; //导入依赖的package包/类
public void setXmlContext(XMLContext xmlContext) {
    this.xmlContext = xmlContext;
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:4,代码来源:AbstractCastorDataFormat.java


示例10: CastorDataFormat

import org.exolab.castor.xml.XMLContext; //导入依赖的package包/类
public CastorDataFormat(XMLContext xmlContext) {
    super(xmlContext);
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:4,代码来源:CastorDataFormat.java


示例11: init

import org.exolab.castor.xml.XMLContext; //导入依赖的package包/类
private void init(String[] springCtxList) {
	appCtx = new ClassPathXmlApplicationContext( springCtxList );
       xmlContext = (XMLContext) appCtx.getBean(Util.CASTOR_CONTEXT_BEAN);	
}
 
开发者ID:NCIP,项目名称:cagrid-core,代码行数:5,代码来源:Resolver.java


示例12: getContext

import org.exolab.castor.xml.XMLContext; //导入依赖的package包/类
/**
 * @return the context
 */
public static XMLContext getContext() {
    return context;
}
 
开发者ID:galleon1,项目名称:chocolate-milk,代码行数:7,代码来源:AbstractClient.java


示例13: setContext

import org.exolab.castor.xml.XMLContext; //导入依赖的package包/类
/**
 * @param aContext the context to set
 */
public static void setContext(XMLContext aContext) {
    context = aContext;

}
 
开发者ID:galleon1,项目名称:chocolate-milk,代码行数:8,代码来源:AbstractClient.java



注:本文中的org.exolab.castor.xml.XMLContext类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java Entity类代码示例发布时间:2022-05-22
下一篇:
Java WARArchive类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap