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


Java Unmarshaller.setIgnoreExtraElements方法代码示例

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


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

示例1: setMapping

import org.exolab.castor.xml.Unmarshaller; //导入方法依赖的package包/类
/**
 * Initializes the Castor mapping instance.
 * @param mapping a Castor mapping. Shall not be <code>null</code>.
 * @throws NullPointerException if <code>mapping</code> is <code>null</code>.
 * @throws MappingException an exception indicating an invalid mapping error.
 */
private void setMapping(final Mapping mapping) throws MappingException
{
    _unmarshaller = new Unmarshaller(mapping); // May throw MappingException.
    _unmarshaller.setValidation(false);
    _unmarshaller.setIgnoreExtraElements(true);

    _marshaller = new Marshaller();
    _marshaller.setMapping(mapping); // May throw MappingException.
    _marshaller.setValidation(false);
    //_marshaller.setDebug(true);
    // Specifies whether to support XML namespaces by default. Default is false.
    //_marshaller.setProperty("org.exolab.castor.parser.namespaces", "true");
    // Specifies whether XML documents (as generated at marshalling) should use indentation or not. Default is false.
    //_marshaller.setProperty("org.exolab.castor.indent", "true");
}
 
开发者ID:LizzyProject,项目名称:Lizzy,代码行数:22,代码来源:XmlSerializer.java

示例2: customizeUnmarshaller

import org.exolab.castor.xml.Unmarshaller; //导入方法依赖的package包/类
/**
 * Template method that allows for customizing of the given Castor {@link Unmarshaller}.
 */
protected void customizeUnmarshaller(Unmarshaller unmarshaller) {
	unmarshaller.setValidation(this.validating);
	unmarshaller.setWhitespacePreserve(this.whitespacePreserve);
	unmarshaller.setIgnoreExtraAttributes(this.ignoreExtraAttributes);
	unmarshaller.setIgnoreExtraElements(this.ignoreExtraElements);
	unmarshaller.setObject(this.rootObject);
	unmarshaller.setReuseObjects(this.reuseObjects);
	unmarshaller.setClearCollections(this.clearCollections);
	if (this.namespaceToPackageMapping != null) {
		for (Map.Entry<String, String> mapping : this.namespaceToPackageMapping.entrySet()) {
			unmarshaller.addNamespaceToPackageMapping(mapping.getKey(), mapping.getValue());
		}
	}
	if (this.entityResolver != null) {
		unmarshaller.setEntityResolver(this.entityResolver);
	}
	if (this.classDescriptorResolver != null) {
		unmarshaller.setResolver(this.classDescriptorResolver);
	}
	if (this.idResolver != null) {
		unmarshaller.setIDResolver(this.idResolver);
	}
	if (this.objectFactory != null) {
		unmarshaller.setObjectFactory(this.objectFactory);
	}
	if (this.beanClassLoader != null) {
		unmarshaller.setClassLoader(this.beanClassLoader);
	}
}
 
开发者ID:langtianya,项目名称:spring4-understanding,代码行数:33,代码来源:CastorMarshaller.java

示例3: createUnmarshaller

import org.exolab.castor.xml.Unmarshaller; //导入方法依赖的package包/类
/**
 * Create an Unmarshaller for a specific class and configure it with our
 * default configuration details.  In particular, the Unmarshaller is set
 * to not ignore extra attributes and elements.
 * 
 * @param clazz the class to unmarshal
 * @param preserveWhitespace whether to preserve whitespace when parsing
 * @return
 */
private static <T> Unmarshaller createUnmarshaller(Class<T> clazz, boolean preserveWhitespace) {
    Unmarshaller u = new Unmarshaller(clazz);
    u.setIgnoreExtraAttributes(false);
    u.setIgnoreExtraElements(false);
    u.setWhitespacePreserve(preserveWhitespace);
    return u;
}
 
开发者ID:qoswork,项目名称:opennmszh,代码行数:17,代码来源:CastorUtils.java


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