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

RE: Question on how to Parse an XML document??



>=======================================================================================
> Example of problem XML that does not return the field name:
>
>    <fields name="LPM_LIABILITY_SYMBOL">295</fields>
>    <fields name="LPM_LIABILITY_SYMBOL_2008">295</fields>
>    <fields name="LPM_LIABILITY_SYMBOL_2010">295</fields>
>    <fields name="LPM_LIABILITY_SYMBOL_2012">285</fields>
>    <fields name="LPM_LIABILITY_SYMBOL_2014" />
>    <fields name="LPM_LIABILITY_SYMBOL_2016" />
>    <fields name="LPM_PIP_MED_PAY_SYMBOL">490</fields>
>    <fields name="LPM_PIP_MED_PAY_SYMBOL_2008">490</fields>
>    <fields name="LPM_PIP_MED_PAY_SYMBOL_2010">490</fields>
>    <fields name="LPM_PIP_MED_PAY_SYMBOL_2012">475</fields>
>    <fields name="LPM_PIP_MED_PAY_SYMBOL_2014" />
>    <fields name="LPM_PIP_MED_PAY_SYMBOL_2016" />
>
> Looking at LPM_LIABILITY_SYMBOL ---- I do not get back the field name 
(LPM_LIABILITY_SYMBOL) all I get in the field name is (fields) and then 
the value of (295)


That is not the "field name". That is an attribute called name. So you need to parse the attribute "name". See EXAMPLE11.

Something like this...

if (name = 'fields');                                        
   myValue = value;  // ie 295 
   count = 1;                                             
   dow http_nextXmlAttr(attrs: count: attrname: attrval); // this would loop for multiple attributes but you only have 1
      if (attrname = 'name');  
         myField = attrval;  // ie LPM_LIABILITY_SYMBOL                                                
      endif;              
   enddo; 
endif; 
-----------------------------------------------------------------------
This is the FTPAPI mailing list.  To unsubscribe, please go to:
http://www.scottklement.com/mailman/listinfo/ftpapi
-----------------------------------------------------------------------