[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Xml parsing error, XML parse failed at line 1, col 0: no element found



Hi Bruce,

You've specified "encoding=UTF-8" in your XML document.  UTF-8 is a 
Unicode encoding that states that invariant characters will have the 
same hex values in UTF-8 that they do in ASCII, and that other (variant) 
characters will have special values, potentially multi-byte.

However, you appear to be passing EBCDIC data to the parser.

Since EBCDIC and Unicode/ASCII are NOT THE SAME THING the XML parser 
won't work.  It tries to read the first character (which by XML 
standards HAS to be the < character) and can't read it because it's in 
EBCDIC, so it gives you an error saying that no XML element is found in 
the first column of the first line.

That's your immediate problem.

I'm also worried about the fact that you're passing this as a string 
from the command-line, and it's more than 32 bytes long.  I hope you 
have a way to deal with that?


Bruce McDougald wrote:
>    I'm getting this when trying to parse a simple xml document:
> 
>    <?xml version="1.0"
>    encoding="UTF-8"?><ChAcctResponse><AccountNumber>0232100016</AccountNu
>    mber><CardNumber>00000000100012</CardNumber><ReasonCode>0</ReasonCode>
>    </ChAcctResponse>
> 
>    I'm feeding it in from the command line like this:
> 
>     ===> call xmlparse '<?xml version="1.0"
>    encoding="UTF-8"?><ChAcctResponse><Acco
>    untNumber>0232100016</AccountNumber><CardNumber>00000000100012</CardNu
>    mber><Reas
>    onCode>0</ReasonCode></ChAcctResponse>'
> 
>    I distilled it down to that because I'm hoping to use HTTPAPI in a
>    production web service client and I'm getting the same error there.
>    I'm using http_url_get_raw, and parsing the xml reply with
>    http_parse_xml_string.  Here's my invocation of that:
> 
>         c                   eval      rc =
>    http_parse_xml_string(%addr(retdata)
>         c                                     :%len(%trim(retdata))
>         c                                     :HTTP_XML_CALC
>         c                                     :%paddr(FVchangeXML)
>         c                                     :*null
>         c                                     :*null)
> 
>    From just eyeballing the xml in debug, I can't find any problems with
>    it.  What am I missing?
> 
>    Bruce McDougald
>    Compass Technologies
>    75 Maddox Rd., Ste 104
>    Buford, GA 30518
>    Office: 770-904-0488
>    Fax: 770-904-0411
>    bruce.mcdougald@xxxxxxxxxxxxxxxxxxxxxxxx
> 
> 
> 
> ------------------------------------------------------------------------
> 
> -----------------------------------------------------------------------
> This is the FTPAPI mailing list.  To unsubscribe, please go to:
> http://www.scottklement.com/mailman/listinfo/ftpapi
> -----------------------------------------------------------------------

-----------------------------------------------------------------------
This is the FTPAPI mailing list.  To unsubscribe, please go to:
http://www.scottklement.com/mailman/listinfo/ftpapi
-----------------------------------------------------------------------