gpt4 book ai didi

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

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

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

XmlElement.getOnlyChildElementWithSameNamespaceOptionally介绍

暂无

代码示例

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

public static Collection<String> extractCapabilitiesFromHello(Document doc) throws NetconfDocumentedException {
    XmlElement responseElement = XmlElement.fromDomDocument(doc);
    // Extract child element <capabilities> from <hello> with or without(fallback) the same namespace
    Optional<XmlElement> capabilitiesElement = responseElement
        .getOnlyChildElementWithSameNamespaceOptionally(XmlNetconfConstants.CAPABILITIES)
        .or(responseElement
            .getOnlyChildElementOptionally(XmlNetconfConstants.CAPABILITIES));

    List<XmlElement> caps = capabilitiesElement.get().getChildElements(XmlNetconfConstants.CAPABILITY);
    return Collections2.transform(caps, new Function<XmlElement, String>() {

      @Override
      public String apply(@Nonnull XmlElement input) {
        // Trim possible leading/tailing whitespace
        try {
          return input.getTextContent().trim();
        } catch (DocumentedException e) {
          LOG.trace("Error fetching input text content",e);
          return null;
        }
      }
    });

  }
}

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

GetSchemaEntry(final XmlElement getSchemaElement) throws DocumentedException {
    getSchemaElement.checkName(GET_SCHEMA);
    getSchemaElement.checkNamespace(XmlNetconfConstants.URN_IETF_PARAMS_XML_NS_YANG_IETF_NETCONF_MONITORING);
    XmlElement identifierElement = null;
    try {
      identifierElement = getSchemaElement.getOnlyChildElementWithSameNamespace(IDENTIFIER);
    } catch (final DocumentedException e) {
      LOG.trace("Can't get identifier element as only child element with same namespace due to ",e);
      throw DocumentedException.wrap(e);
    }
    identifier = identifierElement.getTextContent();
    final Optional<XmlElement> versionElement = getSchemaElement
        .getOnlyChildElementWithSameNamespaceOptionally(VERSION);
    if (versionElement.isPresent()) {
      version = Optional.of(versionElement.get().getTextContent());
    } else {
      version = Optional.absent();
    }
  }
}

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

.getOnlyChildElementWithSameNamespaceOptionally(EditConfigXmlParser.TEST_OPTION_KEY);
if (testOptionElementOpt.isPresent()) {
  String testOptionValue = testOptionElementOpt.get().getTextContent();
    .getOnlyChildElementWithSameNamespaceOptionally(EditConfigXmlParser.ERROR_OPTION_KEY);
if (errorOptionElement.isPresent()) {
  String errorOptionParsed = errorOptionElement.get().getTextContent();
    .getOnlyChildElementWithSameNamespaceOptionally(EditConfigXmlParser.DEFAULT_OPERATION_KEY);
if (defaultContent.isPresent()) {
  String mergeStrategyString = defaultContent.get().getTextContent();

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