- 使用 Spring Initializr 创建 Spring Boot 应用程序
- 在Spring Boot中配置Cassandra
- 在 Spring Boot 上配置 Tomcat 连接池
- 将Camel消息路由到嵌入WildFly的Artemis上
本文整理了Java中org.opendaylight.controller.config.util.xml.XmlElement.getChildElements()
方法的一些代码示例,展示了XmlElement.getChildElements()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。XmlElement.getChildElements()
方法的具体详情如下:
包路径:org.opendaylight.controller.config.util.xml.XmlElement
类名称:XmlElement
方法名:getChildElements
暂无
代码示例来源:origin: org.opendaylight.netconf/netconf-util
private static void addSubtree(XmlElement filter, XmlElement src, XmlElement dst) throws DocumentedException {
for (XmlElement srcChild : src.getChildElements()) {
for (XmlElement filterChild : filter.getChildElements()) {
addSubtree2(filterChild, srcChild, dst);
}
}
}
代码示例来源:origin: org.opendaylight.controller/config-util
public Optional<XmlElement> getOnlyChildElementOptionally(String childName) {
List<XmlElement> nameElements = getChildElements(childName);
if (nameElements.size() != 1) {
return Optional.absent();
}
return Optional.of(nameElements.get(0));
}
代码示例来源:origin: org.opendaylight.controller/config-util
public Optional<XmlElement> getOnlyChildElementOptionally() {
List<XmlElement> children = getChildElements();
if (children.size() != 1) {
return Optional.absent();
}
return Optional.of(children.get(0));
}
代码示例来源:origin: org.opendaylight.controller/config-util
public void checkUnrecognisedElements(List<XmlElement> recognisedElements,
XmlElement... additionalRecognisedElements) throws DocumentedException {
List<XmlElement> childElements = getChildElements();
childElements.removeAll(recognisedElements);
for (XmlElement additionalRecognisedElement : additionalRecognisedElements) {
childElements.remove(additionalRecognisedElement);
}
if (!childElements.isEmpty()){
throw new DocumentedException(String.format("Unrecognised elements %s in %s", childElements, this),
DocumentedException.ErrorType.application,
DocumentedException.ErrorTag.invalid_value,
DocumentedException.ErrorSeverity.error);
}
}
代码示例来源:origin: org.opendaylight.controller/config-util
public XmlElement getOnlyChildElement() throws DocumentedException {
List<XmlElement> children = getChildElements();
if (children.size() != 1){
throw new DocumentedException(String.format( "One element expected in %s but was %s", toString(),
children.size()),
DocumentedException.ErrorType.application,
DocumentedException.ErrorTag.invalid_value,
DocumentedException.ErrorSeverity.error);
}
return children.get(0);
}
代码示例来源:origin: org.opendaylight.controller/config-util
public XmlElement getOnlyChildElement(String childName) throws DocumentedException {
List<XmlElement> nameElements = getChildElements(childName);
if (nameElements.size() != 1){
throw new DocumentedException("One element " + childName + " expected in " + toString(),
DocumentedException.ErrorType.application,
DocumentedException.ErrorTag.invalid_value,
DocumentedException.ErrorSeverity.error);
}
return nameElements.get(0);
}
代码示例来源:origin: org.opendaylight.netconf/mdsal-netconf-connector
/**
*
* @param operationElement operation element
* @return if Filter is present and not empty returns Optional of the InstanceIdentifier to the read location in datastore.
* empty filter returns Optional.absent() which should equal an empty <data/> container in the response.
* if filter is not present we want to read the entire datastore - return ROOT.
* @throws DocumentedException
*/
protected Optional<YangInstanceIdentifier> getDataRootFromFilter(XmlElement operationElement) throws DocumentedException {
Optional<XmlElement> filterElement = operationElement.getOnlyChildElementOptionally(FILTER);
if (filterElement.isPresent()) {
if (filterElement.get().getChildElements().size() == 0) {
return Optional.absent();
}
return Optional.of(getInstanceIdentifierFromFilter(filterElement.get()));
} else {
return Optional.of(ROOT);
}
}
代码示例来源:origin: org.opendaylight.netconf/mdsal-netconf-connector
@VisibleForTesting
protected YangInstanceIdentifier getInstanceIdentifierFromFilter(XmlElement filterElement) throws DocumentedException {
if (filterElement.getChildElements().size() != 1) {
throw new DocumentedException("Multiple filter roots not supported yet",
ErrorType.application, ErrorTag.operation_not_supported, ErrorSeverity.error);
}
XmlElement element = filterElement.getOnlyChildElement();
return validator.validate(element);
}
代码示例来源:origin: org.opendaylight.netconf/netconf-util
public static boolean isOKMessage(XmlElement xmlElement) throws NetconfDocumentedException {
if(xmlElement.getChildElements().size() != 1) {
return false;
}
try {
return xmlElement.getOnlyChildElement().getName().equals(XmlNetconfConstants.OK);
} catch (DocumentedException e) {
throw new NetconfDocumentedException(e);
}
}
代码示例来源:origin: org.opendaylight.netconf/netconf-util
public static boolean isErrorMessage(XmlElement xmlElement) throws NetconfDocumentedException {
if(xmlElement.getChildElements().size() != 1) {
return false;
}
try {
return xmlElement.getOnlyChildElement().getName().equals(DocumentedException.RPC_ERROR);
} catch (DocumentedException e) {
throw new NetconfDocumentedException(e);
}
}
代码示例来源: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-util
if (matches != MatchingResult.NO_MATCH && matches != MatchingResult.CONTENT_MISMATCH) {
boolean filterHasChildren = filter.getChildElements().isEmpty() == false;
for (XmlElement srcChild : src.getChildElements()) {
for (XmlElement filterChild : filter.getChildElements()) {
MatchingResult childMatch = addSubtree2(filterChild, srcChild, XmlElement.fromDomElement(copied));
if (childMatch == MatchingResult.CONTENT_MISMATCH) {
if (numberOfTextMatchingChildren == filter.getChildElements().size()) {
代码示例来源:origin: org.opendaylight.netconf/netconf-util
private static Document filteredNotification(XmlElement filter, Document originalNotification) throws DocumentedException {
Document result = XmlUtil.newDocument();
XmlElement dataSrc = XmlElement.fromDomDocument(originalNotification);
Element dataDst = (Element) result.importNode(dataSrc.getDomElement(), false);
for (XmlElement filterChild : filter.getChildElements()) {
addSubtree2(filterChild, dataSrc.getOnlyChildElement(), XmlElement.fromDomElement(dataDst));
}
if(dataDst.getFirstChild() != null) {
result.appendChild(dataDst.getFirstChild());
return result;
} else {
return null;
}
}
代码示例来源:origin: org.opendaylight.netconf/mdsal-netconf-connector
/**
* Recursively checks filter elements against the schema. Returns tree of nodes QNames as they appear in filter.
* @param element element to check
* @param parentNodeSchema parent node schema
* @param tree parent node tree
* @return tree
* @throws ValidationException if filter content is not valid
*/
private FilterTree validateNode(XmlElement element, DataSchemaNode parentNodeSchema, FilterTree tree) throws ValidationException {
final List<XmlElement> childElements = element.getChildElements();
for (XmlElement childElement : childElements) {
try {
final Deque<DataSchemaNode> path = findSchemaNodeByNameAndNamespace(parentNodeSchema, childElement.getName(), new URI(childElement.getNamespace()));
if (path.isEmpty()) {
throw new ValidationException(element, childElement);
}
FilterTree subtree = tree;
for (DataSchemaNode dataSchemaNode : path) {
subtree = subtree.addChild(dataSchemaNode);
}
final DataSchemaNode childSchema = path.getLast();
validateNode(childElement, childSchema, subtree);
} catch (URISyntaxException | MissingNameSpaceException e) {
throw new RuntimeException("Wrong namespace in element + " + childElement.toString());
}
}
return tree;
}
代码示例来源:origin: org.opendaylight.netconf/mdsal-netconf-connector
@Override
protected Element handleWithNoSubsequentOperations(final Document document, final XmlElement operationElement) throws DocumentedException {
final Datastore targetDatastore = extractTargetParameter(operationElement);
if (targetDatastore == Datastore.running) {
throw new DocumentedException("edit-config on running datastore is not supported",
ErrorType.protocol,
ErrorTag.operation_not_supported,
ErrorSeverity.error);
}
final ModifyAction defaultAction = getDefaultOperation(operationElement);
final XmlElement configElement = getElement(operationElement, CONFIG_KEY);
for (XmlElement element : configElement.getChildElements()) {
final String ns = element.getNamespace();
final DataSchemaNode schemaNode = getSchemaNodeFromNamespace(ns, element).get();
final DataTreeChangeTracker changeTracker = new DataTreeChangeTracker(defaultAction);
final DomToNormalizedNodeParserFactory.BuildingStrategyProvider editOperationStrategyProvider = new EditOperationStrategyProvider(changeTracker);
parseIntoNormalizedNode(schemaNode, element, editOperationStrategyProvider);
executeOperations(changeTracker);
}
return XmlUtil.createElement(document, XmlNetconfConstants.OK, Optional.<String>absent());
}
任何人都可以详细说明用途是什么(何时使用)asp.net web应用中的web.config,web.config.debug,web.config.release文件?? 最佳答案 它是用于更改调试
我正在尝试创建一个 nuget 包,它将添加一个 DLL 并在正确的配置文件中配置它。该包可用于控制台/表单应用程序或 Web 应用程序,因此我想更新相应的配置文件,app.config 或 web.
已结束。此问题不符合 Stack Overflow guidelines .它目前不接受答案。 关闭 9 年前。 有关您编写的代码问题的问题必须在问题本身中描述具体问题 - 并包含有效代码 以重现它。
我正在开发一个 MVCPortlet。我的 view.jsp 中有一个链接,它调用 liferay 中 portlet 类中的一个方法。 ">Comlex This is the Refahi
我一直在尝试了解如何使用不同的配置文件,我刚刚发现 this link这非常有帮助。唯一的问题是,似乎只有在“发布”解决方案时才会考虑转换,而如果您现在只是进行通用调试或运行,则不会考虑转换。 通常这
我想处理我的 jsx 代码,所以我像这样编写 webpakc.config.js: { test: /\.js$/, loaders: ['react-hot', 'babel-loa
我正在使用 Web.Config 转换将我的应用程序部署到 Azure。我的服务中还有 2 个站点,一个公共(public)网站和一个私有(private) WCF 站点端点。我正在部署multipl
我正在使用 spring security 4.2.5.RELEASE 和 spring 4.3.16.RELEASE我的 XML 配置工作正常,如下所示
config.json 和 config.js 之间有什么区别?我必须同时使用两者吗?我什么时候需要使用其中之一? (https://docs.strongloop.com/display/publi
我运行了 Doctrine 控制台工具: $ php vendor/doctrine/orm/bin/doctrine orm:schema-tool:create --dump-sql 我得到了这个
我正在尝试将 Doctrine ORM 与 Silex 一起使用,但由于缺乏一致的文档,我发现这是一种完全令人沮丧的体验。 当我在控制台运行 vendor/bin/doctrine 时,我得到以下输出
我需要在 web.config 中的多个 WCF 服务中切换出一个 IP 地址。使用 web.config 转换,除了通过 xpath 指定每个地址之外,还有什么方法可以创建搜索和替换语句。例如。对于
我使用来自Ubuntu 14.04的tmux(tmux 1.8)。 我想通过~/.tmux.conf对其进行一些配置。但是无论我在该文件中设置的内容如何,tmux session 都相同。然后,我
嗨,我正在尝试将我的域别名重定向到一个域。 我目前有这个规则 当别名前面没有 www 时它工作得很好.. 我怎么说重定向所有不等于这个域的 谢
我的 Web 配置中有以下 XML,在 Release模式下,我需要根据其子项的名称属性删除 dependentAssembly 部分:assemblyIdentity。我在这里尝试了答案:xdt t
我正在为 web.config 文件寻找一个轻量级的文本编辑器,它具有颜色语法突出显示(如在 Visual Studio 中)。 有什么建议? 最佳答案 您可以使用 Notepad++ .当您使用 w
ImagePicker This plugin allows selection of multiple images from the camera roll
ImagePicker This plugin allows selection of multiple images from the camera roll
如果我有一个 Web 应用程序(有它自己的 web.config )和一个它使用的 .dll 恰好有它自己的 app.config 发生冲突时哪个设置文件会胜出? 最佳答案 不,您不会有任何冲突,因为
问题描述: 我正在尝试在 bash 脚本中使用终止符,但我不断收到一条错误消息,指出没有这样的文件或目录:~/.config/terminator/config .并防止终端在屏幕上弹出。但是,当我在
我是一名优秀的程序员,十分优秀!