in reply to XML::Parser SAX error

This error message: not well-formed (invalid token) at line 1, column 0, byte 0

is telling you that your xml data has a problem, and can't be parsed as xml. Since you haven't posted exactly what you used as input, I have to ask: does the xml data file that you actually use have a hyphen in front of the first open tag? I ask because the OP data sample has:

<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE ICECAT-interface SYSTEM "http://data.icecat.biz/dtd/files.in +dex.dtd"> <!-- source: ICEcat.biz 2011 --> -<ICECAT-interface ... ^ |___ the hyphen there is a problem
When I copied your data sample (and added a couple missing end-tags) and put it into an old xml parsing tool, I always got an error. Removing the hyphen got rid of the error.

Replies are listed 'Best First'.
Re^2: XML::Parser SAX error
by bcnagle (Novice) on Jul 16, 2011 at 05:30 UTC

    i just created a simple is-well-formed script and it passed as well-formed. I also tried with this code snippet as an xml file

    <?xml version="1.0" encoding="utf-8"?> <file Catid="0011" Date_added="20050910000000" HighPic="photo/location +.jpg" HighPicHeight="123" HighPicSize="1122" HighPicWidth="123" Model +="varchar model name" On_Market="0" Prod_ID="varchar id name" Product +_I="111" Product_View="11223" Quality="qualitylevel" Supplier="x" Upd +ated="20110713144032" path="required/path/to/other.doc"></file>

    it too is giving me a not well-formed error.

      So, I think the problem is you need to check the man page for XML::Parser. You're passing a file name to the "parse()" method, but you should be passing the file name to the "parsefile()" method. ("parse()" is expecting its argument to be an xml string or a file handle that you've already opened, not a file name.)

      (update: apart from the lesson you've learned now about posting valid sample data, let me also suggest that you trim your code down to the minimal snippet needed to demonstrate the problem. I had to filter out all that database crud to see the error for myself, and only then did I realize that you were using the wrong method call.)

        I'm sorry about that. I just didn't want somebody to not see something and inquire upon that as well and waste their time. Turns out I was wasting time anyway. My bad.
      oh just realized those dashes are created from the tree (expand) and not actually in the file. sorry for the confusion.