473,544 Members | 2,322 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

external parameter entity references in XML - possible eXpat bug


Anyone in for a Byzantine discussion on XML well-formedness?

Here's the situation: test.xml contains

--- test.xml: cut after ---
<?xml version="1.0" encoding="us-ascii"?>
<!DOCTYPE foobar [
<!ENTITY % decls SYSTEM "test.dtd">
<foobar />
--- test.xml: cut before ---

test.dtd initially contains:

--- test.dtd: cut after ---
<?xml version="1.0" encoding="us-ascii"?>
<!ENTITY % addUselessEleme nt SYSTEM "extra.dtd" >
<!ENTITY % addUselessEleme nt.it "%addUselessEle ment;">
<![%addUselessElem ent.it;[
<!ELEMENT useless EMPTY>
--- test.dtd: cut before ---

and extra.dtd simply contains

--- extra.dtd: cut after ---
--- extra.dtd: cut before ---

Assertion: text.xml is valid (and, in particular, well-formed). Both
OpenSP-1.5 and eXpat (version 1.95.6) agree with me here, so I'll
assume I'm right.

Now suppose that in test.dtd the (unique) occurrence of
"%addUselessEle ment.it;" is replaced by "%addUselessEle ment;".
Personally I don't see how this should change anything since one is
defined to be equal to the other anyway. And OpenSP still seems happy
with the file - but then, OpenSP is an SGML parser, and might not know
all the XML well-formedness constraints.

But if I run "xmlwf -p test.xml" (where xmlwf is the program that
comes with eXpat) after this change in test.dtd, then I get the
following error message

extra.dtd:1:0: syntax error
test.dtd:5:3: error in processing external entity reference
test.xml:4:2: error in processing external entity reference

- so eXpat seems to think there is something wrong. I emphasize that
this error does not occur with "%addUselessEle ment.it;" in test.dtd,
as written above, only if it is replaced with "%addUselessEle ment;".
I find this very strange.

Is this a bug in eXpat? I find it hard to believe that, given the
number of people who have used and examined this library, I should
have found something of the sort. This is why I'd like to have some
expert opinion on the question.

Thanks for any thoughts.

David A. Madore
(da**********@e ns.fr,
http://www.eleves.ens.fr:8080/home/madore/ )
Jul 20 '05 #1
1 2497
In article <bi***********@ nef.ens.fr>,
David Madore <da**********@e ns.fr> wrote:
Is this a bug in eXpat?

Hmm, it appears that expat rejects the use of external parameter
entities except in literals and when they expand to declarations.


<!ELEMENT foobar %ext;>

where ext is an external parameter entity containing "EMPTY".

-- Richard
Spam filter: to mail me from a .com/.net site, put my surname in the headers.

FreeBSD rules!
Jul 20 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

by: Chris Curvey | last post by:
I'm writing an XMLRPC server, which is receiving a request (from a non-Python client) that looks like this (formatted for legibility): <?xml version="1.0"?> <methodCall> <methodName>echo</methodName> <params> <param> <value> <string>Le Martyre de Saint Andr&#xe9; &lt;BR&gt; avec inscription
by: Stephan Hoffmann | last post by:
Hi, I use XML mainly as a source for HTML. HTML browsers 'know' certain entity references like &eacute; or &auml;. When I use XSL to transform XML to HTML or XML, these entities are replaced by what they refer to. Is there a way to avoid that?
by: Jukka K. Korpela | last post by:
I noticed that Internet Explorer (6.0, on Win XP SP 2, all fixes installed) incorrectly renders e.g. &harr &euro &Omega literally and not as characters denoted by the entities, but if a semicolon is appended to each of the entity references, they work. I'm pretty sure that previous versions of IE rendered them by the specifications. I...
by: Erwin Gabler | last post by:
Trying to validate a document with a reference to a DTD ("PUBLIC" identifier): <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE systems-description PUBLIC "-//foo/nono" ""> .... The DTD uses some kind of parameter entity with a reference to an entity file:
by: STech | last post by:
I have an instance of an XmlDocument. I am using the Load method to load some xml data but get the error message "Reference to undeclared parameter entity". Here is the xml data <data> <items> <item>This is a test </item> <item>Hello World </item> </items>
by: jesl | last post by:
Group, I have created a User Control with the property "Html" of type string. If I declare this control on an ASPX page with the value "<b>This is an entity: &lt;</b>" for the property "Html", the ASP.NET parser seems to automatically convert the entity reference "&lt;" to it's corresponding character value "<". For example, if the tagprefix...
by: Tuomas Rannikko | last post by:
Hello! I have a simple question about DTDs: Should this be possible? <!DOCTYPE root > In the XML specification I can't find the spot where it says this would be disallowed; however Xerces complains about the parameter entity being in markup.
by: Paquette.Jim | last post by:
Hello, I'm trying to get XUL output with an element that has an attribute containing an entity reference. Can this be done? I saw another post exactly like this...but the solutions they gave didn't work for me. <contextMenu>
by: TAL651 | last post by:
I'm having trouble displaying entity references (i.e. >, <, etc). I'll show the code first, then ask my question. This code makes sub items on a menu appear or disappear. The HTML isn't giving me issues, so I'm only posting the javascript for now: Javascript code: function expandcollapseBGrows(anchor) { var span =...
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.