mirror of
https://dev.iopsys.eu/bbf/bbfdm.git
synced 2026-01-28 01:47:18 +01:00
Add default value from xml to json datamodel
This commit is contained in:
parent
9bdcb1ac18
commit
fdc76219da
1 changed files with 16 additions and 0 deletions
|
|
@ -95,6 +95,18 @@ def getparamtype(dmparam):
|
|||
return ptype
|
||||
|
||||
|
||||
def getParamDefault(dmparam):
|
||||
default = None
|
||||
for s in dmparam:
|
||||
if s.tag == "syntax":
|
||||
for c in s:
|
||||
if c.tag == "default":
|
||||
default = c.get("value")
|
||||
break
|
||||
break
|
||||
return default
|
||||
|
||||
|
||||
def getMinMaxEnumerationUnitPatternparam(paramtype, c):
|
||||
paramvalrange = None
|
||||
paramenum = None
|
||||
|
|
@ -531,6 +543,10 @@ def printPARAM(dmparam, dmobject, bbfdm_type):
|
|||
print("\"version\" : \"%s\"," % dmparam.get('version'), file=fp)
|
||||
print("\"protocols\" : [%s]," % bbfdm_type, file=fp)
|
||||
|
||||
default = getParamDefault(dmparam)
|
||||
if default is not None and len(default) != 0 and default != "\"":
|
||||
print("\"default\" : \"%s\"," % default, file=fp)
|
||||
|
||||
# create list
|
||||
if islist == 1:
|
||||
print("\"list\" : {", file=fp)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue