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

Re: Example16



Hi Fernando,

There ar many examples of handling XML documents like this in HTTPAPI. 
It would help me tremendously if you'd explain why those examples didn't 
answer your question...   that'll help me to provide better examples in 
the future.

As I said in my last message, your 'Incoming' procedure (which can be 
named anything you like, it doesn't have to be Incoming -- that's just 
the example I used) is called separately for each XML element.

So given your XML document:

<return><pendientes>2</pendientes><total>3</total></return>

The 'Incoming' procedure will be called 3 times.

First it's called with these parameters:
     depth = 2
     name = 'pendientes'
     path = '/return'
     value = '2'
     attrs = *null

Second call has these parameters:
     depth = 2
     name = 'total'
     path = '/return'
     value = '3'
     attrs = *null

Third call has these parameters:
     depth = 1
     name = 'return'
     path = '/'
     value = ''
     attrs = *null

So there's only one value per call, but all of the values are supplied. 
  Then _you_ need to write the logic that saves these values to a 
variable.  You might do something like this:

     if name = 'pendientes';
         myPend = value;
     endif;
     if name = 'total';
         myTotal = value;
     endif;

There are other examples of this inside HTTPAPI's EXAMPLE members. Let 
me know what would help you understand them.

Thanks!


On 9/9/2010 7:31 PM, Fernando wrote:
>
>     Dear Mr. Scott:
>
>
>
>     In the response the XML has:
>
>
>
>     <return><pendientes>2</pendientes><total>3</total></return>
>
>
>
>     How can I get both tags in the incoming routine?
>
>
>
>     I'm using a copy of the EXAMPLE16 current beta.
>
>
>
>     Thanks you for your help
>
>
>
>
>
>     2010/9/9 Scott Klement<[1]sk@xxxxxxxxxxxxxxxx>
>
>       Hi Fernando,
>
>     >
>     >  How can I get more than one value in de Incoming?
>     >
>
>       Assuming you mean the "Incoming" subprocedure of EXAMPLE18 (current
>       release) or EXAMPLE16 (current beta) then there's only one value
>       per
>       call, because it's only physically possible for each XML element to
>       have
>       one value.
>       The routine is called multiple times, once for each XML element.
>       When
>       called, HTTPAPI passed you information describing which element it
>       parsed, what the value (character data) of that element is, and
>       what the
>       attributes are.
>       Since XML elements never have more than one character data, the
>       'value'
>       parameter can only be passed once per element.
>       So I guess I'm not sure what you're asking...
>       If you're looking for a more sophisticated XML parsing example,
>       check
>       out the UPS tracking example (EXAMPLE16 in current release,
>       EXAMPLE14 in
>       current beta)
>       -------------------------------------------------------------------
>       ----
>       This is the FTPAPI mailing list.  To unsubscribe, please go to:
>       [2]http://www.scottklement.com/mailman/listinfo/ftpapi
>       -------------------------------------------------------------------
>       ----
>
> References
>
>     1. mailto:sk@xxxxxxxxxxxxxxxx
>     2. 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
-----------------------------------------------------------------------