gpt4 book ai didi

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

转载 作者:知者 更新时间:2024-03-27 13:13:05 25 4
gpt4 key购买 nike

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

XmlElement.getAttributes介绍

暂无

代码示例

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

private boolean containsDelete(final XmlElement element) {
    for (final Attr o : element.getAttributes().values()) {
      if (o.getLocalName().equals(OPERATION)
          && (o.getValue().equals(DELETE_EDIT_CONFIG) || o.getValue()
              .equals(REMOVE_EDIT_CONFIG))) {
        return true;
      }

    }

    for (final XmlElement xmlElement : element.getChildElements()) {
      if (containsDelete(xmlElement)) {
        return true;
      }

    }

    return false;
  }
}

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

@Override
public Document handle(final Document requestMessage,
    final NetconfOperationChainedExecution subsequentOperation) throws NetconfDocumentedException {
  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, XmlNetconfConstants.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.controller/mdsal-netconf-connector

@Override
public Document handle(final Document requestMessage,
            final NetconfOperationChainedExecution subsequentOperation) throws NetconfDocumentedException {
  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, XmlNetconfConstants.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.controller/netconf-impl

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

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