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