Wrox Programmer Forums
Go Back   Wrox Programmer Forums > XML > XML
| Search | Today's Posts | Mark Forums Read
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 November 9th, 2005, 04:20 PM
Friend of Wrox
Points: 630, Level: 9
Points: 630, Level: 9 Points: 630, Level: 9 Points: 630, Level: 9
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Oct 2005
Location: Austin, TX, USA.
Posts: 124
Thanks: 0
Thanked 1 Time in 1 Post
Default How to use DTD file for a XML file

I has been reviewing the "Beginning ASP 3.0." Followed the Page 841 Errata for the Book:
841 External DTD needs lines removing from it
The error was supplied by Barry Godsmark.
The '>' is missing from end of second line of DTD example.
The first and last lines of this example DTD should be omitted in an external DTD file.
This text works ok when included directly in the xml file but fails when used as an external DTD. Refer page 451 of Professional ASP 3.0.

First, I add the DTD text in my BooksDTD.xml file:

<?xml version="1.0"?>
<!DOCTYPE books [
<!ELEMENT books (book+)>
<!ELEMENT book (title, ISBN, authors, description?, price+)>
<!ELEMENT title (#PCDATA)>
<!ELEMENT authors (author+)>
<!ELEMENT author (#PCDATA)>
<!ELEMENT description (#PCDATA)>
<!ELEMENT price EMPTY>
<!ATTLIST price
          US CDATA #REQUIRED
>
]>
<books>
<book>
...

The IE vrowser just showed the XML file with first 2 lines:
<?xml version="1.0" ?>
  <!DOCTYPE books (View Source for full doctype...)>
- <books>
- <book>

Apparently the DTD did not work.

I also tried the external DTD file. Added the '>' to the end of second line and deleted the first and last lines. The browser shoed the same XML file, not the book information.

I tried http DTD http address:
<?xml version="1.0"?>
<!DOCTYPE books SYSTEM "http://www.wrox.com/DTDlibrary/books.dtd">
<books>
<book>

The browser showed the error:
The system cannot locate the object specified. Error processing resource 'http://www.wrox.com/DTDlibrary/books.dtd'.

All I have done successfully was using the books.css.

What's wrong with the DTD file?

TIA,
Jeffrey


C. Jeffrey Wang
__________________
C. Jeffrey Wang




Similar Threads
Thread Thread Starter Forum Replies Last Post
Importing DTD file in to an xsl venkatragh82 XSLT 8 August 12th, 2008 02:35 AM
Automated tool to convert XML from DTD to DTD lsantos2000 XSLT 2 October 17th, 2007 08:21 AM
how to parse the XML file and DTD through Xerces tufailfifa C++ Programming 0 June 25th, 2007 07:03 AM
how to parse the XML file and DTD tufailfifa XML 0 June 25th, 2007 07:02 AM
help with dtd file format jsbxml XML 0 January 17th, 2005 04:31 PM





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