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

x33g5p2x  于2022-02-03 转载在 其他  
字(4.6k)|赞(0)|评价(0)|浏览(101)

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

XmlElement.checkNamespace介绍

暂无

代码示例

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

private static void fromXml(XmlElement xml) throws DocumentedException {
  xml.checkName(DISCARD);
  xml.checkNamespace(XmlNetconfConstants.URN_IETF_PARAMS_XML_NS_NETCONF_BASE_1_0);
}

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

private static void checkXml(XmlElement xml) throws DocumentedException {
  xml.checkName(XmlNetconfConstants.GET);
  xml.checkNamespace(XmlNetconfConstants.URN_IETF_PARAMS_XML_NS_NETCONF_BASE_1_0);
  // Filter option: ignore for now, TODO only load modules specified by the filter
}

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

public static XmlElement fromDomElementWithExpected(Element element, String expectedName, String expectedNamespace) throws DocumentedException {
  XmlElement xmlElement = XmlElement.fromDomElementWithExpected(element, expectedName);
  xmlElement.checkNamespace(expectedNamespace);
  return xmlElement;
}

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

private static void validateInputRpc(final XmlElement xml, String operationName) throws DocumentedException{
  xml.checkName(operationName);
  xml.checkNamespace(XmlNetconfConstants.URN_IETF_PARAMS_XML_NS_NETCONF_BASE_1_0);
}

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

private static void checkXml(XmlElement xml) throws DocumentedException {
  xml.checkName(XmlNetconfConstants.COMMIT);
  xml.checkNamespace(XmlNetconfConstants.URN_IETF_PARAMS_XML_NS_NETCONF_BASE_1_0);
}

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

public XmlElement getOnlyChildElementWithSameNamespace() throws DocumentedException {
  XmlElement childElement = getOnlyChildElement();
  childElement.checkNamespace(getNamespace());
  return childElement;
}

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

private void checkXml(XmlElement xml) throws DocumentedException {
  xml.checkName(VALIDATE);
  xml.checkNamespace(XmlNetconfConstants.URN_IETF_PARAMS_XML_NS_NETCONF_BASE_1_0);
  XmlElement sourceElement = xml.getOnlyChildElement(XmlNetconfConstants.SOURCE_KEY,
      XmlNetconfConstants.URN_IETF_PARAMS_XML_NS_NETCONF_BASE_1_0);
  XmlElement sourceChildNode = sourceElement.getOnlyChildElement();
  sourceChildNode.checkNamespace(XmlNetconfConstants.URN_IETF_PARAMS_XML_NS_NETCONF_BASE_1_0);
  String datastoreValue = sourceChildNode.getName();
  Datastore sourceDatastore = Datastore.valueOf(datastoreValue);
  if (sourceDatastore != Datastore.candidate){
    throw new DocumentedException( "Only " + Datastore.candidate
        + " is supported as source for " + VALIDATE + " but was " + datastoreValue, ErrorType.application, ErrorTag.data_missing, ErrorSeverity.error);
  }
}

代码示例来源: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

public static Datastore fromXml(XmlElement xml) throws DocumentedException {
  xml.checkName(GET_CONFIG);
  xml.checkNamespace(XmlNetconfConstants.URN_IETF_PARAMS_XML_NS_NETCONF_BASE_1_0);
  XmlElement sourceElement = xml.getOnlyChildElement(XmlNetconfConstants.SOURCE_KEY,
      XmlNetconfConstants.URN_IETF_PARAMS_XML_NS_NETCONF_BASE_1_0);
  XmlElement sourceNode = sourceElement.getOnlyChildElement();
  String sourceParsed = sourceNode.getName();
  LOG.debug("Setting source datastore to '{}'", sourceParsed);
  Datastore sourceDatastore = Datastore.valueOf(sourceParsed);
  // Filter option: ignore for now, TODO only load modules specified by the filter
  return sourceDatastore;
}

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

xml.checkNamespace(XmlNetconfConstants.URN_IETF_PARAMS_XML_NS_NETCONF_BASE_1_0);

相关文章