Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
XML to tables?
Message
De
04/12/2007 15:07:58
 
 
À
04/12/2007 14:24:07
Elyse Pomerantz
Dynamic Data Concepts, Inc.
Brooklyn, New York, États-Unis
Information générale
Forum:
Visual FoxPro
Catégorie:
XML, XSD
Titre:
Divers
Thread ID:
01273112
Message ID:
01273138
Vues:
22
It doesn't exactly ignore them, but it doesn't treat them as related tables (which is what I assume they are?). It concatenates the information in the segment into a field called 'segment'.

I don't know a simple way to create a related tables from a single xml file. There aren't really pk and fk fields in the xml file, so they'd have to be created on the fly. I suppose you could use xmltocursor to get the information into one table and then use some vfp coding to add a pk and parse the 'segment' field into a related table.

That's not to say, of course, that Sergey won't be able to come up with some magic.

>I tried that - the problem is that my file has "sub-files." For example, within the "CLASS" section there are multiple "SEGMENTS." The XMLTOCURSOR ignores the sub-sections.
>
>>If you get rid of that space before the '?' near the end of the first line and dump the dashes that begin some of the lines, you can use:
>>
>>
XMLTOCURSOR('xmlfile.xml',"xmlcursor",512+1024)
>>
>>
>>>I haven't really worked with XML at all but now I need to get an XML file into VFP tables (and back). My XML file looks something like this (very simplified) - where do I start?
>>>
>>>
>>><?xml version="1.0" encoding="windows-1252" ?>
>>>   - <BATCH_FILE>
>>>      - <CLASS>
>>>           <ACTION>ADD</ACTION>
>>>           <CLASS_CODE>ADY2107</CLASS_CODE>
>>>           <CLASS_START_DATE>2006/01/19</CLASS_START_DATE>
>>>           <CLASS_END_DATE>2006/06/15</CLASS_END_DATE>
>>>           <CLASS_TYPE>NA</CLASS_TYPE>
>>>           <LANGUAGE_TYPE>E</LANGUAGE_TYPE>
>>>           <CLASSROOM_TYPE>1</CLASSROOM_TYPE>
>>>         - <SEGMENT>
>>>              <ACTION>ADD</ACTION>
>>>              <MINISTRY_DFND_CRS>SBI3C</MINISTRY_DFND_CRS>
>>>              <LOCAL_DEV_CRS />
>>>              <CREDIT_VALUE>01.00</CREDIT_VALUE>
>>>           </SEGMENT>
>>>         - <SEGMENT>
>>>              <ACTION>ADD</ACTION>
>>>              <MINISTRY_DFND_CRS>SBI3U</MINISTRY_DFND_CRS>
>>>              <LOCAL_DEV_CRS />
>>>              <CREDIT_VALUE>01.00</CREDIT_VALUE>
>>>           </SEGMENT>
>>>      </CLASS>
>>>    - <CLASS>
>>>           <ACTION>ADD</ACTION>
>>>           <CLASS_CODE>ADY2109</CLASS_CODE>
>>>           <CLASS_START_DATE>2005/09/06</CLASS_START_DATE>
>>>           <CLASS_END_DATE>2006/06/15</CLASS_END_DATE>
>>>           <CLASS_TYPE>NA</CLASS_TYPE>
>>>           <LANGUAGE_TYPE>E</LANGUAGE_TYPE>
>>>           <CLASSROOM_TYPE>1</CLASSROOM_TYPE>
>>>         - <SEGMENT>
>>>              <ACTION>ADD</ACTION>
>>>              <MINISTRY_DFND_CRS>SNC2D</MINISTRY_DFND_CRS>
>>>              <LOCAL_DEV_CRS />
>>>              <CREDIT_VALUE>01.00</CREDIT_VALUE>
>>>           </SEGMENT>
>>>         - <SEGMENT>
>>>              <ACTION>ADD</ACTION>
>>>              <MINISTRY_DFND_CRS>SNC2P</MINISTRY_DFND_CRS>
>>>              <LOCAL_DEV_CRS />
>>>              <CREDIT_VALUE>01.00</CREDIT_VALUE>
>>>           </SEGMENT>
>>>      </CLASS>
>>>  </BATCH_FILE>
>>>
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform