[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: DTD's in external Entities?

  • From: David Brownell <david-b@p...>
  • To: Binesh Bannerjee <binesh@h...>
  • Date: Thu, 26 Aug 1999 08:51:05 -0700

binesh bannerjee
External entities may not have DTDs.  They also may not have
standalone='...'" attributes in their text declarations.  In
both cases, the XML spec requires fatal errors to be reported;
unless, that is, you've got a non-validating processor which
isn't reading the external entity!

If you find an "XML" processor which supports the nesting that
you're trying, return it to the vendor for a full refund ... ;-)

- Dave


Binesh Bannerjee wrote:
> 
> Woo hoo, I'm finally off the edge and have dove into the world
> of XML/DOM etc... I have a question tho...
> 
> Here's what I want to do:
>         I want to have a document "container.xml"
> 
>         <?xml version="1.0" standalone="no" ?>
>         <!DOCTYPE container [
>                 <!ELEMENT container ANY>
>                 <!ENTITY blah SYSTEM "blah.xml">
>         ]>
> 
>         <container>
>                 &blah;
>         </container>
> 
> then,
>         blah would contain:
>         <?xml version="1.0" standalone="yes" ?>
>         <!DOCTYPE data [
>                 <!ELEMENT data (firstname,lastname)>
>                 <!ELEMENT firstname (#PCDATA)>
>                 <!ELEMENT lastname (#PCDATA)>
>         ]>
>         <data>
>                 <firstname>Binesh</firstname>
>                 <lastname>Bannerjee</lastname>
>         </data>
> 
> I'm using Sun's DOM implementation... If I'm not misinterpreting, Listing
> 6-17 in "XML: Extensible Markup Language" by Elliotte Rusty Harold on page
> 202 does exactly that...
> 
> If I run Sun's
>         XmlDocument.createXmlDocument("file:///path/blah.xml",true);
> 
> works fine...
> However
>         running XmlDocument.createXmlDocument("file:///path/container.xml",true);
> 
> yields:
>         org.xml.sax.SAXParseException: Expected "encoding=...".
>         at com.sun.xml.parser.Parser.fatal(Parser.java:2797)
> 
> Removing the xml PI from blah.xml (which makes it an invalid doc, if I've
> read the spec correctly) yields:
>         org.xml.sax.SAXParseException: The content beginning "<!" is not legal markup. Perhaps the "!" (&#21;) character should be a letter.
>         at com.sun.xml.parser.Parser.fatal(Parser.java:2797)
> 
> What's going on?
>         Shouldn't I be able to do this? If I remove the &blah; in
> container.xml it parses fine... If not, what is the best way of doing
> what I want? Even this fails:
>         blah.dtd:
>                 <!ELEMENT data (firstname,lastname)>
>                 <!ELEMENT firstname (#PCDATA)>
>                 <!ELEMENT lastname (#PCDATA)>
> 
>         blah.xml:
>                 <?xml version="1.0" standalone="no"?>
>                 <!DOCTYPE data SYSTEM "blah.dtd">
>                 <data>
>                         <firstname>Binesh</firstname>
>                         <lastname>Bannerjee</lastname>
>                 </data>
>         container.xml:
>                 <?xml version="1.0" standalone="no"?>
>                 <!DOCTYPE container [
>                         <!ELEMENT container ANY>
>                         <!ENTITY blah SYSTEM "blah.xml">
>                 ]>
>                 <container>
>                         &blah;
>                 </container>
> 
> How does one include _valid_ xml docs in other _valid_ xml docs??
> Am I doing something wrong, or is it time to switch DOM implementations?
> 
> Thanks...
> Binesh Bannerjee
> 
> xml-dev: A list for W3C XML Developers. To post, mailto:xml-dev@i...
> Archived as: http://www.lists.ic.ac.uk/hypermail/xml-dev/ and on CD-ROM/ISBN 981-02-3594-1
> To (un)subscribe, mailto:majordomo@i... the following message;
> (un)subscribe xml-dev
> To subscribe to the digests, mailto:majordomo@i... the following message;
> subscribe xml-dev-digest
> List coordinator, Henry Rzepa (mailto:rzepa@i...)

xml-dev: A list for W3C XML Developers. To post, mailto:xml-dev@i...
Archived as: http://www.lists.ic.ac.uk/hypermail/xml-dev/ and on CD-ROM/ISBN 981-02-3594-1
To (un)subscribe, mailto:majordomo@i... the following message;
(un)subscribe xml-dev
To subscribe to the digests, mailto:majordomo@i... the following message;
subscribe xml-dev-digest
List coordinator, Henry Rzepa (mailto:rzepa@i...)



PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
 

Stylus Studio has published XML-DEV in RSS and ATOM formats, enabling users to easily subcribe to the list from their preferred news reader application.


Stylus Studio Sponsored Links are added links designed to provide related and additional information to the visitors of this website. they were not included by the author in the initial post. To view the content without the Sponsor Links please click here.

Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.