none
Problem using XML DSO data islands and binding

    Question

  • Hi folks,

     

    I am struggling with a problem using XML DSO and binding HTML elements to data that has been frustrating me for days so if anyone can help it would be very much appreciated.

     

    To demonstrate the problem I have simplified it down to a few lines of HTML:

     

    <xml id="xmldso">
    <START>
    <FIRSTNAME>Joe</FIRSTNAME>
    <LASTNAME id="abc">Bloggs</LASTNAME>
    </START>
    </xml>

    <div datasrc="#xmldso" datafld="FIRSTNAME"></div>
    <div datasrc="#xmldso" datafld="LASTNAME"></div>

    In the example above, the contents of the FIRSTNAME field are displayed fine (i.e. Joe) but the contents of the LASTNAME field (i.e. Bloggs) are not displayed because the XML element has an attribute called "id".

     

    If I remove the attribute the field data is displayed. It does not matter what the attribute is called, as soon as an element has an attribute, its data is not displayed.

     

    I have hunted everywhere for documentation, etc, but cannot find anything that discusses this or shows any examples.

     

    I am not interested in extracting the value of the attribute only the value of the element. I have no control over the XML that I will be using i.e. all elements will contain a single attribute plus data.

     

    Any help would save me from going mad!

     

    Best regards

     

    Rod

     

     

     

    Tuesday, October 07, 2008 10:01 AM

All replies

  • Folks,

     

    I have found a resolution to this.

     

    So for the benefit of others, here is how to do it ...

     

    <xml id="xmldso">
    <START>
    <FIRSTNAME>Joe</FIRSTNAME>
    <LASTNAME id="abc">Bloggs</LASTNAME>
    </START>
    </xml>

     

    <table datasrc="#xmldso">

    <tr><td><div datafld="FIRSTNAME"></div></td></tr>

    <tr>

    <table datasrc="#xmldso" datafld="LASTNAME">

    <tr><td><div datafld="$text"></div></td></tr>

    <table

    </tr>

    </table>


    ... basically I had to bind a second table to not only the data source but also to the element containing the attribute and then access the data for that element by using the internal $text reference.

     

    Regards

     

    Rod

    Tuesday, October 07, 2008 4:14 PM
  •  

    And if I've the attribute on rs...

    <xml id="xmldso">
    <RS nextid="12345">

    <ROW>
    <FIRSTNAME>Joe</FIRSTNAME>
    <LASTNAME>Bloggs</LASTNAME>
    </ROW>
    </RS>

    </xml>

     

    Can anyone help me?

     

    Thanx

     

    Tuesday, November 04, 2008 2:58 PM