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

Re: Nested entity declarations in DTDs

  • From: Mukul Gandhi <mukulg@softwarebytes.org>
  • To: daniel@devasta.ie
  • Date: Sun, 20 Mar 2022 12:00:24 +0530

Re:  Nested entity declarations in DTDs
On Sun, Mar 13, 2022 at 9:10 PM <daniel@devasta.ie> wrote:
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE feed [
<!ENTITY a 'http://www.w3.org/2005/Atom'>
<!ENTITY b '&e;&f;&g;&h;&i;'>
<!ENTITY c 'tag:xn--8ws00zhy3a.com,2006-05-04:/tests/atom/obfuscated/'>
<!ENTITY d 'http://www.xn--8ws00zhy3a.com/tests/atom/obfuscated/'>
<!ENTITY e '<title>Obfuscated Atom</title>
  <updated>2007-10-19T00:00:00+00:00</updated>
  <id>&c;</id><link rel="alternate" href=""
  <link rel="self" href=""
  <author><name>James Holderness</name></author>'>
<!ENTITY % a '<entry><title>This is title #'>
<!ENTITY % b '</title><updated>2007-10-18T23:'>
<!ENTITY % c ':00+00:00</updated><id>&c;'>
<!ENTITY % d '</id><link href=""
<!ENTITY % e '.html"/><summary type="html">
  This is the <code>summary</code> for entry number '>
<!ENTITY % f '.</summary></entry>'>
<!ENTITY % g '<!ENTITY f "&#37;a;1&#37;b;59&#37;c;1&#37;d;1&#37;e;1&#37;f;">'>
<!ENTITY % h '<!ENTITY g "&#37;a;2&#37;b;58&#37;c;2&#37;d;2&#37;e;2&#37;f;">'>
<!ENTITY % i '<!ENTITY h "&#37;a;3&#37;b;57&#37;c;3&#37;d;3&#37;e;3&#37;f;">'>
<!ENTITY % j '<!ENTITY i "&#37;a;4&#37;b;56&#37;c;4&#37;d;4&#37;e;4&#37;f;">'>
%g;%h;%i;%j;
]>
<feed xmlns="&a;">&b;</feed>
I've revisited above mentioned example. Now I've parsed the above cited XML document instance with expat (which I believe is an underlying XML parser for mozilla) command line (I've built a custom windows .exe from my C program that I've compiled and linked using expat library). The document parses fine, without errors. I'm not able to review visually (since there are too many entity cross references), all the entity definitions and references within above mentioned XML. Assuming that, all entity references are defined, I could say that, expat doesn't have a bug :). Am I right?

Following are few other XML documents, that I've parsed with expat, and the parsing results are mentioned as well,

<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE feed [
<!ENTITY a 'http://test1'>
<!ENTITY e 'hello'>
<!ENTITY b '&e;'>
]>
<feed xmlns="&a;">&b;</feed>

The above XML document instance, parses without errors.

<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE feed [
<!ENTITY a 'http://test1'>
<!ENTITY e1 'hello'>
<!ENTITY b '&e;'>
]>
<feed xmlns="&a;">&b;</feed>

The above example, results in following parsing error (because, entity definition for 'e' is missing),

Parse error at line 7:
undefined entity


--
Regards,
Mukul Gandhi


[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index]


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.