[newbie] pb with entity

  • Thread starter Le TeXnicien de surface
  • Start date
L

Le TeXnicien de surface

Hello

Here is my dtd
<?xml version="1.0" encoding="ISO-8859-15"?>
<!ENTITY APOS "’">
<!ELEMENT poeme (entete*, strophe+, final*) >
<!ELEMENT strophe (entete*, v+) >
<!ELEMENT v (#PCDATA) > <!-- un vers -->
<!ELEMENT entete (titre, avec_titre*) >
<!ELEMENT titre (#PCDATA) >
<!ELEMENT avec_titre ((dedicace | remarque | sous-titre)*) >

Here is a test file
<?xml version="1.0" encoding="ISO-8859-15" ?>
<!DOCTYPE yh_perso SYSTEM "./yh_perso.dtd">
<poeme>
<strophe>
<v>L&APOS;essai</v>
</strophe>
</poeme>

The problem is that Firefox yells about an undefined entity when
reading &APOS;

I've tried to find the solution with "xml in a nutshell" but I'm at
wit ends.
Any help appreciated. Thanks.
 
R

Richard Light

Le TeXnicien de said:
Hello

Here is my dtd
<?xml version="1.0" encoding="ISO-8859-15"?>
<!ENTITY APOS "’">
<!ELEMENT poeme (entete*, strophe+, final*) >
<!ELEMENT strophe (entete*, v+) >
<!ELEMENT v (#PCDATA) > <!-- un vers -->
<!ELEMENT entete (titre, avec_titre*) >
<!ELEMENT titre (#PCDATA) >
<!ELEMENT avec_titre ((dedicace | remarque | sous-titre)*) >

Here is a test file
<?xml version="1.0" encoding="ISO-8859-15" ?>
<!DOCTYPE yh_perso SYSTEM "./yh_perso.dtd">

^ this should be "<!DOCTYPE poeme ...", BTW
<poeme>
<strophe>
<v>L&APOS;essai</v>
</strophe>
</poeme>

The problem is that Firefox yells about an undefined entity when
reading &APOS;

I've tried your file out, and find the same as you.

The Firefox XML parser appears to be totally broken as regards entity
declarations. At first I thought it was a problem that you have used
the upper-case version of a "built-in" entity (apos), but the same error
appears whatever the entity is called, and whether it is declared in the
external DTD or within the internal DTD subset in the document itself.
So I suggest you report this to Mozilla.

The same document (with the error noted above corrected) validates fine
with MSXML.

Richard
 
L

Le TeXnicien de surface

Richard Light wrote / a écrit :
In message <[email protected]>, Le TeXnicien
Here is a test file
<?xml version="1.0" encoding="ISO-8859-15" ?>
<!DOCTYPE yh_perso SYSTEM "./yh_perso.dtd">

^ this should be "<!DOCTYPE poeme ...", BTW

I've tried your file out, and find the same as you.

The Firefox XML parser appears to be totally broken as regards
entity declarations. [cut]
So I suggest you report this to Mozilla. I shall try to do so.

The same document (with the error noted above corrected) validates
fine with MSXML.
Many thanks for your reply.
 
D

David Carlisle

It's supposed to work if you make the entity decalaration in the local
subset. But mozilla family browsers such as firefox do not ever load
external dtd. Some "known" dtd are recognised and read from an internal
cache but the SYSTEM identifier is never used to fetch a dtd (for
performance and security reasons, they claim)

David
 
P

Peter Flynn

Le said:
Hello

Here is my dtd
<?xml version="1.0" encoding="ISO-8859-15"?>
<!ENTITY APOS "’">
<!ELEMENT poeme (entete*, strophe+, final*) >
<!ELEMENT strophe (entete*, v+) >
<!ELEMENT v (#PCDATA) > <!-- un vers -->
<!ELEMENT entete (titre, avec_titre*) >
<!ELEMENT titre (#PCDATA) >
<!ELEMENT avec_titre ((dedicace | remarque | sous-titre)*) >

Here is a test file
<?xml version="1.0" encoding="ISO-8859-15" ?>
<!DOCTYPE yh_perso SYSTEM "./yh_perso.dtd">
<poeme>
<strophe>
<v>L&APOS;essai</v>
</strophe>
</poeme>

The problem is that Firefox yells about an undefined entity when
reading &APOS;

For some weird and stupid reason, Mozilla/Firefox will not download
external DTDs, so it will never see your declarations.

I have no idea why they did this, as it breaks the browser wrt XML.
Perhaps someone from the Moz community can answer.

The solution is to embed the declarations in the instance, eg:

<?xml version="1.0" encoding="ISO-8859-15" ?>
<!DOCTYPE yh_perso [
<!ENTITY APOS "’">
<!ELEMENT poeme (entete*, strophe+, final*) >
<!ELEMENT strophe (entete*, v+) >
<!ELEMENT v (#PCDATA) > <!-- un vers -->
<!ELEMENT entete (titre, avec_titre*) >
<!ELEMENT titre (#PCDATA) >
<!ELEMENT avec_titre ((dedicace | remarque | sous-titre)*) >
]>
<poeme>
<strophe>
<v>L&APOS;essai</v>
</strophe>
</poeme>

///Peter
 
R

Richard Light

Peter Flynn said:
For some weird and stupid reason, Mozilla/Firefox will not download
external DTDs, so it will never see your declarations.

The solution is to embed the declarations in the instance, eg:

Tried this when I was preparing my initial reply. Doesn't work, at
least not for me.

Richard
<?xml version="1.0" encoding="ISO-8859-15" ?>
<!DOCTYPE yh_perso [
<!ENTITY APOS "’">
<!ELEMENT poeme (entete*, strophe+, final*) >
<!ELEMENT strophe (entete*, v+) >
<!ELEMENT v (#PCDATA) > <!-- un vers -->
<!ELEMENT entete (titre, avec_titre*) >
<!ELEMENT titre (#PCDATA) >
<!ELEMENT avec_titre ((dedicace | remarque | sous-titre)*) >
]>
<poeme>
<strophe>
<v>L&APOS;essai</v>
</strophe>
</poeme>

///Peter
 
P

Peter Flynn

Richard said:
Tried this when I was preparing my initial reply. Doesn't work, at
least not for me.

Hmmm. Embedding it *used* to work. Maybe they've given up on XML
completely now. Maybe it's the signal for IE to make a comeback :)

I give up. I don't ever send XML to browsers anyway, only HTML.

///Peter
 
C

C. M. Sperberg-McQueen

Richard Light said:
In message <[email protected]>, Peter Flynn
...
Tried this when I was preparing my initial reply. Doesn't work, at
least not for me.

Version number of your Firefox?

Works for me on Firefox 1.0.1, or more pedantically Mozilla/5.0 (X11;
U; Linux i686; en-US; rv:1.7.6) Gecko/20050225 Firefox/1.0.1

Also in Galeon 1.3.3, which shares Firefox's irritating
aversion to external entities of all sorts.

-C. M. Sperberg-McQueen
World Wide Web Consortium
 
R

Richard Light

C. M. Sperberg-McQueen said:
Version number of your Firefox?

1.0.4 (Windows), or more pedantically Mozilla/5.0 (Windows; U; Windows
NT 5.0; en-US; rv:1.7.8) Gecko/20050511 Firefox/1.0.4.

Richard
 
D

David Carlisle

1.0.4 (Windows), or more pedantically Mozilla/5.0 (Windows; U; Windows
NT 5.0; en-US; rv:1.7.8) Gecko/20050511 Firefox/1.0.4.

Richard


Odd, I have what appears to be the same version, but the internal subset
declaration of APOS works for me:

Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.7.8) Gecko/20050511 Firefox/1.0.4

David
 
R

Richard Light

David Carlisle said:
Odd, I have what appears to be the same version, but the internal subset
declaration of APOS works for me:

Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.7.8)
Gecko/20050511 Firefox/1.0.4

You're right; I'm wrong. With all the fiddling about between internal
and external DTD, and checking that the entity APOS wasn't getting mixed
up with the default entity apos, I ended declaring the entity as APOS1
and invoking it as APOS. So the slap on the wrist from Firefox was
entirely justified ...

This means that you _can_ still work around Firefox's failure to read an
external DTD by declaring entities in the internal DTD subset.

Apologies for any confusion or alarm,

Richard
 
P

Peter Flynn

Richard said:
You're right; I'm wrong. With all the fiddling about between internal
and external DTD, and checking that the entity APOS wasn't getting mixed
up with the default entity apos, I ended declaring the entity as APOS1
and invoking it as APOS. So the slap on the wrist from Firefox was
entirely justified ...

This means that you _can_ still work around Firefox's failure to read an
external DTD by declaring entities in the internal DTD subset.

But from the sound of it, entities only, not element or attribute
declarations?

Does anyone know why FF/Moz is so broken wrt XML? Are they antagonistic
to XML, or are they just dim? I find it hard to believe either.

///Peter
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,236
Members
46,825
Latest member
VernonQuy6

Latest Threads

Top