Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Error 1943
Message
From
26/07/2022 11:08:31
 
 
To
26/07/2022 07:42:13
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:
01684732
Views:
71
>Help for that error is at https://www.vfphelp.com/vfp9/html/67b93d18-f569-4129-bf5c-bc84ef3f5b02.htm
>Maybe:
>- you have a syntax error or typo in that line
>- your code at that point expects a certain child node to exist, but it does not
>
>What is the source for line 86?
>
>Hi Al,
>
>Thanks for your reply, i attach my xml file, could you please take a look !
>
>Best regards,
>LS

Luís, a few points in your code and environment that you'd better address, taking the XML into consideration.

You're fetching data from the XML document based on the position of elements. For instance,
		m.dataobra = M.OROOT.CHILDNODES(1).CHILDNODES(0).Text
means that you're requesting the first child of the second child of the document element (which is, in your case, "VFPDataSet"). In the XML DOM, items are referenced by base 0, so that the first member of a node list is 0, the second is 1, and so on.

VFPDataSet has only one child, "Documento". So the above line is the first to issue an error.

I would advise three things.

First, reference the data using the name of the elements, irrespective of their ordinal position (unless it is relevant). For instance, the above instruction could be rewritten this way:
		m.dataobra = m.OROOT.selectNodes("Documento/dataobra").item(0).text
Second, verify if the required element is present in the XML document, and do something about it.

There are a few alternative ways to do that. For instance, you can verify the length of a node selection (zero lengths mean that the element does not exist). Or you could wrap the reference inside a TRY .. CATCH block.

For instance, I don't see any request delivery dates in your document, but your code is expecting them to be at a specific position.

Last, and as a corollary of the above, try to refer to an XML Schema or Document Type Definition. You need to know about the cardinality of elements. Furthermore, whenever they appear in your code, name elements are in English, but the XML document is (mainly) in Portuguese. This will be really hard to work with, if you don't have some kind of a blueprint for the documents you'll need to process.
----------------------------------
António Tavares Lopes
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform