Re: Entity 'reg' not defined

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Oct 22, 2010 at 2:28 PM, Richard Quadling <rquadling@xxxxxxxxx> wrote:
> On 22 October 2010 19:01, TR Shaw <tshaw@xxxxxxxx> wrote:
>>
>> On Oct 22, 2010, at 1:56 PM, Ashley Sheridan wrote:
>>
>>> On Fri, 2010-10-22 at 12:03 -0400, Adam Richardson wrote:
>>>
>>>> On Fri, Oct 22, 2010 at 11:47 AM, TR Shaw <tshaw@xxxxxxxx> wrote:
>>>>
>>>>> Anyone have an idea how to work around this? I tried:
>>>>>
>>>>> define ('reg', '®');
>>>>> define ('&reg;', '®');
>>>>>
>>>>> can't figure how to override the entity table.  Errors follw:
>>>>>
>>>>> Warning: simplexml_load_string():
>>>>> o.cc/46/e53d68e007fd45c2fccb502f2e7ccad5.php?user_id=47&amp;sub_id=61862469&reg;
>>>>> in checkifup.php on line 5119
>>>>>
>>>>> Warning: simplexml_load_string():
>>>>>                                     ^ in checkifup.php on line 5119
>>>>>
>>>>> Warning: simplexml_load_string(): Entity: line 220: parser error : Entity
>>>>> 'reg' not defined in checkifup.php on line 5119
>>>>>
>>>>> Warning: simplexml_load_string():
>>>>> /office/e53d68e007fd45c2fccb502f2e7ccad5.php?user_id=47&amp;sub_id=89877485&reg;
>>>>> in checkifup.php on line 5119
>>>>>
>>>>>
>>>>> --
>>>>> PHP General Mailing List (http://www.php.net/)
>>>>> To unsubscribe, visit: http://www.php.net/unsub.php
>>>>>
>>>>>
>>>> Does doing a str_replace and changing it to the corresponding entity number
>>>> (&#174;) before parsing with simple_xml work?
>>>>
>>>> Here's a more robust function:
>>>> http://www.sourcerally.net/Scripts/39-Convert-HTML-Entities-to-XML-Entities
>>>>
>>>> Adam
>>>>
>>>
>>>
>>>
>>> This isn't a PHP error, it's an error with your XML. The regular HTML
>>> entities which you're used to such as &reg; and &copy; are not
>>> recognised in XML without first being declared as entities. The entities
>>> exist in HTML because just outputting those characters won't always work
>>> in a web browser (*Internet Explorer* *cough* *cough*) whereas XML was
>>> never meant to be displayed in a browser, but transformed and then
>>> output to a browser (among many other things) through XSLT. If you use
>>> the characters directly in your XML you should be fine with the parser,
>>> although you may have to make sure your document is saved in utf-8, as
>>> most of the entity characters are above the ascii range.
>>>
>>
>> Ash
>>
>> Its not my XML (&reg; isn't a www standard anyway) but its the xml provided by the source I have to deal with and I can't change them so I guess I'll just read the xml and then run defensing string replacements.
>>
>> Thanks for everyone's help.
>>
>> Tom
>>
>>
>>
>> --
>> PHP General Mailing List (http://www.php.net/)
>> To unsubscribe, visit: http://www.php.net/unsub.php
>>
>>
>
> My xml file is ...
>
> <?xml version="1.0"?>
> <tag>&reg;</tag>
>
> Using different tools the error is always along the lines of ...
>
> "This page contains the following errors:
>
> error on line 1 at column 11: Entity 'reg' not defined
> Below is a rendering of the page up to the first error."
>
>
> <?xml version="1.0"?>
> <tag>&#ae;</tag>
>
> "This page contains the following errors:
>
> error on line 2 at column 8: CharRef: invalid decimal value
> Below is a rendering of the page up to the first error."
>
> The only thing I could do was ...
>
> <?xml version="1.0"?>
> <tag>&amp;reg;</tag>
>
>
> --
> Richard Quadling
> Twitter : EE : Zend
> @RQuadling : e-e.com/M_248814.html : bit.ly/9O8vFY
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

Couldn't you cdata wrap that value?

-- 

Bastien

Cat, the other other white meat

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux