Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

XMLtoCursor not working

Status
Not open for further replies.

baseballgem

Programmer
Oct 3, 2001
54
US
I am using VFP7 for creating XML files. The CursortoXML function works fine. It creates the XML and the schema - as it should. Now if I read it correctly it seems the function XMLtoCursor() should do the reverse process. I have an XML file that I created and I even experimented with the one in the XML functions under Help. (scroll down to the example of "a well formatted XML document". I clipped it out to my local c:drive.
When I employed XMLTOCURSOR("c:\develop\mytest.xml","results",4) and I also tried 512 as a final parameter. I get the message...

"XML Parse error: Invalid at the top level of the document. Line 1 Position 1 c:\develop\mytest.xml"

I tried it in several ways - one time I got the error "System Cannot Locate the Object, Line 0, Position 0 (null)"

My Objective is to create a cursor (eventually a table with a record or records) from the info/detail embeded in the XML document.
By all intents and purposes it should work; but it fails.
What am I not understanding? Do I need a patch?
 
baseballgem

Here are a couple things I found while adapting our invoices to XML format.
[ol][li]As far as I know CursorToXML does not allow a one-to-many result. So I quickly dropped it, and created my own script.[/li]
[li]I order to view an XML sheet properly, you have to have the same version of the XML parser, both on the development and the client's machine. Since the parser is the one that the XSL style sheet uses to group, calculate etc...)[/li]
[li]In order to view an XML sheet properly, put all three (or two if your are not using a CSS sheet) in the same directory, and the references to the style sheets should not be path specific, just the file name.[/li][/ol].

P.S. I have a feeling your problem is related to the parser version itself. I would suggest you dowload the lates service pack for XML parser 4.0, and make sure it is installed everywhere you need to view the XML sheets.

Mike Gagnon

If you want to get the best response to a question, please check out FAQ184-2483 first.
 
Baseballgem,
I have exactly the same problem, CursortoXML works fine but trying to reverse this with XMLTOCURSOR gives an error. Why? It should work!
/Micael
 
Be aware VFP8 wants needs msxml4(!) to be present. If you only have msxml3 on your machine you will see the "System Cannot Locate the Object, Line 0, Position 0 (null)" over and over again. Both versions can be present on the machine. The objectmodel differs between 3 and 4 and they are not (!) compatible. I discovered this couple of days ago when I had severe problems implementing an xml interface. On my machine it worked like a charm. On a W2K-server I got errors all over because of this. I had to re-write my xml-interfaces to handle this properly...
Check the version of msxml on your machine and make sure you are using msxml4.

Hope this helps,
Ron Brahma
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top