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


Java DOMUtil.setXsiType方法代码示例

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


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

示例1: toXsdElement

import com.evolveum.midpoint.util.DOMUtil; //导入方法依赖的package包/类
public static Object toXsdElement(Object val, QName typeName, QName elementName, Document doc, boolean recordType) throws SchemaException {
    // Just ignore the typeName for now. The java type will determine the conversion
    Object createdObject = toXsdElement(val, elementName, doc, false);
    if (createdObject instanceof Element) {
        Element createdElement = (Element) createdObject;
        // But record the correct type is asked to
        if (recordType) {
            if (typeName == null) {
                // if no type was specified, just record the one that was used for automatic conversion
                typeName = XsdTypeMapper.toXsdType(val.getClass());
            }
            DOMUtil.setXsiType(createdElement, typeName);
        }
    }
    return createdObject;
}
 
开发者ID:Pardus-Engerek,项目名称:engerek,代码行数:17,代码来源:XmlTypeConverter.java

示例2: serializeInternal

import com.evolveum.midpoint.util.DOMUtil; //导入方法依赖的package包/类
@NotNull
   private Element serializeInternal(@NotNull RootXNode rootxnode, Element parentElement) throws SchemaException {
	QName rootElementName = rootxnode.getRootElementName();
	Element topElement = createElement(rootElementName, parentElement);
	if (parentElement != null) {
		parentElement.appendChild(topElement);
	}
	QName typeQName = rootxnode.getTypeQName();
	if (typeQName != null && rootxnode.isExplicitTypeDeclaration()) {
           DOMUtil.setXsiType(topElement, setQNamePrefixExplicitIfNeeded(typeQName));
	}
	XNode subnode = rootxnode.getSubnode();
	if (subnode instanceof PrimitiveXNode){
		serializePrimitiveElementOrAttribute((PrimitiveXNode) subnode, topElement, rootElementName, false);
		return DOMUtil.getFirstChildElement(topElement);
	}
	if (subnode instanceof MapXNode) {
		// at this point we can put frequently used namespaces (e.g. c, t, q, ri) into the document to eliminate their use
		// on many places inside the doc (MID-2198)
		DOMUtil.setNamespaceDeclarations(topElement, getNamespacePrefixMapper().getNamespacesDeclaredByDefault());
		serializeMap((MapXNode) subnode, topElement);
	} else if (subnode.isHeterogeneousList()) {
		DOMUtil.setNamespaceDeclarations(topElement, getNamespacePrefixMapper().getNamespacesDeclaredByDefault());
		serializeExplicitList((ListXNode) subnode, topElement);
	} else {
		throw new SchemaException("Sub-root xnode is not a map nor an explicit list, cannot serialize to XML (it is "+subnode+")");
	}
	addDefaultNamespaceDeclaration(topElement);
	return topElement;
}
 
开发者ID:Pardus-Engerek,项目名称:engerek,代码行数:31,代码来源:DomLexicalWriter.java


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