Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
XML empty manipulation
Message
 
À
20/09/2001 02:27:53
Information générale
Forum:
Visual FoxPro
Catégorie:
Applications Internet
Divers
Thread ID:
00558610
Message ID:
00558626
Vues:
26
You need to check for that checking the XML. THe easiest is by loading the XML into the XMLDOM and checking for the various data keys. if they're not there the request data is empty.

IF the data generated contains a schema (CURSORTOXML schema that is) then the cursor always is created... if not - well you may have problems (see below).

Actually after you mentioned this I tried a few things and found some interesting results. None of them crashed VFP, but some of them have left me scratching my head on what's going on with the schema generation.
SELECT * from tt_cust WHERE .F. into CURSOR TQuery

lcXML = ""
CURSORTOXML("TQuery","lcxml",1,48,0,"0")

?  lcXML  && Empty XML Document - no schema

CLOSE DATA

XMLTOCURSOR(lcXML,"TCustomers")

BROWSE  && Works with new structure????
To my surprise this actually worked. I'm not sure how VFP is figuring out how to create the cursor in the code above when the XML is basically empty...

+++ Rick ---








>In this code:
>
>
>* Directly get an XMLDOM object
>loXML=loHTTP.ResponseXML
>
>* Check for error
>IF EMPTY(loXML.XML)
>   MESSAGEBOX(loHTTP.ResponseBody)
>   RETURN
>ENDIF
>
>XMLToCursor(loXML.XML,'Temp')
>SELECT Temp
>BROWSE
>
>
>If the XML object contains an empty cursor, that will make XMLToCursor() to generate an error. Well, the reaction of VFP is quite severe as it closes VFP. It makes sense however that it can't show the cursor as the XML only contains the cursor name. From the server side, I generate the cursor no matter if it contains records or not. On the client side, as the XML contains the cursor name, it will not go into the error which is displaying a messagebox. However, when continuing to XMLToCursor(), a situation occurs as it can't display the cursor. How can I detect if I have an empty cursor? Or, basically, is it better to send the structure all the time when generating the XML so XMLToCursor() will always work even if no record is part of it as it will always knows how to build the cursor from the data structure?
+++ Rick ---

West Wind Technologies
Maui, Hawaii

west-wind.com/
West Wind Message Board
Rick's Web Log
Markdown Monster
---
Making waves on the Web

Where do you want to surf today?
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform