Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Changing structure of cursor XMLAdapter
Message
 
General information
Forum:
Visual FoxPro
Category:
Other
Environment versions
Visual FoxPro:
VFP 9 SP1
Miscellaneous
Thread ID:
01464882
Message ID:
01464915
Views:
33
>>>>I'm wondering why that field is not in the xml file...
>>>
>>>The XML is coming from a Pocket PC application and I don't want to change it (if it ain't broke don't fix it type of stuff <g>).
>>
>>See about half-way down:
>>
>>http://foxcentral.net/microsoft/WhatsNewInVFP9_Chapter10.htm
>
>Thanks a lot.
>
>Listing 8. Creating a “virtual” field using the XMLAdapter.
>* CarryOverData.prg
>LOCAL ;
>    loXMLAdapter, ;
>    loXMLTable, ;
>    loXMLField
> 
>CLOSE DATABASES all
>CLEAR
> 
>loXMLAdapter = CREATEOBJECT([XMLAdapter])
>loXMLAdapter.LoadXML([CategoriesAndProducts.XML],.T.)
> 
>* This code createa a new XMLField object with an XPath reference
>* as the name. It will cause a "virtual" field containing the
>* category name to be added to the products table when it is
>* rendered to a cursor.
>loXMLField = CREATEOBJECT([XMLField])
>loXMLField.XMLNameIsXPath = .T.
>loXMLField.XMLName = STRCONV([parent::Categories/categoryname], 5)        
>loXMLField.Alias = [CategoryName]
>loXMLField.DataType = [C]
>loXMLField.MaxLength = 15
>loXMLTable = loXMLAdapter.Tables(STRCONV([Products],5))
>loXMLTable.Fields.Add(loXMLField, loXMLField.XMLName)
> 
>FOR EACH loXMLTable IN loXMLAdapter.Tables
>    loXMLTable.ToCursor()
>NEXT
> 
>SELECT Products
>BROWSE
Thank you.
"The creative process is nothing but a series of crises." Isaac Bashevis Singer
"My experience is that as soon as people are old enough to know better, they don't know anything at all." Oscar Wilde
"If a nation values anything more than freedom, it will lose its freedom; and the irony of it is that if it is comfort or money that it values more, it will lose that too." W.Somerset Maugham
Previous
Reply
Map
View

Click here to load this message in the networking platform