I'd also recommend adding the option below
xml_parser_set_option($parser,XML_OPTION_SKIP_WHITE,1);
![]() |
|
||||||||||
|
xml_parser_createDescriptionresource xml_parser_create ( [string encoding] )xml_parser_create() creates a new XML parser and returns a resource handle referencing it to be used by the other XML functions.
The optional See also xml_parser_create_ns() and xml_parser_free(). xml_parser_create
19-Apr-2006 07:42
I'd also recommend adding the option below
Kim
22-Feb-2006 02:20
Actually, the XML parser DOES support more encodings.
Tobbe
25-May-2005 06:01
The above "XML to array" code does not work properly if you have several tags on the same level and with the same name, example:
dma05 at web dot de
27-Apr-2005 02:54
xml_parser_create () on php5 sometimes detects the wrong input format for me -- for example, sometimes when i try to parse data that has been fetched from a databse by my script and that only contains a handful of special ISO-8859-1 characters, it seems to think the input was something else and xml_parse() chokes on things like umlauts.
php at stock-consulting dot com
21-Feb-2005 02:47
Even though I passed "UTF-8" as encoding type PHP (Version 4.3.3) did *not* treat the input file as UTF-8. The input file was missing the BOM header bytes (which may indeed be omitted, according to RFC3629...but things are a bit unclear there. The RFC seems to make mere recommendations concering the BOM header). If you want to sure that PHP treats an UTF-8 encoded file correctly, make sure that it begins with the corresponding 3 byte BOM header (0xEF 0xBB 0xBF)
jcalvert at gmx dot net
03-Apr-2004 10:39
To maintain compatibility between PHP4 and PHP5 you should always pass a string argument to this function. PHP4 autodetects the format of the input if you leave it out whereas PHP5 will assume the format to be ISO-8859-1 (and choke on the byte order marker of UTF-8 files).
annettetruong at yahoo dot com
26-Mar-2004 10:21
Good article explaining how to use PHP to parse an XML RSS feed:
mmustafa at vsnl dot com
05-Jan-2004 10:00
thought I'd share this small piece of PHP code that prepares a proper array from XML Data |