Results 1 to 2 of 2

Thread: xml paser

  1. #1
    Join Date
    Jan 2004

    Unanswered: xml paser


    I have built a xml parsing class that (surprisingly) parses xml. THe problem I am having is when I am opening a xml file that has been formated with spaces and crlf such as:
    <?xml version='1.0' ?>
    <test>bla bla</test>

    then try and do an fopen and fread it causes a parser error stating there is "XML error: junk after document element at line 1" now if I go into that document and take out all of that hidden formating then it works fine but takes away from the readability of the xml, also I am using xmldom to write xml and it seems to put in that hidden formating when writing to file anyway. Is their any option that anyone knows of to tell the parser (expat) to ignore this stuff?? To date I have been doing an ereg_replace to get rid of the formating but that just seems dumb to me am I wrong??

    Thanks for your help in advance

  2. #2
    Join Date
    Jan 2004

    Talking result

    Well it turns out I am red faced on this one. The problem was cause by not cleaning up the parser after multiple calls to it
    ie calling xml_parser_free

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts