Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Create a cursor from an XML file
Message
From
02/01/2017 03:28:43
Thomas Ganss (Online)
Main Trend
Frankfurt, Germany
 
 
To
02/01/2017 01:28:43
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
01646245
Message ID:
01646252
Views:
55
While it certainly is doable. I'd question the practice. Runtime usage is usually a balancing of space vs. time, so skipping first entries on only 1 DB-descriptor memory handle compared to pre-filtered entries on n table-descriptor handles (perhaps housed on additional DB-descriptor) for me points to separate files.

Dev time I see no real benefit for keeping in one file: if it really is a lot of files, they can conceptually be tucked away in a special folder.

my 0.02€

thomas


>>>>Is it possible (and if yes, how?) to create a cursor (of course, at run time) from a structure defined in an XML file included in the application EXE? What would the XML look like?
>>>
>>>Have you looked at the VFP XMLTOCURSOR() function? If not, Googling [VFP XMLTOCURSOR] should get you started.
>>
>>I have used this function many times but forgot. And I was actually hoping that I will be able to store structures of multiple (different) tables in one XML file and pass a parameter to use a subset of the XML. But if this is not possible, I will have several XML files.
>>Thank you very much.
>
>Actually, you can. You'll just have to identify, for XMLCURSOR(), what part of the XML you want to use.
>
>
>LOCAL XMLSourceData AS String
>LOCAL XML AS MSXML2.DOMDocument60
>
>TEXT TO m.XMLSourceData NOSHOW FLAGS 1
><?xml version="1.0" encoding="windows-1252"?>
><sourceData>
>	<table name="persons">
>		<person>
>			<name>John</name>
>			<gender>M</gender>
>			<born>1997-06-05</born>
>		</person>
>		<person>
>			<name>Mary</name>
>			<gender>F</gender>
>			<born>1995-12-23</born>
>		</person>
>	</table>
>	<table name="cars">
>		<car>
>			<brand>Rover</brand>
>			<model>75</model>
>			<year>2005</year>
>		</car>
>		<car>
>			<brand>Renault</brand>
>			<model>Mégane</model>
>			<year>1997</year>
>		</car>
>	</table>
></sourceData>
>ENDTEXT
>
>m.XML = CREATEOBJECT("MSXML2.DOMDocument.6.0")
>
>m.XML.LoadXML(m.XMLSourceData)
>
>XMLTOCURSOR(m.XML.Selectnodes("/sourceData/table[@name='persons']").item(0).xml, "Persons")
>
>XMLTOCURSOR(m.XML.Selectnodes("/sourceData/table[@name='cars']").item(0).xml, "Cars")
>
>SELECT Persons
>BROWSE NOWAIT
>
>SELECT Cars
>BROWSE NOWAIT
>MOVE WINDOW Cars BY 5,10
>
Previous
Reply
Map
View

Click here to load this message in the networking platform