Android Question [SOLVED] XMLBuilder problem

Lello1964

Well-Known Member
Licensed User
Longtime User
I have this code :

B4X:
    Dim x As XMLBuilder
    x = x.create("p:Test1")
    x = x.element("p:Test2") _
            .attribute("xmlns:ds", "xxxx#") _
            .attribute("xmlns:p", "yyyy") _
            .attribute("xmlns:xsi", "zzzzzz") _
            .element("rrrrrr") _
            .up() _
        .up() _
        .element("JetS3t")
  
    Dim props As Map
    props.Initialize
    'props.Put("omit-xml-declaration", "yes")
    props.Put("{http://xml.apache.org/xslt}indent-amount", "4")
    props.Put("indent", "yes")
    Log(x.asString2(props))

this is xml:

<?xml version="1.0" encoding="UTF-8"?><p:Test1>
<p:Test2 xmlns:ds="xxxx#" xmlns:p="yyyy" xmlns:xsi="zzzzzz">
<rrrrrr/>
</p:Test2>
<JetS3t/>
</p:Test1>

i want this :


<?xml version="1.0" encoding="UTF-8"?>
<p:Test1 xmlns:ds="xxxx" xmlns:p="yyyy" xmlns:xsi="zzzzzz>
<p:Test2 xmlns:ds="xxxx" xmlns:p="yyyy" xmlns:xsi="zzzzzz">
<rrrrrr/>
</p:Test2>
<JetS3t/>
</p:Test1>

how set : <p:Test1 xmlns:ds="xxxx" xmlns:p="yyyy" xmlns:xsi="zzzzzz>
 

Daestrum

Expert
Licensed User
Longtime User
Maybe
B4X:
    x = x.create("p:Test1")
    x = x.element("p:Test2") _
            .attribute("xmlns:ds", "xxxx#") _
            .attribute("xmlns:p", "yyyy") _
            .attribute("xmlns:xsi", "zzzzzz") _
            .element("rrrrrr")
...
as
B4X:
    x = x.create("p:Test1") _
            .attribute("xmlns:ds", "xxxx#") _
            .attribute("xmlns:p", "yyyy") _
            .attribute("xmlns:xsi", "zzzzzz") _
            .element("rrrrrr")
...
 
Upvote 0
Top