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 May 4th, 2006, 08:48 AM
Registered User
Join Date: May 2006
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)


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.
Old May 4th, 2006, 09:03 AM
mhkay's Avatar
Wrox Author
Join Date: Apr 2004
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts

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
Author, XSLT Programmer's Reference and XPath 2.0 Programmer's Reference

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

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