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

Question on how to Parse an XML document??



   __________________
   All,
   I have two different types of XML documents coming back from a vendor
   and 1 of them I can not figure out how to parse so I can get the field
   names along with the values. This is my first time working with XML and
   parsing.
   I am using Scott's freeware for web interaction. We are pulling vehicle
   information from POLK web service and one of the XML's I get back and
   try to parse I only get values and not the Field names???  The other
   XML responses work fine but this one is giving me fits.
   NOTE: I am using everything straight from Scott's download except the
   program managing the user interface and using the command below for the
   parsing (shown below at bottom as    RC =)
   >
   >======================================================================
   =================
   > 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)
   >
   >======================================================================
   ====
   > This is one I can parse out when I get the HTML returned with no
   problems:
   >
   > <MakeList>
   > - <Make>
   >    <code>ACU</code>
   >    <description>ACURA</description>
   >    </Make>
   > - <Make>
   >    <code>AML</code>
   >    <description>AMERICAN LA FRANCE</description>
   >    </Make>
   > - <Make>
   >    <code>AST</code>
   >    <description>ASTON MARTIN</description>
   >    </Make>
   > - <Make>
   >
   > I get the field name (code) and the value of (ACU) and I get the
   field(description) and the value (ACURA) and so on.
   >
   >
   >
   > Here is the command I am using for both requests in my program:
   >
   > rc = http_url_get_xml( uri: *null: %paddr(PARSERTRNXML): *null);
   >
   >
   >
   > Could you please explain what the difference is and how I should go
   about handling this so I get the field name back? I need it because
   they can change this XML at anytime and I need to find the exact field
   name to move it to the proper fields in program.
   >
   >
   > Thanks in advance for any insight you can give me.
   >
   >
   > George
   >
   >
-----------------------------------------------------------------------
This is the FTPAPI mailing list.  To unsubscribe, please go to:
http://www.scottklement.com/mailman/listinfo/ftpapi
-----------------------------------------------------------------------