+ /**
+ * Find builder of schema node under parent builder (including under
+ * AugmentationSchemaBuilder).
+ *
+ * @param path
+ * - path of target schema node builder
+ * @param parent
+ * - base data node container builder under which the target
+ * schema node builder should be found
+ * @return builder of schema node
+ */
+ public static SchemaNodeBuilder findTargetNode(final Iterable<QName> path,
+ final DataNodeContainerBuilder parent) {
+
+ Preconditions.checkNotNull(parent);
+ Preconditions.checkNotNull(path);
+
+ SchemaNodeBuilder foundNode = null;
+
+ final Iterator<QName> pathIterator = path.iterator();
+ if (pathIterator.hasNext()) {
+ String name = pathIterator.next().getLocalName();
+ foundNode = parent.getDataChildByName(name);
+ if (foundNode == null) {
+ foundNode = findUnknownNode(name, parent);
+ }
+ }
+
+ if (pathIterator.hasNext() && foundNode != null) {
+ return findSchemaNode(Iterables.skip(path, 1), foundNode);
+ } else {
+ return foundNode;
+ }
+ }
+