code_junkie

What to use for XML parsing / reading in PHP4

Nov 11th, 2011
106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.42 KB | None | 0 0
  1. $xml = ...; // Get your XML data
  2. $xml_parser = xml_parser_create();
  3.  
  4. // _start_element and _end_element are two functions that determine what
  5. // to do when opening and closing tags are found
  6. xml_set_element_handler($xml_parser, "_start_element", "_end_element");
  7.  
  8. // How to handle each char (stripping whitespace if needs be, etc
  9. xml_set_character_data_handler($xml_parser, "_character_data");
  10.  
  11. xml_parse($xml_parser, $xml);
Add Comment
Please, Sign In to add comment