Closed Bug 600491 Opened 14 years ago Closed 14 years ago

XML Parsing Error: undefined entity

Categories

(Core :: XML, defect)

x86
Windows Server 2003
defect
Not set
normal

Tracking

()

RESOLVED DUPLICATE of bug 22942

People

(Reporter: jimmyp2, Unassigned)

Details

User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.2; en-US; rv:1.9.2.10) Gecko/20100914 Firefox/3.6.10 ( .NET CLR 3.5.30729; .NET4.0E)
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.2; en-US; rv:1.9.2.10) Gecko/20100914 Firefox/3.6.10 ( .NET CLR 3.5.30729; .NET4.0E)

Hello,

i have created the following files to experiment with XML:

<!-- XML file(test.xml) -->

<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/css" href="styles.css"?>
<!DOCTYPE customer SYSTEM "test.dtd">
<customer>
  <name> John </name>
  <lastname> Elliot </lastname>
  <phonenumbers>
     <mobile> 6944888777 </mobile>
     <home> 33355511 </home>
  </phonenumbers>
  <nationality country="EN" />
  <info>
    <field1> &e_info1; </field1>
    <field2> &e_info2; </field2>
  </info>
</customer>


<!-- XML DTD file(test.dtd) -->

<!ELEMENT customer (name,lastname,phonenumbers,nationality,info)>
<!ELEMENT name (#PCDATA)>
<!ELEMENT lastname (#PCDATA)>
<!ELEMENT phonenumbers (home?,mobile?)>
<!ELEMENT home (#PCDATA)>
<!ELEMENT mobile (#PCDATA)>
<!ELEMENT nationality EMPTY>
<!ATTLIST nationality country (US|EN|FR|DE) "EN">
<!ELEMENT info (field1,field2)>
<!ELEMENT field1 (#PCDATA)>
<!ELEMENT field2 (#PCDATA)>
<!ENTITY e_info1 "Test value 1">
<!ENTITY e_info2 "Test value 2">


<!-- CSS file(styles.css) -->


customer
{
background-color: #abcfab;
width: 100%;
color: #FFf000;
font-size: 20pt;
}

phonenumbers
{
display: block;
margin-bottom: 30pt;
margin-left: 0;
}

home,mobile
{
display: block;
margin-bottom: 5pt;
margin-left: 10pt;
color: #FF0000;
font-size: 20pt;
}

info
{
display: block;
margin-bottom: 30pt;
margin-left: 0;
margin-top: 10pt;
}

field1,field2
{
display: block;
margin-bottom: 5pt;
margin-left: 10pt;
color: #FF0000;
font-size: 20pt;
}




When trying to open the "test.xml" the browser responds with the following error:

XML Parsing Error: undefined entity
Location: file:///D:/Downloads/Temp/test.xml
Line Number 13, Column 14:    <field1> &e_info1; </field1>
-------------^


IMPORTANT NOTE:

Opening the file with IE8 parses correctly and displays the file as expected.


Reproducible: Always
We don't use a validating XML parser, and hence do not load external DTD subsets (as is perfectly ok per the XML specification).  You need to put your entity definitions into an internal subset if you want to define custom entities.
Status: UNCONFIRMED → RESOLVED
Closed: 14 years ago
Resolution: --- → DUPLICATE
Yes, not loading is ok per the XML specs, but what is not ok per XML is that there is a single point of failure error upon a missing entity--that is bug 204102.

By the way, the Pledgie campaign at http://pledgie.com/campaigns/7732 to add DTD support (which is not necessarily the same as adding validating support) does not include my own pledge for $200 if anyone can add the feature and get it added regularly. Other donors welcome.
You need to log in before you can comment on or make changes to this bug.