Wrox Programmer Forums
Go Back   Wrox Programmer Forums > XML > XML
|
XML General XML discussions.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the XML section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old June 1st, 2005, 04:40 AM
Authorized User
 
Join Date: May 2005
Posts: 24
Thanks: 0
Thanked 0 Times in 0 Posts
Default 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>&nbsp;</TD>
          <TD>
               <TABLE DATASRC="#dsoBookList" DATAFLD="NAME" CELLSPACING=0>
                    <TBODY>
                         <TR>
                              <TD>
                                   <SPAN DATAFLD="NAME">
                                   </SPAN>&nbsp;
                              </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!
 
Old June 29th, 2005, 10:10 AM
Authorized User
 
Join Date: May 2005
Posts: 24
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Okay gents, I've finally worked it out!

The difference between my previous code and the code below is DATAFLD="$TEXT"!

So why didn't you reply then Joe...too easy for you?

<TABLE DATASRC="#dsoBookList" DATAFLD="NAME" CELLSPACING=0>
    <TBODY>
         <TR>
          <TD>
                   <SPAN DATAFLD="$TEXT"></SPAN>&nbsp;
              </TD>
         </TR>
    </TBODY>
</TABLE>






Similar Threads
Thread Thread Starter Forum Replies Last Post
get the values of form field values crmpicco Perl 2 March 16th, 2007 10:57 AM
Get Values from Checkboxlist derekl ASP.NET 1.0 and 1.1 Basics 3 May 26th, 2006 09:46 AM
Using Values from a ListBox timmaher Classic ASP Databases 2 September 14th, 2005 10:01 AM
loop values and text box values move mateenmohd Classic ASP Basics 2 April 5th, 2005 11:33 PM
why don't i see all my values? monstermash Classic ASP Basics 6 July 18th, 2003 11:44 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.