Hi,

This is my XML file. I want to retrieve information stored in a HTML Table in index.html page. How can i do it?

Thanks

<?xml version="1.0" encoding="UTF-8"?>
<memo xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="memo.xsd">
  <header>
    <companyName>XML development LTD</companyName>
    <to>myemail@yahoo.com</to>
    <from>xml@yahoo.com</from>
    <date>1979-11-07</date>
    <reg>I don't know the reg</reg>
  </header>
  <body>
    <message>
      <parag>Hello, How are you today?</parag>
      <sign></sign>
    </message>
  </body>
</memo>

I couldn't do more than this:

<xml id="mamoData" src="memo.xml"></xml>
  <table datasrc="#memoData" border="1px">
    <thead>
      <th>COMPANY</th>
      <th>TO</th>
      <th>FROM</th>
      <th>DATE</th>
      <th>REG</th>
    </thead>

Did it.

<html>
<head>
    <title>Memo</title>
</head>
<body>
    <xml id="memoData" src="memo.xml"></xml>
    
    <table datasrc="#memoData" datafld="header" border="1">
        <tr>
            <td colspan="2">HEADER</td>
        </tr>
        <tr>
            <td>Company</td>
            <td>&nbsp;<span datasrc="#memoData" datafld="companyName"></span></td>
        </tr>
        <tr>
            <td>To</td>
            <td>&nbsp;<span datasrc="#memoData" datafld="to"></span></td>
        </tr>
        <tr>
            <td>From</td>
            <td>&nbsp;<span datasrc="#memoData" datafld="from"></span></td>
        </tr>
        <tr>
            <td>Date</td>
            <td>&nbsp;<span datasrc="#memoData" datafld="date"></span></td>
        </tr>
        <tr>
            <td>Reg</td>
            <td>&nbsp;<span datasrc="#memoData" datafld="reg"></span></td>
        </tr>
    </table>
    
    <table datasrc="#memoData" datafld="body" border="1">
        <tr>
            <td colspan="2">BODY</td>
        </tr>
        <tr>
            <td>Paragraph</td>
            <td>
                <table datasrc="#memoData" datafld="message">
                    <tr>
                        <td>&nbsp;<span datasrc="#memoData" datafld="parag"></span></td>
                    </tr>
                </table>
            </td>
        </tr>
        <tr>
            <td>Signature</td>
            <td>
                <table datasrc="#memoData" datafld="message">
                    <tr>
                        <td>&nbsp;<span datasrc="#memoData" datafld="sign"></span></td>
                    </tr>
                </table>            
            </td>
        </tr>
    </table>

</body>
</html>
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.