Subject: xml validation of entity text in txt files
Posted By: reblev Post Date: 5/4/2006 8:48:52 AM
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 By: mhkay Reply Date: 5/4/2006 9:03:27 AM
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

Go to topic 43797

Return to index page 296
Return to index page 295
Return to index page 294
Return to index page 293
Return to index page 292
Return to index page 291
Return to index page 290
Return to index page 289
Return to index page 288
Return to index page 287