Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Changing structure of cursor XMLAdapter
Message
 
 
À
17/05/2010 12:46:33
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Versions des environnements
Visual FoxPro:
VFP 9 SP1
Divers
Thread ID:
01464882
Message ID:
01464914
Vues:
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
If it's not broken, fix it until it is.


My Blog
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform