var Module currentModule;
val Map<String, String> imports = new HashMap();
var SchemaContext ctx;
-
+
StringBuilder augmentChildNodesAsString
-
+
DataSchemaNode lastNodeInTargetPath = null
def generate(SchemaContext context, File targetPath, Set<Module> modulesToGen) throws IOException {
}
return '''
<h2>Augmentations</h2>
-
+
<ul>
«FOR augment : module.augmentations»
<li>
«FOR childNode : augment.childNodes»
«childNode.printSchemaNodeInfo»
«ENDFOR»
-
+
<h3>Example</h3>
«createAugmentChildNodesAsString(new ArrayList(augment.childNodes))»
«printNodeChildren(parseTargetPath(augment.targetPath))»
</ul>
'''
}
-
+
private def createAugmentChildNodesAsString(List<DataSchemaNode> childNodes) {
augmentChildNodesAsString = new StringBuilder();
augmentChildNodesAsString.append(printNodeChildren(childNodes))
return ''
}
-
+
private def parseTargetPath(SchemaPath path) {
val List<DataSchemaNode> nodes = new ArrayList<DataSchemaNode>();
for (QName pathElement : path.pathFromRoot) {
if(! nodes.empty) {
lastNodeInTargetPath = nodes.get(nodes.size() - 1)
}
-
+
val List<DataSchemaNode> targetPathNodes = new ArrayList<DataSchemaNode>();
targetPathNodes.add(lastNodeInTargetPath)
-
+
return targetPathNodes
}
-
+
private def DataSchemaNode findNodeInChildNodes(QName findingNode, Iterable<DataSchemaNode> childNodes) {
for(child : childNodes) {
if (child.QName.equals(findingNode))
}
}
}
-
+
private def printNodeChildren(List<DataSchemaNode> childNodes) {
if (childNodes.empty) {
return ''
}
-
- return
+
+ return
'''
<pre>
«printAugmentedNode(childNodes.get(0))»
</pre>
'''
}
-
+
private def CharSequence printAugmentedNode(DataSchemaNode child) {
-
+
if(child instanceof ChoiceCaseNode)
return ''
-
+
return
'''
«IF child instanceof ContainerSchemaNode»
«ENDIF»
'''
}
-
+
private def printChoiceNode(ChoiceSchemaNode child) {
val List<ChoiceCaseNode> cases = new ArrayList(child.cases);
if(!cases.empty) {
printAugmentedNode(caseChildNode)
}
}
-
+
private def printListNode(ListSchemaNode listNode) {
return
'''
</«listNode.QName.localName»>
'''
}
-
+
private def printContainerNode(ContainerSchemaNode containerNode) {
return
'''
</«containerNode.QName.localName»>
'''
}
-
+
private def printLeafListNode(LeafListSchemaNode leafListNode) {
return
'''
<«leafListNode.QName.localName»>. . .</«leafListNode.QName.localName»>
'''
}
-
+
private def printAnyXmlNode(AnyXmlSchemaNode anyXmlNode) {
- return
+ return
'''
<«anyXmlNode.QName.localName»>. . .</«anyXmlNode.QName.localName»>
'''
}
-
+
private def printLeafNode(LeafSchemaNode leafNode) {
- return
+ return
'''
<«leafNode.QName.localName»>. . .</«leafNode.QName.localName»>
'''