Hi,
When reading XML file using PHP, how could I put line breaks where necessary? Otherwise there would be a big string of characters without any spaces and line breaks.

Many thanks,

    if you are outputting html, use <br> if you are outputting text, use the newline character: \n

      I used this piece of code, whick someone helped me on this site. But I don't know where to insert line breaks. I output html file.
      Please help!

      Thanks,

      $xml_parser = xml_parser_create();
      // set callback functions
      xml_set_element_handler($xml_parser, "startElement", "endElement");
      xml_set_character_data_handler($xml_parser, "characterData");

      if (!xml_parse_into_struct($xml_parser, $data, $vals, $index) ){
              die(sprintf("XML error: %s at line %d",
                           xml_error_string(xml_get_error_code($xml_parser)),
                          xml_get_current_line_number($xml_parser)));
      }

        where's the rest of the code?
        what you showed doesn't output anything but the error, I think.

          Write a Reply...