in reply to Re: Error decoding XML
in thread Error decoding XML

Indeed. XML::Simple treats string arguments other than those containing a < eventually followed by a > as filenames, not XML documents. XML documents SHOULD (as opposed to MUST) start with a decleration (looks like <?xml version="1.0"?>), so it's not a bad way of differentiating file names from XML strings.

Replies are listed 'Best First'.
Re^3: Error decoding XML
by Hammy (Scribe) on Jan 24, 2005 at 17:23 UTC
    Does this mean if I put the string to start my XML, it should work OK? I tried just putting that string at the beginning and it still gave me a file does not exist error. The data I am getting I am receiving from someone else. I can add data to it or remove data from it, but I can not change the structure of the data.

    This is a hosted box so there was probably a version upgrade recently (only explination I can come up with). Any suggestions on what else I should use?

      It'll work, but not as you wish it to, because your XML is broken as tinita pointed out.

      Changing
          my $xml = '&lt;hdsso&gt;&lt;hpid&gt;-----...';
      to
          my $xml = '<hdsso><hpid>-----...';
      will not only fix your problem you asked about, it'll fix problems you haven't encountered yet. You say you're getting the data from someone else, so you'll have to convince this person to give you XML (he's currently not giving you XML) or try to fix it yourself with regexps (but you can never do a perfect job when fixing broken escapes).