For Programmers: Free Programming Magazines  


Home > Archive > PHP Language > April 2005 > parsing XML file









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author parsing XML file
unknown

2005-04-15, 3:56 pm


i have some problem when i try to print character data emitted by the xml
parser..

$parser = xml_parser_create('');
xml_set_character_data_handler($parser, "characterData");

function characterData($parser, $data)
Â_Â_echoÂ_nl2br($data);
this work fine..

but if i try this..
function characterData($parser, $data)
Â_Â_echoÂ_nl2br(trim($data));
all line feed are erased and no <br /> is added to the output..

i've tried to change the character encodings with no success..
bye the way i think that the problem is the encoding..

what i can do?
Andy Hassall

2005-04-15, 8:56 pm

On Fri, 15 Apr 2005 17:32:30 GMT, unknown <user@host.network> wrote:

>but if i try this..
>function characterData($parser, $data)
>__echo_nl2br(trim($data));
>all line feed are erased and no <br /> is added to the output..


But that's what you asked for... read the docs for trim().

--
Andy Hassall / <andy@andyh.co.uk> / <http://www.andyh.co.uk>
<http://www.andyhsoftware.co.uk/space> Space: disk usage analysis tool
unknown

2005-04-15, 8:56 pm

Andy Hassall wrote:

> On Fri, 15 Apr 2005 17:32:30 GMT, unknown <user@host.network> wrote:
>
>
> But that's what you asked for... read the docs for trim().
>


thanks, resolved..
but by the way trim($string, "\n") don't work fine.. must use trim($string,
10) or trim($string, 0x20)
unknown

2005-04-15, 8:56 pm

Andy Hassall wrote:

> On Fri, 15 Apr 2005 17:32:30 GMT, unknown <user@host.network> wrote:
>
>
> But that's what you asked for... read the docs for trim().
>


thanks, resolved..
but by the way trim($string, "\n") don't work fine.. must use trim($string,
10) or trim($string, 0x0A)
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com