Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Can't convert this XML to cursor
Message
 
To
17/10/2005 11:21:31
Mike Sue-Ping
Cambridge, Ontario, Canada
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 9
Miscellaneous
Thread ID:
01059325
Message ID:
01060322
Views:
17
>Hi Terry,
>
I'm lost with your example. I am a dumb newbie when it comes to this stuff.
No you're not - as Jimi asks: Are you experienced?
The auto-complete - once the DOM is instanciated is one place to start. I googled a lot "foxpro XML" (etc), and got a lot of good stuff here at the UT/

Q: How do I get to Carnegy Hall
A: Practice, Practice, Practice


Do you not have to load the XML file/string to the oXML object? I tried the oXML.LoadXML() and it returns .F. I've tried oXML.Load("c:\test.xml") and it
returns .F. too.
* Here's what I did it
lcFilePath=GETFILE("XML")
lcFileName=JUSTFNAME(lcFilePath)
lcPathName=JUSTPATH(lcFilePath)
CD (["]+lcPathName+["])   
otxtGet_File.Value=lcFilePath
cXML=""
cXML=ALLTRIM(FILETOSTR(lcFileName))
oXML.loadXML(cXML)
* I left the preserveWhiteSpace alone
>
Where did oXMLChild come from?
My XML project works so called "manifest" XML files. They are hiearchial (like an outline) in nature. A table XML will have usually just one generation of children, all with the same attributes. The "manifests" nest. My manifests also refere to attributes in other places in the XML. The oChild is a refrerence to the level of the nest the project is looking at at a given point in the process.
oChild=oXML.childNodes(1).childNodes(1).childNodes(0).childNodes(0)
* imagine the (0) and (1) being VFP loop pointers like "ctr"
if TYPE('oChild.text')==[C]
   * A valid node
endif
>
What does setProperty to XPath do and how do I know what valid values are for the first parameter?
I am not aware of all that it does. My understanding is that it allows for XML query commands like "getAttributes" and other collection queries. It also allows write backs to the cached XML object (which is something I am working on now).

My problems is that I don't get as initmate with the DOMDocument stuff unless It looks like something that will help my. The MS DOM objects essentialy allow any windows program to be an Internet client. And there are a lot of them. On of us, Greg Riechart (i probably mispelled his name) shared some insights of some of them with me and others.

I spent hours maybe near a hundrend - just walking through the DOMDocument in my VFP command window. I saved the history of one session - 7000 lines of questionmarks and DOM (? eval(oXML.Nodes.Children.count)) etc.

I didn't come easy - but it wasn't hard!

>
>Mike
>
>
>>Even with a schema and an "xsi:schemaLocation" tag and the XSDs, you may not be able to use the adapter.
>>
>>Fortunately, with VFP, the command window and autocomplete you can work you way through the XML to figure out what needs to be done. Be sure to:
>>oXML=CREATEOBJECT("MSXML.DOMDocument") && Generic
>>oXML.async=.f.
>>oXML.setProperty("SelectionLanguage","XPath")

>>
>>and then look at some of the xml GET functions to validate the data and [then] retrieve it. Some examples:
>>if oXMLChild-getAttribute("myXMLTagName")==[C] && Is this tag there?
>>selectSingleNode("*[local-name()='myXMLTagName']") && Get one node

>>
>>You have the command window - and when learnig how to parse an XML - it comes in real handy!
Imagination is more important than knowledge
Previous
Reply
Map
View

Click here to load this message in the networking platform