Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Error 1943
Message
From
26/07/2022 17:35:01
Antonio Lopes (Online)
BookMARC
Coimbra, Portugal
 
 
To
26/07/2022 14:32:20
Luis Santos
Biglevel-Soluções Informáticas, Lda
Portugal
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
Miscellaneous
Thread ID:
01684725
Message ID:
01684734
Views:
47
Hi, Luís,

>
>
>m.OROOT.selectNodes("Documento/dataobra").item(0).text 
>
>When i must used .item(x), always ? and it´s refer to content of my xml Tag ?

When you call the selectNodes method, you get in return a list of nodes. item(0) refers to the first element of the list (which will be .NULL., in case of a list of length zero), and item(0).text refers to the textual contents of the element (that may even be a complex element, comprising a segment of the XML tree and various sub-elements).

>Could you post a very, very smal example about using : verify the length of a node selection.
m.nodelist = m.OROOT.selectNodes("Documento/dataobra")
IF m.nodelist.length == 0
  *  the element does not exist
  * deal with it
ELSE
  * get the value from the first element of the list of selected nodes 
  m.dataobra = m.nodelist.item(0).text
ENDIF
(of course, you may define a function to ease the repetition of the construction).

Hope it helps!
----------------------------------
António Tavares Lopes
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform