- if ((nodeBuilder instanceof CompositeNodeWrapper)) {
- final List<NodeWrapper<?>> children = ((CompositeNodeWrapper) nodeBuilder).getValues();
- for (final NodeWrapper<? extends Object> child : children) {
- final List<DataSchemaNode> potentialSchemaNodes =
- this.controllerContext.findInstanceDataChildrenByName(
- ((DataNodeContainer) schema), child.getLocalName());
-
- if (potentialSchemaNodes.size() > 1 && child.getNamespace() == null) {
- StringBuilder builder = new StringBuilder();
- for (final DataSchemaNode potentialSchemaNode : potentialSchemaNodes) {
- builder.append(" ").append(potentialSchemaNode.getQName().getNamespace().toString())
- .append("\n");
- }
-
- throw new RestconfDocumentedException(
- "Node \"" + child.getLocalName() +
- "\" is added as augment from more than one module. " +
- "Therefore node must have namespace (XML format) or module name (JSON format)." +
- "\nThe node is added as augment from modules with namespaces:\n" + builder,
- ErrorType.PROTOCOL, ErrorTag.INVALID_VALUE );
- }
-
- boolean rightNodeSchemaFound = false;
- for (final DataSchemaNode potentialSchemaNode : potentialSchemaNodes) {
- if (!rightNodeSchemaFound) {
- final QName potentialCurrentAugment =
- this.normalizeNodeName(child, potentialSchemaNode, currentAugment, mountPoint);
- if (child.getQname() != null ) {
- this.normalizeNode(child, potentialSchemaNode, potentialCurrentAugment, mountPoint);
- rightNodeSchemaFound = true;
- }
- }
- }
-
- if (!rightNodeSchemaFound) {
- throw new RestconfDocumentedException(
- "Schema node \"" + child.getLocalName() + "\" was not found in module.",
- ErrorType.APPLICATION, ErrorTag.UNKNOWN_ELEMENT );
- }
- }