scala - Adding an XML attribute conditionally -


i need way add xml attribute 'positon' xml element 'node' conditionally. i'm doing condition check first , creating node.

if (lvl == 2)       node = <node color={ color } created={ epochtimemillis } id={ idgen } position={ position } link={ link } modified={ epochtimemillis } style="bubble" text={ f.getname() }>                <edge color={ color } style={ style } width={ width }/>              </node> else       node = <node color={ color } created={ epochtimemillis } id={ idgen } link={ link } modified={ epochtimemillis } style="bubble" text={ f.getname() }>                <edge color={ color } style={ style } width={ width }/>              </node>   } 

using "null" not practice, in case you:

scala> <root ta={ if (true) "true" else null } fa={ if (false) "false" else null } /> res0: scala.xml.elem = <root ta="true" ></root> 

Comments

Popular posts from this blog

python - How to create a legend for 3D bar in matplotlib? -

java - Multi-Label Document Classification -

php - Dynamic url re-writing using htaccess -