- normalizeNode(child,
- findFirstSchemaByLocalName(child.localName, (schema as DataNodeContainer).childNodes),
- currentAugment, mountPoint)
+ val potentialSchemaNodes = (schema as DataNodeContainer).findInstanceDataChildrenByName(child.localName)
+ if (potentialSchemaNodes.size > 1 && child.namespace === null) {
+ val StringBuilder namespacesOfPotentialModules = new StringBuilder;
+ for (potentialSchemaNode : potentialSchemaNodes) {
+ namespacesOfPotentialModules.append(" ").append(potentialSchemaNode.QName.namespace.toString).append("\n")
+ }
+ throw new ResponseException(BAD_REQUEST,
+ "Node \"" + child.localName + "\" 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" + namespacesOfPotentialModules)
+ }
+ var rightNodeSchemaFound = false
+ for (potentialSchemaNode : potentialSchemaNodes) {
+ if (!rightNodeSchemaFound) {
+ val potentialCurrentAugment = normalizeNodeName(child, potentialSchemaNode, currentAugment,
+ mountPoint)
+ if (child.qname !== null) {
+ normalizeNode(child, potentialSchemaNode, potentialCurrentAugment, mountPoint)
+ rightNodeSchemaFound = true
+ }
+ }
+ }
+ if (!rightNodeSchemaFound) {
+ throw new ResponseException(BAD_REQUEST,
+ "Schema node \"" + child.localName + "\" was not found in module.")
+ }