Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > XML > XML
Password Reminder
Register
Register | FAQ | Members List | Calendar | 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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developersí questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Display Modes
  #1 (permalink)  
Old May 4th, 2006, 08:48 AM
Registered User
 
Join Date: May 2006
Location: Tallahassee, FL, .
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Default xml validation of entity text in txt files

Hello p2p forum,

I am teaching myself XML using the "Beginning XML, 3rd edition" book published by Wrox. In Chapter 4 their exercises use the free Schematron Validator by Topologi. This software works fine until I attempt to validate an Element tag in the XML against an Entity tag in the DTD. The Entity tag contains a reference to a TXT file where the attribute text is contained. For some reason, the validator does not get the code in the TXT file. When the text is contained directly in the Entity tag in the DTD, the text is obtained. I am not sure if this is an issue with the validator or with code that the book advocates using. I have proof-read the code against the book several times, and it looks the same. The code is below:

In the main XML file (dinosaurs4.xml):

<?xml version="1.0"?>
<!DOCTYPE dinosaurs PUBLIC "-//Beginning XML//DTD Dinosaurs Example//EN" "dinosaurs4.dtd">
<dinosaurs version="1.0" source="Beginning XML 3E">

  <carnivore kind="Tyrannosaurus_Rex" habitat="forest swamp jungle">
      (some more sub-elements)
     <description>&tyrannosaurus;</description>
  </carnivore>

</dinosaurs>

In the DTD file (dinosaurs4.dtd):

<!ELEMENT dinosaurs (carnivore | herbivore | omnivore)* >
<!ATTLIST dinosaurs version CDATA #FIXED "1.0"
                    source CDATA #IMPLIED>

<!ELEMENT carnivore (species, length, height, weight, speed, weapon, discoverer, location, description)>
<!ATTLIST carnivore kind ID #REQUIRED
                    habitat NMTOKENS #REQUIRED
     period (Triassic | Jurassic | Cretaceous) "Cretaceous">

<!ENTITY tyrannosaurus PUBLIC "-//Beginning XML//Tyrannosaurus textual description//EN" "tyrannosaurus.txt">

In the text file (tyrannosaurus.txt):

The Tyrannosaurus Rex was the king of the terrible lizards. Though many now believe it was a hunter and a scavenger it is no less fearsome.

Can you help? I am also emailing Topologi about this issue. Thanks for any help you can give.
Reply With Quote
  #2 (permalink)  
Old May 4th, 2006, 09:03 AM
mhkay's Avatar
Wrox Author
Points: 18,252, Level: 58
Points: 18,252, Level: 58 Points: 18,252, Level: 58 Points: 18,252, Level: 58
Activity: 100%
Activity: 100% Activity: 100% Activity: 100%
 
Join Date: Apr 2004
Location: Reading, Berks, United Kingdom.
Posts: 4,929
Thanks: 0
Thanked 281 Times in 276 Posts
Default

Can't tell from the information given - I would guess the file name is wrong, or it's in the wrong directory - but you haven't provided any evidence so that's just guesswork. But what I can tell you is that it looks like an XML parsing issue and is nothing to do with Schematron - Schematron is just an application consuming the output of the XML parser.

Michael Kay
http://www.saxonica.com/
Author, XSLT Programmer's Reference and XPath 2.0 Programmer's Reference
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
unparsed-entity-uri() changes files extension scopley XSLT 6 November 28th, 2007 09:45 AM
converting text files to xml anandthecoolest Visual Studio 2005 1 March 8th, 2007 02:24 PM
Can 1 xslt transform an xml doc into 2 text files Raju Sarode XSLT 7 November 3rd, 2006 03:10 PM
xml parameter entity yengzhai XML 2 April 10th, 2005 12:54 PM



All times are GMT -4. The time now is 04:28 PM.


Powered by vBulletin®
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.