Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 999
  • Last Modified:

Validation (XHTML 1.0 Translational): Attribute 'datasrc' is not a valid attribute of element 'table'

Hello Everyone,

I am new to XML and I am currently doing a tutorial where we are defining a data island and binding it to a layout.  I am working in Visual Web Developer 2008 and for my datasrc and datafld attribute I am getting a green jagged line underneath the attributes. When I point my mouse cursor over the attributes I get a box saying Validation (XHTML 1.0 Translational): Attribute 'datasrc' is not a valid attribute of element 'table'.  But, when I open the file up into IE it displays correctly but when I open the file in FireFox the pictures does not show.
<html>
<head>
    <title>XML Data Islands</title>
    <link href="styles.css" rel="stylesheet" type="text/css" />
</head>
<body>
    <h2>
        Binding XML Data Islands to Elements</h2>
    <p>
        This IE-specific example demonstrates how to bind an XML data island to an HTML
        element like a Table. The <code>dataSrc</code> attribute binds a particular HTML
        element to the data island - in this case, a <code>&lt;table&gt;</code>. The <code>dataFld</code>
        attribute can be used within the HTML table element to display a particular field
        within the XML data.
    </p>
    
    <xml id="myXmlDataSource" src="items.xml"> </xml>
    
    <table datasrc="#myXmlDataSource" border="1">
        <thead>
            <tr>
                <th>
                    Photo</th>
                <th>
                    Description</th>
                <th>
                    Type</th>
            </tr>
        </thead>
        <tbody>
            <tr>
                <td>
                    <img datafld="photo"/>
                </td>
                <td>
                    <span datafld="name"/>
                </td>
                <td>
                    <span datafld="type"/>
                </td>
            </tr>
        </tbody>
    </table>
    <p>
        You can also bind data to HTML elements using external XML files. This table refers
        to the items.xml file:</p>
    <table border="1">
        <thead>
            <tr>
                <th>
                    Photo</th>
                <th>
                    Description</th>
                <th>
                    Type</th>
            </tr>
        </thead>
        <tbody>
            <tr>
                <td>
                    <img />
                </td>
                <td>
                </td>
                <td>
                </td>
            </tr>
        </tbody>
    </table>
</body>
</html>

Open in new window

0
brich744
Asked:
brich744
1 Solution
 
Dave BaldwinFixer of ProblemsCommented:
I don't know if 'datasrc' will validate but your page is not XHTML because it does not have an XHTML Doctype.  This page http://www.w3.org/QA/2002/04/valid-dtd-list.html show the recommended DOCTYPE statements. For XHTML transitional, your page should start like this:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
   "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>XML Data Islands</title>
    <link href="styles.css" rel="stylesheet" type="text/css" />
</head>

Open in new window

0

Featured Post

[Webinar On Demand] Database Backup and Recovery

Does your company store data on premises, off site, in the cloud, or a combination of these? If you answered “yes”, you need a data backup recovery plan that fits each and every platform. Watch now as as Percona teaches us how to build agile data backup recovery plan.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now