Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
XMLtoCursor Issue
Message
De
02/12/2009 04:51:17
Cetin Basoz
Engineerica Inc.
Izmir, Turquie
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Versions des environnements
Visual FoxPro:
VFP 9 SP2
Divers
Thread ID:
01437226
Message ID:
01437237
Vues:
82
>I have a new module in my racing software that wil get info from the web via XML Files. Since I have never used this type of data I looked up help on XMLtoCursor and tried it.
>
>The file starts out like this:
>
><?xml version="1.0"?>
><TimeSlip xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
>  <TimeStamp>20091111130758</TimeStamp>
>  <Category>CUSTOMER RACE</Category>
>  <Rnd>Q</Rnd>
>  <Bump />
>  <Left>
>    <QualPos>0</QualPos>
>    <CarNumber>1</CarNumber>
>    <Name />
>    <ClassName />
>    <ClassIndex />
>    <DialIn />
>    <RT>.350</RT>
>    <ft60>2.453</ft60>
>    <ft330>6.712</ft330>
>    <ft660>10.200</ft660>
>    <mph660>70.73</mph660>
>    <ft1000>13.171</ft1000>
>    <mph1000 />
>    <ft1320>15.659</ft1320>
>    <mph1320>90.47</mph1320>
>    <MOV />
>    <Win />
>  </Left>
>
>
>the info in the XML file goes on and on from there.
>
>
>
>I must have it wrong, the code I used is:
>XMLtoCursor( "LiveTiming.XML","test.xml","csrLiveTiming",0)
>
>
>I get an error that says XML Parse Error Invalid at top level Line 1 position 1
>
>Then changing the code around I get too many arguments.
>
>
>What silly thing am I missing?

Don,
In your code you missed the flag 512 (source is file flag) but anyway it wouldn't work. That XML is incompatible with XMLToCursor. XMLToCursor expects an XML with this structure:
< data_table >
   < row >
        < field >< /field >
        < field >< /field >
   < /row >
< /data_table >
This is illustrative, fields can be attributes instead of tags but general layout is that you need a root ( data_table the table IOW ), rows and fields. You can use XMLAdapter instead or MSXML2.DomDocument parsing. Another alternative would be to do some processing of the XML with StrExtract() and make it XMLToCursor() compatible in parts.
Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform