当前位置: 首页>>代码示例>>Java>>正文


Java IMarshallingContext.setIndent方法代码示例

本文整理汇总了Java中org.jibx.runtime.IMarshallingContext.setIndent方法的典型用法代码示例。如果您正苦于以下问题:Java IMarshallingContext.setIndent方法的具体用法?Java IMarshallingContext.setIndent怎么用?Java IMarshallingContext.setIndent使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.jibx.runtime.IMarshallingContext的用法示例。


在下文中一共展示了IMarshallingContext.setIndent方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: toXML

import org.jibx.runtime.IMarshallingContext; //导入方法依赖的package包/类
public void toXML(ModelDefinition.XMLBindingType bindingType, OutputStream xml)
{
    try
    {
    	if(bindingType == null)
    	{
    		bindingType = ModelDefinition.XMLBindingType.DEFAULT;
    	}

    	String bindingName = bindingType.toString();
        IBindingFactory factory = (bindingName != null) ? BindingDirectory.getFactory(bindingName, M2Model.class) :
        	BindingDirectory.getFactory("default", M2Model.class);
        IMarshallingContext context = factory.createMarshallingContext();
        context.setIndent(4);
        context.marshalDocument(this, "UTF-8", null, xml);
    }
    catch(JiBXException e)
    {
        throw new DictionaryException(ERR_CREATE_M2MODEL_FAILURE, e);
    }
}
 
开发者ID:Alfresco,项目名称:alfresco-data-model,代码行数:22,代码来源:M2Model.java

示例2: toXML

import org.jibx.runtime.IMarshallingContext; //导入方法依赖的package包/类
/**
 * Create XML representation of System Info
 * 
 * @param xml  xml representation of system info
 */
public void toXML(OutputStream xml)
{
    try
    {
        IBindingFactory factory = BindingDirectory.getFactory(SystemInfo.class);
        IMarshallingContext context = factory.createMarshallingContext();
        context.setIndent(4);
        context.marshalDocument(this, "UTF-8", null, xml);    
    }
    catch(JiBXException e)
    {
        throw new DictionaryException("Failed to create System Info", e);
    }
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:20,代码来源:SystemInfo.java

示例3: encode2Xml

import org.jibx.runtime.IMarshallingContext; //导入方法依赖的package包/类
private String encode2Xml(Order order) throws JiBXException, IOException {
factory = BindingDirectory.getFactory(Order.class);
writer = new StringWriter();
IMarshallingContext mctx = factory.createMarshallingContext();
mctx.setIndent(2);
mctx.marshalDocument(order, CHARSET_NAME, null, writer);
String xmlStr = writer.toString();
writer.close();
System.out.println(xmlStr.toString());
return xmlStr;
   }
 
开发者ID:changyuefeng,项目名称:netty-book,代码行数:12,代码来源:TestOrder.java

示例4: encode0

import org.jibx.runtime.IMarshallingContext; //导入方法依赖的package包/类
protected ByteBuf encode0(ChannelHandlerContext ctx, Object body)
    throws Exception {
factory = BindingDirectory.getFactory(body.getClass());
writer = new StringWriter();
IMarshallingContext mctx = factory.createMarshallingContext();
mctx.setIndent(2);
mctx.marshalDocument(body, CHARSET_NAME, null, writer);
String xmlStr = writer.toString();
writer.close();
writer = null;
ByteBuf encodeBuf = Unpooled.copiedBuffer(xmlStr, UTF_8);
return encodeBuf;
   }
 
开发者ID:changyuefeng,项目名称:netty-book,代码行数:14,代码来源:AbstractHttpXmlEncoder.java

示例5: encode0

import org.jibx.runtime.IMarshallingContext; //导入方法依赖的package包/类
protected ByteBuf encode0(ChannelHandlerContext ctx, Object body)
        throws Exception {
    factory = BindingDirectory.getFactory(body.getClass());
    writer = new StringWriter();
    IMarshallingContext mctx = factory.createMarshallingContext();
    mctx.setIndent(2);
    mctx.marshalDocument(body, CHARSET_NAME, null, writer);
    String xmlStr = writer.toString();
    writer.close();
    writer = null;
    ByteBuf encodeBuf = Unpooled.copiedBuffer(xmlStr, UTF_8);
    return encodeBuf;
}
 
开发者ID:Hope6537,项目名称:hope-tactical-equipment,代码行数:14,代码来源:AbstractHttpXmlEncoder.java

示例6: write

import org.jibx.runtime.IMarshallingContext; //导入方法依赖的package包/类
public void write () throws JiBXException, IOException
{
    IBindingFactory bfact = BindingDirectory.getFactory(Astrogation.class);
    IMarshallingContext mctx = bfact.createMarshallingContext();
    mctx.setIndent(4);
    if (useCompressedFile)
    {
        mctx.marshalDocument(data, "UTF-8", null, new GZIPOutputStream(new FileOutputStream(outputFile)));
    }
    else
    {
        mctx.marshalDocument(data, "UTF-8", null, new FileOutputStream(outputFile));
    }
}
 
开发者ID:makhidkarun,项目名称:cartography,代码行数:15,代码来源:AccessXMLFile.java

示例7: createMarshallingContext

import org.jibx.runtime.IMarshallingContext; //导入方法依赖的package包/类
/**
 * Create a new {@code IMarshallingContext}, configured with the correct indentation.
 * @return the created marshalling context
 * @throws JiBXException in case of errors
 */
protected IMarshallingContext createMarshallingContext() throws JiBXException {
	IMarshallingContext marshallingContext = this.bindingFactory.createMarshallingContext();
	marshallingContext.setIndent(this.indent);
	return marshallingContext;
}
 
开发者ID:langtianya,项目名称:spring4-understanding,代码行数:11,代码来源:JibxMarshaller.java


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