SoFunction
Updated on 2025-04-10

Question about how html embedding xml data island passes through tree structure relationship

As in the following code details, how to pass through the relationship between the tree structure of the data island in html? I don’t know how to use the tag name in xml in this datafld, how to add prefix, and how to get the name child element from resume? At the same time, how should my html file be modified?
The xml data file is
XML code:
Copy the codeThe code is as follows:

<?xml version="1.0" encoding="UTF-8"?>
<resume>
<name>mike</name>
<age>29</age>
</resume>

The html file looks like this:
HTML code:
Copy the codeThe code is as follows:

<html>
<body>
<XML src=""></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 problems, there are two points that need to be modified:
1. datasrc=”# I missed the # number here
2. Must use span.
The following are the modified exact code details:
XML code:
Copy the codeThe code is as follows:

<?xml version="1.0" encoding="UTF-8"?>
<resume>
<name>mike</name>
<age>29</age>
</resume>

HTML code:
Copy the codeThe code is as follows:

<xml src=""></xml>
<table datasrc="#XMLData" border=1 datapagesize=2 width="100%">
<thead>
<th style="font-style: blod">name</th>
<th style="font-style: blod">age</th>
</thead>
<tr>
<td><span datafld="name"></span></td>
<td><span datafld="age"></span></td>
</tr>
</table>