B4J Question XmlBuilder Question

imbault

Well-Known Member
Licensed User
Longtime User
Hi,

How to add that kind of element with XmlBuilder:

B4X:
  <UseBy xsi:nil="true" />

Thanks a lot

Patrick
 

imbault

Well-Known Member
Licensed User
Longtime User
Sorry useby was an element example :
so I'd like :
B4X:
<UseBy xsi:nil="true" />

and I tried :

B4X:
x = x.element("UsedBy").attribute("xsi:nil","true").up()
 
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
While it is probably possible to achieve it using the namespace method, my attempts failed.

Workaround:
B4X:
    Dim x As XMLBuilder
   x = x.create("Projects")
  
   x = x.element("UsedBy").attribute("xsinil","true").up()
   Dim props As Map
   props.Initialize
   props.Put("{http://xml.apache.org/xslt}indent-amount", "4")
   props.Put("indent", "yes")
   Dim s As String = x.asString2(props)
   s = s.Replace("xsinil", "xsi:nil") '<---------workaround
   Log(s)
 
Last edited:
Upvote 0
Top