gpt4 book ai didi

org.opendaylight.controller.config.util.xml.XmlElement.getAttributes()方法的使用及代码示例

转载 作者:知者 更新时间:2024-03-21 02:09:05 24 4
gpt4 key购买 nike

本文整理了Java中org.opendaylight.controller.config.util.xml.XmlElement.getAttributes()方法的一些代码示例,展示了XmlElement.getAttributes()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。XmlElement.getAttributes()方法的具体详情如下:
包路径:org.opendaylight.controller.config.util.xml.XmlElement
类名称:XmlElement
方法名:getAttributes

XmlElement.getAttributes介绍

暂无

代码示例

代码示例来源:origin: org.opendaylight.netconf/netconf-util

@Override
public Document handle(final Document requestMessage,
    final NetconfOperationChainedExecution subsequentOperation) throws DocumentedException {
  XmlElement requestElement = getRequestElementWithCheck(requestMessage);
  Document document = XmlUtil.newDocument();
  XmlElement operationElement = requestElement.getOnlyChildElement();
  Map<String, Attr> attributes = requestElement.getAttributes();
  Element response = handle(document, operationElement, subsequentOperation);
  Element rpcReply = XmlUtil.createElement(document, XmlMappingConstants.RPC_REPLY_KEY, Optional.of(XmlNetconfConstants.URN_IETF_PARAMS_XML_NS_NETCONF_BASE_1_0));
  if(XmlElement.fromDomElement(response).hasNamespace()) {
    rpcReply.appendChild(response);
  } else {
    Element responseNS = XmlUtil.createElement(document, response.getNodeName(), Optional.of(XmlNetconfConstants.URN_IETF_PARAMS_XML_NS_NETCONF_BASE_1_0));
    NodeList list = response.getChildNodes();
    while(list.getLength()!=0) {
      responseNS.appendChild(list.item(0));
    }
    rpcReply.appendChild(responseNS);
  }
  for (Attr attribute : attributes.values()) {
    rpcReply.setAttributeNode((Attr) document.importNode(attribute, true));
  }
  document.appendChild(rpcReply);
  return document;
}

代码示例来源:origin: org.opendaylight.netconf/mdsal-netconf-connector

@Override
public Document handle(final Document requestMessage,
            final NetconfOperationChainedExecution subsequentOperation) throws DocumentedException {
  final XmlElement requestElement = getRequestElementWithCheck(requestMessage);
  final Document document = XmlUtil.newDocument();
  final XmlElement operationElement = requestElement.getOnlyChildElement();
  final Map<String, Attr> attributes = requestElement.getAttributes();
  final Element response = handle(document, operationElement, subsequentOperation);
  final Element rpcReply = XmlUtil.createElement(document, XmlMappingConstants.RPC_REPLY_KEY, Optional.of(XmlNetconfConstants.URN_IETF_PARAMS_XML_NS_NETCONF_BASE_1_0));
  if(XmlElement.fromDomElement(response).hasNamespace()) {
    rpcReply.appendChild(response);
  } else {
    final NodeList list = response.getChildNodes();
    if (list.getLength() == 0) {
      rpcReply.appendChild(response);
    } else {
      while (list.getLength() != 0) {
        rpcReply.appendChild(list.item(0));
      }
    }
  }
  for (Attr attribute : attributes.values()) {
    rpcReply.setAttributeNode((Attr) document.importNode(attribute, true));
  }
  document.appendChild(rpcReply);
  return document;
}

代码示例来源:origin: org.opendaylight.netconf/netconf-util

for (Attr attr : filter.getAttributes().values()) {

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com