java xsi type_Java DOMUtil.setXsiType方法代碼示例

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;

}

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值