本文整理汇总了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;
}
示例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;
}