Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Changing structure of cursor XMLAdapter
Message
 
 
To
17/05/2010 12:46:33
General information
Forum:
Visual FoxPro
Category:
Other
Environment versions
Visual FoxPro:
VFP 9 SP1
Miscellaneous
Thread ID:
01464882
Message ID:
01464914
Views:
34
>>>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
If it's not broken, fix it until it is.


My Blog
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform