Where have all the values gone?
Put the below code into an xml file called test.xml
<?xml version="1.0" ?>
<!DOCTYPE PERSONS [
<!ELEMENT PERSONS (ITEM+)>
<!ELEMENT ITEM (TITLE, NAME*)>
<!ELEMENT TITLE (#PCDATA)>
<!ELEMENT NAME (#PCDATA)>
]>
<PERSONS>
<ITEM>
<TITLE>Hege Refsnes </TITLE>
<NAME>Martin</NAME>
<NAME>Williams</NAME>
<NAME>Cheryl</NAME>
<NAME>Caprialdi</NAME>
</ITEM>
</PERSONS>
Now create a html file with this in:
<HTML>
<BODY>
<XML ID="dsoBookList" SRC="test.xml"></XML>
<TABLE DATASRC="#dsoBookList" border="1" CELLSPACING=0 WIDTH=100%>
<THEAD>
<TR>
<TH ALIGN="LEFT">Title
</TH>
<TH ALIGN="LEFT">Author(s)
</TH>
</TR>
</THEAD>
<TBODY>
<TR>
<TD valign="top"><SPAN DATAFLD="TITLE"></SPAN> </TD>
<TD>
<TABLE DATASRC="#dsoBookList" DATAFLD="NAME" CELLSPACING=0>
<TBODY>
<TR>
<TD>
<SPAN DATAFLD="NAME">
</SPAN>
</TD>
</TR>
</TBODY>
</TABLE>
</TD>
</TR>
</TBODY>
</TABLE>
</BODY>
</HTML>
The output gives you the one row showing the title with 4 blank rows where the names should be!
The question is - Is it possible to display the names without changing the xml data...i.e. by either changing the DTD or the html!
The only way I seem to be able to display the names is by placing the NAME tags under a new parent node!
It is by grace we are saved!
|