XML parser error: entity not defined

Having trouble installing <oXygen/>? Got a bug to report? Post it all here.

XML parser error: entity not defined

Postby MikeM » Sun Jul 01, 2012 5:35 pm

I wrote a simple XML file and a DTD file including an entity, but when I want to check it in my browsers I get the message:

XML parser error: entity not defined.
Address: file:///Users/Mike/Documents/fb.xml
Row 8, column 22

I tried to find an answer, most refer to an add-on problem with Firefox. I, however, get this message in Firefox, Chrome and Safari. (Opera doesn't give me a message, but it doesn't show the correct text replacement either.) I work on Mac OS X 10.7.

Here are my files.
DTD:
Code: Select all
<?xml version="1.0" encoding="UTF-8"?>
<!ELEMENT example (some_list) >
<!ELEMENT some_list (item+)>
<!ELEMENT item (element1, element2)>
<!ELEMENT element1 (#PCDATA) >
<!ELEMENT element2 (#PCDATA) >
<!ENTITY entity1 "1234567890" >


XML:
Code: Select all
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE some_list SYSTEM "Allgemeine_Entities.dtd">
<some_list>
    <item>
        <element1>Some Text</element1>
        <element2>more Text and &entity1;</element2>
    </item>
</some_list>


As the problem appears in all my browsers, I assume it is not a browser specific problem.

Thanks for your input.
MikeM
 
Posts: 6
Joined: Sun Jul 01, 2012 5:31 pm

Re: XML parser error: entity not defined

Postby adrian » Mon Jul 09, 2012 4:40 pm

Hi,

This happens because currently no web browser supports external entities.
For Mozilla:
https://bugzilla.mozilla.org/show_bug.cgi?id=22942

I see that at least for Firefox and Chrome there is a workaround. Declare the entities in the internal subset, in the XML.
e.g.
Code: Select all
<!DOCTYPE some_list SYSTEM "Allgemeine_Entities.dtd" [
<!ENTITY entity1 "1234567890" >
]>


Regards,
Adrian
Adrian Buza
<oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
http://www.oxygenxml.com
adrian
 
Posts: 1356
Joined: Tue May 17, 2005 4:01 pm

Re: XML parser error: entity not defined

Postby MikeM » Mon Jul 09, 2012 8:33 pm

Hey Adrian,

Thank you very much for this very helpful answer. Excellent.

Regards,
Mike
MikeM
 
Posts: 6
Joined: Sun Jul 01, 2012 5:31 pm

Re: XML parser error: entity not defined

Postby djheru » Tue Jul 17, 2012 9:56 pm

Thanks for this! I was banging my head against the wall trying to figure out why my externally defined entities were not being pulled into the browser.
djheru
 
Posts: 1
Joined: Tue Jul 17, 2012 9:53 pm


Return to Common Problems

Who is online

Users browsing this forum: No registered users and 0 guests