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

Re: Getting the Attribute in an XML doc Element



HTTPAPI will pass the attributes to you as an array of pointers.  The 
array will look something like this:

attrs(1) = pointer to 'Accuracy'
attrs(2) = pointer to '8'
attrs(3) = *NULL

The idea is that you loop through the array of pointers until you 
encounter a *NULL pointer.  The *NULL signals the end.  The first 
pointer points to the attribute name, the second to the attribute value, 
the third to the 2nd attribute name, the fourth to the 2nd attribute 
value, etc.

If you had more than one attribute, such as

<AddressDetails Accuracy="8" Source="U" Code="X">
</AddressDetails>

Then the array would look more like this:

attrs(1) = pointer to 'Accuracy'
attrs(2) = pointer to '8'
attrs(3) = pointer to 'Source'
attrs(4) = pointer to 'U'
attrs(5) = pointer to 'Code'
attrs(6) = pointer to 'X'
attrs(7) = *NULL

hopefully you get the idea.   There's sample code of reading these 
attributes (getting the "version" attribute from an <rss version="x"> 
XML tag) in EXAMPLE15.


Scott Johnson wrote:
> Using HTTPAPI v1.21
> 
> Given the following XML section, how do I retrieve the 8 using Expat? I 
> glanced thru all the examples and just don't see a way to do it.
> 
>    <AddressDetails Accuracy="8">
>     ......
>    </AddressDetails>
> 
> Thanks,
>     Scott
-----------------------------------------------------------------------
This is the FTPAPI mailing list.  To unsubscribe, please go to:
http://www.scottklement.com/mailman/listinfo/ftpapi
-----------------------------------------------------------------------