Browsing an XML

Hey,

I generate an XML in a servlet and then load it into a variable.
Now i want to browse true the XML and get the value of certain nodes and set them in a inputfield. But i can't figure out how to browse trough it, i know with Backbase 3.x you can easily do a String2XML, but is their such a future in Backbase 4.x ??

Thanx in advanced

This sort of thing works for

This sort of thing works for me...

<e:variable name="data"><c:load url="{$url}" method="get" /></e:variable>
<c:setAttribute" with="id('foo')" select="string($data/bar/baz/biz/text())" />  

Note that no string2xml is needed. The content of the $data variable is an XML document, not a string. Perhaps BB4.x is checking the content-type header and automatically doing a string2xml?

You

Yes, you are almost right, the <c:load> tag supports the 'type' attribute which defines the content-type it returns, by default this is 'application/xml' bu this can also be 'text/plain'

Empty String

Hey,

now i get an empty string element displayed.

        <e:variable name="varData">
                <e:data type="text/xml">
                        <xi:include href="../XMLDataServlet" />
                </e:data>
        </e:variable>

after this i have a button with a handler

<b:button>
        <e:handler event="click">
              <c:setAttribute with="id('testingit')/input" name="value" select="string($varData/data/record/ROEPBB/text())" />
        </e:handler>
   Click me
</b:button>

It displays an empty String while their should be data in the tag I selected.

Empty String

Hi Stimp,

The string function in xPath will return empty string if the node-set is empty.
You can try this code below, and it will not return empty string again.

<e:variable name="valType" with="$varData" select="string(data/record/ROEPBB/text())"/>
<e:set property="value" with="id('testingit')/input" select="$sValue" />

Hope that helps,

Andys