// GeneratedType for this type definition should be already
// created
QName qname = typeDef.getQName();
- Module unionModule = null;
- String prefix = qname.getPrefix();
- if (prefix == null || prefix.isEmpty() || prefix.equals(module.getPrefix())) {
- unionModule = module;
- } else {
- unionModule = findModuleFromImports(module.getImports(), qname.getPrefix());
- }
+ Module unionModule = schemaContext.findModuleByNamespaceAndRevision(qname.getNamespace(),
+ qname.getRevision());
final ModuleContext mc = genCtx.get(unionModule);
returnType = mc.getTypedefs().get(typeDef.getPath());
} else {
'''
identity «identity.QName.localName» {
«IF identity.baseIdentity != null»
- base "«writeIdentityPrefix(identity.baseIdentity)»«identity.baseIdentity»";
+ base "(«writeIdentityNs(identity.baseIdentity)»)«identity.baseIdentity»";
«ENDIF»
«IF !identity.description.nullOrEmpty»
description
'''
}
- def static writeIdentityPrefix(IdentitySchemaNode identity) {
+ def static writeIdentityNs(IdentitySchemaNode identity) {
if(module == null)
return ''
- if(identity.QName.prefix.nullOrEmpty || module.prefix.nullOrEmpty)
- return ''
-
- val identityPrefix = identity.QName.prefix
+ val identityNs = identity.QName.namespace
- if(!module.prefix.equals(identity.QName.prefix))
- return identityPrefix + ":"
+ if(!module.namespace.equals(identityNs))
+ return identityNs + ":"
return ''
}
val StringBuilder sb = new StringBuilder();
for(pathElement : schemaPath) {
- val prefix = pathElement.prefix
+ val ns = pathElement.namespace
val localName = pathElement.localName
sb.append("\\")
- sb.append(prefix)
- sb.append(":")
+ sb.append('(')
+ sb.append(ns)
+ sb.append(')')
sb.append(localName)
}
return sb.toString