Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
XML import woes
Message
General information
Forum:
Visual FoxPro
Category:
XML, XSD
Title:
Environment versions
Visual FoxPro:
VFP 9 SP2
OS:
Vista
Network:
Windows 2008 Server
Database:
MS SQL Server
Miscellaneous
Thread ID:
01351508
Message ID:
01351674
Views:
38
Hi Michael,

>Yes the .xsd file is there. I have manually edited the file ( including the dataroot attrib ) several ways and get the same or different errors. The hiccup in changing the file is that it is generated by our users off-site from Access and then they try to import it.

I understand you don't want to change the file, but I would do it just as a troubleshooting exercise. Without knowing the errors you are running into and without having a sample file to work with it is very hard to diagnose the problem. I poked around and here is what I found:

This web site has some sample XML that looks like it came from Office 2003: http://lists.xml.org/archives/xml-dev/200303/msg00602.html

I'm not sure which version of Access you are using, but you can look at the XML, XSD on that page and tell me if it is close to what you are using.

I saved the XML as "books.xml" and the XSD as "booksByAuthor.xsd".
XMLTOCURSOR("books.xml","test",512)
When I tried to use XMLTOCURSOR I got the error "XML Parse error: Required white space was missing. Line 3, Position 54." I removed the semicolon in that line";" and tried again and got "msxml3.dll : Required white space was missing." I also removed the semicolon in the XSD file and got the same error.

I tried importing the same thing using XMLAdapter and it imported fine.
o=CREATEOBJECT("XMLAdapter")
o.LoadXML("books.xml",.T.)
o.Tables.Item(1).ToCursor()
BROW LAST NOWAIT
I added back the semicolons and tried to parse the XML using the DOM parser, multiple versions. If it won't load using the DOM parser, neither XMLTOCURSOR nor XMLAdapter will ever work. And if it won't load with the DOM parser, I consider it an Office problem and not a VFP problem.
o=CREATEOBJECT("msxml.domdocument")
IF NOT o.load("books.xml")
	?o.parseError.reason
ENDIF
o=CREATEOBJECT("msxml2.domdocument.2.6")
IF NOT o.load("books.xml")
	?o.parseError.reason, o.parseError.srcText 
ENDIF
o=CREATEOBJECT("msxml2.domdocument.3.0")
IF NOT o.load("books.xml")
	?o.parseError.reason, o.parseError.srcText 
ENDIF
o=CREATEOBJECT("msxml2.domdocument.4.0")
IF NOT o.load("books.xml")
	?o.parseError.reason, o.parseError.srcText 
ENDIF
o=CREATEOBJECT("msxml2.domdocument.5.0")
IF NOT o.load("books.xml")
	?o.parseError.reason, o.parseError.srcText 
ENDIF
o=CREATEOBJECT("msxml2.domdocument.6.0")
IF NOT o.load("books.xml")
	?o.parseError.reason, o.parseError.srcText 
ENDIF
> I am kinda hoping there is something that needs to be set in Access because it is "old and behind" and make this work :), but we have had issues with XmlToCursor and CursorToXml() not writing/reading stuff other platforms can read/write.

XMLTOCURSOR and CURSORTOXML are very limited. They are to be used with the simplest of XML. I think you will have beter luck with the XMLAdapter class.

Without more information it is hard to offer any additional suggestions...I would try loading the XML with the MSXML DOM parser...if it fails, you will never get XMLTOCURSOR or the XMLAdapter to work. I am suspecting you have a parsing error and not a VFP error.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform