List Info

Thread: Re: XmlParser errors and help




Re: XmlParser errors and help
country flaguser name
United States
2007-03-01 14:18:30
I'll take another snapshot and try it again...

tony 

-----Original Message-----
From: google-checkout-api-integrationgooglegroups.com
[mailto:google-checkout-api-integrationgooglegroups.com] On Behalf Of
GoogleCheckoutDevPro
Sent: Wednesday, February 28, 2007 10:12 PM
To: Google Checkout Developers Forum - API Integration
Basics
Subject: [google-checkout-api-integration] Re: XmlParser
errors and help


Hi Tony,

Unfortunately(?), I'm unable to reproduce this error.

I took your XML example and executed the following without
any
modifications to the XmlParser class:

   $myXml = new XmlParser($xml);
   print_r($myXml->GetData());


Here's the result:

(
    [fdxsubscriptionreply] => Array
        (
            [xmlnssi]
=> http://www.
w3.org/2001/XMLSchema-instance
            [xsi:nonamespaceschemalocation] =>
FDXSubscriptionReply.xsd
            [replyheader] => Array
                (
                    [customertransactionidentifier] =>
Array
                        (
                            [VALUE] => Meter Request
                        )

                )

            [error] => Array
                (
                    [code] => Array
                        (
                            [VALUE] => 5012
                        )

                    [message] => Array
                        (
                            [VALUE] => Account number not
in database
                        )

                )

        )

)

FYI, the XmlParser is what's available in the
svn/trunk/library/xml-
processing/xmlparser.php

Thanks,
Jacob

On Feb 28, 10:31 am, "Tony Birnseth" <t...1sit.com> wrote:
> Jacob,
>
> I've been trying to use the XmlParser on xml generated
outside of GC.
> I've run into some problems and am looking for some
help with the code

> methodology....
>
> Can you point me at someone and/or help diagnose the
problems below?
> Please help.  The code is nice and compact and succinct
but hard to 
> diagnose.
>
> The following XML (formatted for screen) generates a
'value' Undefined

> index error:
>         <?xml version="1.0"
encoding="UTF-8"?>
>         <FDXSubscriptionReply
> xmlnssi=&q
uot;http:
//www.w3.org/2001/XMLSchema-instance"
>
xsi:noNamespaceSchemaLocation="FDXSubscriptionReply.xsd
">
>           <ReplyHeader>
>             <CustomerTransactionIdentifier>
>               Meter Request
>             </CustomerTransactionIdentifier>
>           </ReplyHeader>
>           <Error>
>             <Code>5012</Code>
>             <Message>
>                   Account number not in database
>             </Message>
>           </Error>
>         </FDXSubscriptionReply>
>
> Additionally, the <Error> tag is skipped!
>
> I'm stumped.  I guess there's three points:
> 1) the undefined index (I changed the line to a ternary
operator 
> conditional upon an isset().  I.e.:
> $value = isset($vals[$this->global_index]['value'])
?
> trim($vals[$this->global_index]['value']) : '';
>
> 2) In the last line of the UpdateRecursive() function
the 'return 
> $param' can also generate an 'undefined variable'
run-time error.  I 
> have initialized it in the first line to be $param =
array().  Problem
> #1 and #3 still exist with/without this change.
>
> 3) The failure of the parser to see the <Error>
tag (huge issue, what 
> else is it missing?).  The resultant $data returned is
(note that
'code'
> and 'message' should be elements (sub-arrays) of
'error'):
> data:Array
> (
>     [fdxsubscriptionreply] => Array
>         (
>             [xmlnssi]
=>http://www.
w3.org/2001/XMLSchema-instance
>             [xsi:nonamespaceschemalocation] =>
FDXSubscriptionReply.xsd
>             [replyheader] => Array
>                 (
>                     [customertransactionidentifier]
=> Array
>                         (
>                             [VALUE] => Meter
Request
>                         )
>
>                 )
>
>             [code] => Array
>                 (
>                     [VALUE] => 5012
>                 )
>
>             [message] => Array
>                 (
>                     [VALUE] => Account number not in
database
>                 )
>
>         )
>
> )






--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the
Google Groups "API Integration Basics" group.
To post to this group, send email to
google-checkout-api-integrationgooglegroups.com
To unsubscribe from this group, send email to
google-checkout-api-integration-unsubscribegooglegroups.com
For more options, visit this group at http://groups.google.com/group/google-checko
ut-api-integration?hl=en
-~----------~----~----~----~------~----~------~--~---


[1]

about | contact  Other archives ( Real Estate discussion Medical topics )