ID:               15092
 Comment by:       somebody at wolfmarkt dot de
 Reported By:      bs_php at infeer dot com
 Status:           Closed
 Bug Type:         XML related
 Operating System: Win 2k (all I gues)
 PHP Version:      4.1.0
 New Comment:

It is not ultimately necessary to add a reference to an external entity
and to have add an external entity handler, separate parser etc. as
described in other messages below
Just include the entity definitions you need at the top of your xml and
thus make the xml parser aware of them:
<?xml version='1.0'?>
<!DOCTYPE demo SYSTEM "/demo.dtd [
<!ENTITY nbsp   "&#160;">
<!ENTITY iexcl  "&#161;">
<!ENTITY cent   "&#162;">
<---- more entities here, see list e.g. at
http://www.w3.org/MarkUp/html-spec/html-spec_14.html ---->
<!ENTITY yuml    "&#255;">

]>
<demo>
<---- your XML doc here ---->
</demo>


Previous Comments:
------------------------------------------------------------------------

[2002-01-22 19:02:23] [EMAIL PROTECTED]

No worries, i'm not taking anything personal in here, but nevertheless
i have to disagree with you. XML is all about specs... Interoperability
is one of the main advantages of XML and if PHP would parse
XML-Documents with latin1-entities but without a corresponding external
entity, it breaks the specs and this XML-Doc would no other
XML-Processor understand. And i think it'd be the wrong way, if PHP
would parse non-valid XML-Documents, even with an optional parameter..
but anyway, i'm not the maintainer of this extension, therefore i don't
have the last word in that :)



------------------------------------------------------------------------

[2002-01-22 18:46:42] bs_php at infeer dot com

Don't take following personal:
I think it's terrible habit to miss out practical functionality and
point to a spec and say "It must be this way, the spec says so". 
I mean is there a *real* reason not to support the ISO latin-1
entities??
PHP slogan is to keep simple stuff simple, isn't it?
So is there a chance that the ISO latin-1 entities can be turned on in
future (by parameter or so)?


------------------------------------------------------------------------

[2002-01-22 18:08:59] [EMAIL PROTECTED]

It does not work, because the XML-standard (see
http://www.w3.org/TR/1998/REC-xml-19980210#sec-predefined-ent) does not
say, that an XML Parser should understand latin1-entities. The expat
Parsers behaves like it is expected (sablotron and domxml for example
do the same, they don't understand latin1-entities without external
entities..). Understanding the iso8859-1 charset is something
completely different and has not much to do with entities (in the
context of the xml-standard..).

I agree with you, that it should be easier to include external
entities, but the way ext/xml does is also just like a SAX-parser
should do it -> do everything by yourself with callback functions... (i
assume, that was the idea :) )

------------------------------------------------------------------------

[2002-01-22 16:49:08] bs_php at infeer dot com

Yes, that's also a possibility. 
  Not practical, 
  not easy, 
  not fancy, 
  not efficient... but a possibility.

---

Still, I think it's a bug:
According to the manual, PHP's XML parser *handles* ISO 8859-1
(Latin-1) as default. That means XML source may contain ü,ö,ä,è, a.s.o.

So way should it fail when I intend to use the latin1-entities!? I see
no reason way latin1-entities shouldn't work per default too!!

------------------------------------------------------------------------

[2002-01-22 11:34:20] [EMAIL PROTECTED]

This doesn't work, because the default entities are only:
<!ENTITY lt     "&#38;#60;"> 
<!ENTITY gt     "&#62;"> 
<!ENTITY amp    "&#38;#38;"> 
<!ENTITY apos   "&#39;"> 
<!ENTITY quot   "&#34;"> 

For the latin1-entities to work, you have to set an external entity to

http://www.w3.org/TR/xhtml1/DTD/xhtml-lat1.ent
(or some local file with that content)
and then set up a xml_set_external_entity_ref_handler().
See the details about that in the manual.

(set to feedback, 'cause I didn't really test it, if someone can verify
that, we can close it.)


------------------------------------------------------------------------

The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
    http://bugs.php.net/15092

-- 
Edit this bug report at http://bugs.php.net/?id=15092&edit=1

Reply via email to