Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


Re: XML DSO problem when XML elements have attributes

From: wilsonr@-----------.---------.---
To: NULL
Date: 10/7/2008 9:20:00 AM

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.

"wilsonr" wrote:

> Hi Joe,
> 
> Thanks for the reply.
> 
> I found some documentation on MSDN that talks about how data is loaded 
> depending on whether it has attributes, child elements, etc, which supports 
> what you said about attributes being stored as columns in their own right, 
> but I still cannot find anything that states how/what to call an element 
> (that has attributes) other than by its name (which just isn't working).
> 
> There is a 'special' data field called $text that represents a whole record, 
> when I reference that from within the HTML bound table, it brings back the 
> data for my element (which has an attribute) which seems to indicate that the 
> XML document is loading correctly without errors.
> 
> I just cannot find any examples that shows a bound element (that has an 
> attribute) being referenced.
> 
> Regards
> 
> Rod
> 
> "Joe Fawcett" wrote:
> 
> > I haven't used the XML DSO for some time but I seem to remember it turns all 
> > attributes into elements before binding.
> > So: <START><NAME ID="abc">Joe Bloggs</NAME></START>
> > Ends as: <START><NAME>Joe Bloggs</NAME><ID>abc</ID?</START>
> > or maybe the element precedes the NAME one. If some rows don't have an ID 
> > then you're ion trouble.
> > One solution is to transform the XML first to a more usable form or do the 
> > data binding yourself.
> > 
> > -- 
> > 
> > Joe Fawcett (MVP - XML)
> > 
> > http://joe.fawcett.name
> > 
> > 
> > "wilsonr" <wilsonr@d...> wrote in message 
> > news:FBB1E8E8-0272-4CE4-B9B1-3FAC4647D7A7@m......
> > > Hi,
> > >
> > > I am trying to use the built-in XML/HTML data binding in Internet Explorer
> > > using XML DSO.
> > >
> > > E.G. I have the following html code:
> > >
> > > <html><body>
> > > <xml src="doc.xml" id="xmldso" async="false"></xml>
> > > <table datasrc="#xmldso" width="100%" border="1">
> > > <tr><td><span datafld="NAME"></span></td></tr>
> > > </table>
> > > </body></html>
> > >
> > > And the following doc.xml file:
> > >
> > > <START><NAME>Joe Bloggs</NAME></START>
> > >
> > > Everything works fine i.e. "Joe Bloggs" appears in the HTML page until I 
> > > add
> > > an attribute to the XML element.
> > >
> > > E.G. if my doc.xml file looks lke this ...
> > >
> > > <START><NAME ID="abc">Joe Bloggs</NAME></START>
> > >
> > > ... then it fails i.e. no data is displayed in the HTML as soon as the 
> > > "ID"
> > > attribute is added to the "NAME" element. If I have multiple elements in 
> > > the
> > > XML file then only the elements that don't have attributes are displayed.
> > >
> > > Is there something else I need to do to "tell" DSO to ignore the XML 
> > > element
> > > attributes or is there a different way of referencing the element (within 
> > > the
> > > HTML) if it has attributes?
> > >
> > > Regards
> > >
> > > Rod 
> > 
> > 
> > 


transparent
Print
Mail
Like It
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent