Home >Backend Development >XML/RSS Tutorial >Regarding the problem of how html embedded xml data island passes through the tree structure relationship
The file of
<?xml version="1.0" encoding="UTF-8"?> <resume> <name>mike</name> <age>29</age> </resume>
html looks like this:
HTML code:
<html> <body> <XML id="myds" src="kg.xml"></XML> <table datasrc="myds"> <tr> <td><div datafld="resume:name"/></div></td> <td><div datafld="name"/></div></td> <td><div datafld="age"/></div></td> </tr> </table> </body> </html>
To avoid the above problem, there are two points that need to be modified:
1. datasrc=”# Here I missed the # number
2. You must use span.
The following are the correct code details after modification:
XML code:
<?xml version="1.0" encoding="UTF-8"?> <resume> <name>mike</name> <age>29</age> </resume>
HTML code:
<xml id="XMLData" src="test.xml"></xml> <table id="tblbooks" datasrc="#XMLData" border=1 datapagesize=2 width="100%"> <thead> <th style="font-style: blod">姓名</th> <th style="font-style: blod">年纪</th> </thead> <tr> <td><span datafld="name"></span></td> <td><span datafld="age"></span></td> </tr> </table>
For more related articles about how html embeds xml data islands through the tree structure relationship, please pay attention to the PHP Chinese website
!