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

Re: XML_Parse ended in error



Vlad,

Before attemping to modify the expat parser I would strongly suggest to 
first verify the xml string you received.

It is easiest to first receive the response in a IFS file, and than to parse 
the stream file.

Also then you can check the stream fle by openig it in the windows explorer. 
If the file contains an error it wil show this in the browser, including the 
position of the erronous character.

Kind regards,

Loek Maartens.


----- Original Message ----- 
From: "Jason Baker" <JasonB@xxxxxxxxxx>
To: "HTTPAPI and FTPAPI Projects" <ftpapi@xxxxxxxxxxxxxxxxxxxxxx>
Sent: Wednesday, October 07, 2009 4:28 PM
Subject: RE: XML_Parse ended in error


> Vlad,
>
> The "disclaimer", I don't know how this would affect the other "C"
> programs nor do I know much about "C".
>
> With that said, yes those are the two lines I had in question.  However;
> I don't know that I would set it to exactly 2,348, I used 3,072 which is
> 1,024 * 3.
>
> The other line in question is #define INIT_TAG_BUF_SIZE 32.  I say that
> because of the /* must be a multiple of sizeof(XML_Char) at the end of
> it.  It seems like XML_Char might be the actual string but I don't
> really know.
>
>
>
> -----Original Message-----
> From: ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx
> [mailto:ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx] On Behalf Of Vladimir
> Vayntraub
> Sent: Wednesday, October 07, 2009 9:52 AM
> To: 'HTTPAPI and FTPAPI Projects'
> Subject: RE: XML_Parse ended in error
>
> Just making sure:
>
> In XMLPARSE.C
>
> Instead of
>
> #define INIT_DATA_BUF_SIZE 1024
>
> #define INIT_BUFFER_SIZE 1024
>
> Will be:
>
> #define INIT_DATA_BUF_SIZE 2348
>
>
> #define INIT_BUFFER_SIZE 2348
>
> Is this correct?
>
>
>
>
>
> -----Original Message-----
> From: ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx
> [mailto:ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx] On Behalf Of Jason Baker
> Sent: Wednesday, October 07, 2009 9:23 AM
> To: HTTPAPI and FTPAPI Projects
> Subject: RE: XML_Parse ended in error
>
>
>
> Vlad,
>
>
>
> I do not know "C" that much either, but it appears that there is a 1,024
>
> size for the data and the data that is in <Restrictions> is 2,348.  That
>
> 1,024 size could be buffer and it may be more related to the 32 size.
>
>
>
> In short, that sure seems like a large amount of data to be sending back
>
> in an XML document.  However; my comments doesn't help your problem.
>
>
>
> Again, not knowing much about "C" myself or how all the other programs
>
> work together, but you could possibly experiment by changing the 1,024
>
> to 3,072 and see if that works if it is data or change 32 to something
>
> bigger.
>
>
>
> That is just my "two cents".  If it doesn't work, you can just change it
>
> back and re-compile.
>
>
>
>
>
>
>
> -----Original Message-----
>
> From: ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx
>
> [mailto:ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx] On Behalf Of Vladimir
>
> Vayntraub
>
> Sent: Wednesday, October 07, 2009 8:48 AM
>
> To: 'HTTPAPI and FTPAPI Projects'
>
> Subject: RE: XML_Parse ended in error
>
>
>
> Hi Scott,
>
> I did not have time to troubleshoot my problem with getting USPS rates
>
> parsed through EXPAT/XML_parser, had other thing to work on first.
>
> It takes a dump on statement 2433 in EXPAT in "C" Module "XMLPARSE.C" on
>
> character data handling routine.
>
> I don't know "C" and didn't have any error logs, so there was nothing
>
> for me
>
> to post. It blows up on the <Restrictions> field in XML.
>
> May be there's field size issue.
>
> Please, help.
>
> Thanks
>
>
>
> -----Original Message-----
>
> From: ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx
>
> [mailto:ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx] On Behalf Of Scott
>
> Klement
>
> Sent: Wednesday, September 30, 2009 1:01 PM
>
> To: HTTPAPI and FTPAPI Projects
>
> Subject: Re: XML_Parse ended in error
>
>
>
>
>
>   hi Vlad,
>
>   I can't see any reason why this XML wouldn't parse properly.  How are
>
>   you trying to parse it?  Presumably with HTTPAPI, since you posted it
>
>   to this mailing list.  Is that correct?
>
>   When it fails, what errors do you receive?
>
>   Vladimir Vayntraub wrote:
>
>
>
>   First time post for me.
>
>
>
>
>
>   Every time I try to get USPS rates for APO zip code, Parser ends in
>
>   error.
>
>
>
>   I suspect, it has a single quotes in Restrictions field.
>
>
>
>   Below is a xml document I'm getting from usps:
>
>
>
>
>
>     <?xml version="1.0" ?>
>
>
>
>   [1]- <RateV2Response>
>
>
>
>   [2]- <Package ID="1">
>
>
>
>     <ZipOrigination>43000</ZipOrigination>
>
>
>
>     <ZipDestination>96555</ZipDestination>
>
>
>
>     <Pounds>3</Pounds>
>
>
>
>     <Ounces>0</Ounces>
>
>
>
>     <Size>REGULAR</Size>
>
>
>
>     <Machinable>TRUE</Machinable>
>
>
>
>     <Zone>8</Zone>
>
>
>
>   [3]- <Postage>
>
>
>
>     <MailService>Priority Mail</MailService>
>
>
>
>     <Rate>11.95</Rate>
>
>
>
>     </Postage>
>
>
>
>   [4]- <Postage>
>
>
>
>     <MailService>Priority Mail Flat-Rate Envelope</MailService>
>
>
>
>     <Rate>4.95</Rate>
>
>
>
>     </Postage>
>
>
>
>   [5]- <Postage>
>
>
>
>     <MailService>Priority Mail Small Flat-Rate Box</MailService>
>
>
>
>     <Rate>4.95</Rate>
>
>
>
>     </Postage>
>
>
>
>   [6]- <Postage>
>
>
>
>     <MailService>Priority Mail Regular/Medium Flat-Rate
>
>   Boxes</MailService>
>
>
>
>     <Rate>10.35</Rate>
>
>
>
>     </Postage>
>
>
>
>   [7]- <Postage>
>
>
>
>     <MailService>Priority Mail Large Flat-Rate Box</MailService>
>
>
>
>     <Rate>11.95</Rate>
>
>
>
>     </Postage>
>
>
>
>   [8]- <Postage>
>
>
>
>     <MailService>Parcel Post</MailService>
>
>
>
>     <Rate>9.92</Rate>
>
>
>
>     </Postage>
>
>
>
>   [9]- <Postage>
>
>
>
>     <MailService>Bound Printed Matter</MailService>
>
>
>
>     <Rate>3.75</Rate>
>
>
>
>     </Postage>
>
>
>
>   [10]- <Postage>
>
>
>
>     <MailService>Media Mail</MailService>
>
>
>
>     <Rate>3.16</Rate>
>
>
>
>     </Postage>
>
>
>
>   [11]- <Postage>
>
>
>
>     <MailService>Library Mail</MailService>
>
>
>
>     <Rate>3.00</Rate>
>
>
>
>     </Postage>
>
>
>
>     <Restrictions>A1. Mail addressed to 'Any Servicemember' or similar
>
>   wording such as 'Any Soldier, Sailor, Airman or Marine', 'Military
>
>   Mail', etc., is prohibited. Mail must be addressed to an individual
>
> or
>
>   job title, such as 'Commander', 'Commanding Officer', etc. B. Form
>
>   2976-A required for all mail weighing 16 ounces or more, with
>
>   exceptions noted below. In addition, mailers must properly complete
>
>   required customs documentation when mailing any potentially dutiable
>
>   mail addressed to an APO or FPO regardless of weight. The following
>
>   are exceptions to the requirement for customs documentation on
>
>   non-dutiable mail weighing 16 oz. or more: B. a. Known mailers (those
>
>   legally applying a permit imprint to a mailpiece) are exempt from
>
>   providing customs documentation on non-dutiable letters and printed
>
>   matter weighing 16 oz. or more. Mail with meter postage is not
>
>   considered to be from a known mailer. B. b. Federal, state, and local
>
>   government agencies are exempt from providing customs documentation,
>
>   except on mail to APOs/FPOs to which restriction B2 applies. B. c.
>
>   Prepaid mail from military contractors is exempt, providing mailpiece
>
>   is endorsed 'Contents for Official Use-Exempt from Customs
>
>   Requirement'. B1. Form 2976 or 2976-A required. Articles liable for
>
>   customs duty and/or purchase tax unless bona fide gifts intended for
>
>   use by military personnel or their dependents. When contents of a
>
>   parcel meet these requirements, mailer must endorse customs form,
>
>   'Certified to be a bona fide gift, personal effects, or items for
>
>   personal use of military personnel and dependents', under the
>
> heading,
>
>   Description of Contents. Exceptions: All exceptions listed in
>
>   restriction B are applicable to this restriction. F. Firearms of any
>
>   type are prohibited in all classes of mail. See definitions of
>
>   firearms in DMM 601.11.1.2c. This restriction does not apply to
>
>   firearms mailed to or by official U.S. government agencies. The
>
>   restriction for mail to this ZIP Code does not apply to firearms
>
>   mailed from this ZIP Code, provided ATF and USPS regulations are met.
>
>   Antique firearms are a separate category defined in DMM 601.11.2 and
>
>   ATF regulations; they do not require an ATF form. M. Fruits, animals,
>
>   and living plants are prohibited. V. Express Mail Military Service
>
>   (EMMS) not available.</Restrictions>
>
>
>
>     </Package>
>
>
>
>     </RateV2Response>
>
>
>
>     Any help greatly appreciated.
>
>
>
>   Thanks.
>
>
>
>   Vladimir
>
>
>
> References
>
>
>
>   1.
>
> [1]file://localhost/\\192.168.254.241\tmp\DSP_KWA1KENT2186120USPS.xml##
>
>   2.
>
> [2]file://localhost/\\192.168.254.241\tmp\DSP_KWA1KENT2186120USPS.xml##
>
>   3.
>
> [3]file://localhost/\\192.168.254.241\tmp\DSP_KWA1KENT2186120USPS.xml##
>
>   4.
>
> [4]file://localhost/\\192.168.254.241\tmp\DSP_KWA1KENT2186120USPS.xml##
>
>   5.
>
> [5]file://localhost/\\192.168.254.241\tmp\DSP_KWA1KENT2186120USPS.xml##
>
>   6.
>
> [6]file://localhost/\\192.168.254.241\tmp\DSP_KWA1KENT2186120USPS.xml##
>
>   7.
>
> [7]file://localhost/\\192.168.254.241\tmp\DSP_KWA1KENT2186120USPS.xml##
>
>   8.
>
> [8]file://localhost/\\192.168.254.241\tmp\DSP_KWA1KENT2186120USPS.xml##
>
>   9.
>
> [9]file://localhost/\\192.168.254.241\tmp\DSP_KWA1KENT2186120USPS.xml##
>
>  10.
>
> [10]file://localhost/\\192.168.254.241\tmp\DSP_KWA1KENT2186120USPS.xml##
>
>  11.
>
> [11]file://localhost/\\192.168.254.241\tmp\DSP_KWA1KENT2186120USPS.xml##
>
>
>
>
>
> _______________________________________________________________________
>
>
>
> -----------------------------------------------------------------------
>
> This is the FTPAPI mailing list.  To unsubscribe, please go to:
>
> [12]http://www.scottklement.com/mailman/listinfo/ftpapi
>
> -----------------------------------------------------------------------
>
>
>
> References
>
>
>
>   1.
>
> file://localhost/\\192.168.254.241\tmp\DSP_KWA1KENT2186120USPS.xml##
>
>   2.
>
> file://localhost/\\192.168.254.241\tmp\DSP_KWA1KENT2186120USPS.xml##
>
>   3.
>
> file://localhost/\\192.168.254.241\tmp\DSP_KWA1KENT2186120USPS.xml##
>
>   4.
>
> file://localhost/\\192.168.254.241\tmp\DSP_KWA1KENT2186120USPS.xml##
>
>   5.
>
> file://localhost/\\192.168.254.241\tmp\DSP_KWA1KENT2186120USPS.xml##
>
>   6.
>
> file://localhost/\\192.168.254.241\tmp\DSP_KWA1KENT2186120USPS.xml##
>
>   7.
>
> file://localhost/\\192.168.254.241\tmp\DSP_KWA1KENT2186120USPS.xml##
>
>   8.
>
> file://localhost/\\192.168.254.241\tmp\DSP_KWA1KENT2186120USPS.xml##
>
>   9.
>
> file://localhost/\\192.168.254.241\tmp\DSP_KWA1KENT2186120USPS.xml##
>
>  10.
>
> file://localhost/\\192.168.254.241\tmp\DSP_KWA1KENT2186120USPS.xml##
>
>  11.
>
> file://localhost/\\192.168.254.241\tmp\DSP_KWA1KENT2186120USPS.xml##
>
>  12. 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
>
> -----------------------------------------------------------------------
>
>
>
> -----------------------------------------------------------------------
>
> 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
>
> -----------------------------------------------------------------------
>
> -----------------------------------------------------------------------
> 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
-----------------------------------------------------------------------