OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

 


 

   Re: DTD's in external Entities?

[ Lists Home | Date Index | Thread Index ]
  • From: David Brownell <david-b@pacbell.net>
  • To: Binesh Bannerjee <binesh@hex21.com>
  • Date: Thu, 26 Aug 1999 08:51:05 -0700

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@ic.ac.uk
> 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@ic.ac.uk the following message;
> (un)subscribe xml-dev
> To subscribe to the digests, mailto:majordomo@ic.ac.uk the following message;
> subscribe xml-dev-digest
> List coordinator, Henry Rzepa (mailto:rzepa@ic.ac.uk)

xml-dev: A list for W3C XML Developers. To post, mailto:xml-dev@ic.ac.uk
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@ic.ac.uk the following message;
(un)subscribe xml-dev
To subscribe to the digests, mailto:majordomo@ic.ac.uk the following message;
subscribe xml-dev-digest
List coordinator, Henry Rzepa (mailto:rzepa@ic.ac.uk)






 

News | XML in Industry | Calendar | XML Registry
Marketplace | Resources | MyXML.org | Sponsors | Privacy Statement

Copyright 2001 XML.org. This site is hosted by OASIS