Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
XmlDOM question
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Web Services
Titre:
Divers
Thread ID:
00661986
Message ID:
00662043
Vues:
24
>Hi Antonio
>I created a new thread since this is a new question about the xmldom. As i told you previously, your solution solved the problem for me.
>I have implemented a web service that receives an xml string as parameter ( the file that you saw in previous threads ). I used your code to browse through the nodes and retrieve the data, and i still have one problem.
>My code looks something like this:
>
>...
>loRoot = loXML.documentElement
>IF !ISNULL(loRoot)
>  * read and display country code
>  loElm = loRoot.selectSingleNode("Country") && note the big C
>  if type( 'loElm' ) = 'O'
>    lcCountry = loElm.text
>  else
>    ComReturnError('myclass', 'cannot find country node')
>  endif
>endif
>
>From the client's side, they always get the following error: loElm is not an object. Of course, this error appears because of the case mismatch in the field name. According to the programmer in the client side, this is the error generated by selectSinglenode when it doesn't find the field, and that's why i checked on loElm type before using it. Any ideas why this happens?

selectSingleNode returns a .NULL. in case the query produces no results. I believe the error message, issued in the lcCountry assignment instruction, is misleading: it should say something like 'loElm is a NULL object' (since its type is O). Your checking code should be
  if !isnull(loElm)
    lcCountry = loElm.text
  else
    ComReturnError('myclass', 'cannot find country node')
  endif
----------------------------------
António Tavares Lopes
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform