Professional Documents
Culture Documents
Visual Studio .NET 2003 Convierte un cursor Visual FoxPro en texto XML. CursorToXML(nWorkArea | cTableAlias, cOutput [, nOutputFormat [, nFlags [, nRecords [, cSchemaName [, cSchemaLocation [, cNameSpace ]]]]]]) Devuelve Numrico. EL nmero de bytes escrito en el archivo o variable de memoria. Parmetros nWorkArea Especifica el rea de trabajo de la tabla a partir de la cual se crea la cadena XML. Si se especifica 0 o nada, Visual FoxPro utiliza el rea de trabajo actual. cTableAlias Especifica el alias de la tabla a partir de la cual se crea la cadena XML. cOutput La ruta y el nombre del archivo o el nombre de la variable de memoria a los que se envan los resultados. Si nFlags se establece para el resultado de la variable de memoria (el valor predeterminado), se devuelve el XML a la variable de memoria. Si la variable de memoria no existe, se crear. Si nFlags se establece para el resultado del archivo (512), y el archivo no existe, ste se crear. Si el archivo ya existe, se sobrescribir. Se respeta la configuracin de SAFETY. nOutputFormat Especifica el formato de los resultados de la cadena XML, segn la tabla siguiente:
nOuputFormat
1 ELEMENTS 2 ATTRIBUTES 3 RAW
nFlags
Descripcin
XML centrado en elementos (valor predeterminado) XML centrado en atributos Genrico, XML centrado en atributos
nFlag
0 1 2
Bit
0000 0001 0010
4 8 16 32 512
Conserva los espacios en blanco de los campos. Ajusta campos Memo en secciones CDATA. Codificacin de resultados Codificacin de resultados cOutput es un nombre de archivo. El valor predeterminado denFlag, 0, crea una variable de memoria.
Nota Cuando la codificacin de resultados es UTF-8 (la predeterminada), la Declaracin XML no contiene el atributo Encoding= (ningn atributo de codificacin = UTF-8). Cuando la codificacin de resultados predeterminada se establece en la Pgina de cdigos del cursor o de la tabla, el atributo de codificacin se escribe de acuerdo con la tabla siguiente. Nota Los indicadores de codificacin se establecen mediante la combinacin de los bits 4 y 5 (0010000).
Indicador de codificacin
+0 +16 +32 +48
Bits 4 y 5
00 01 10 11
Descripcin
Windows 1252 (predeterminado) El atributo de codificacin de los resultados se establece en la pgina de cdigos del cursor. El atributo de codificacin de los resultados se establece en UTF-8, sin conversin de caracteres. El atributo de codificacin de los resultados se establece en UTF-8; los caracteres de doble byte se traducen a UTF8.
La tabla siguiente muestra una lista de pginas de cdigo comunes compatibles con Windows.
Comentarios
Windows coreano Windows chino (Taiwan) Windows de Europa del Este Windows ruso Windows de EE.UU. y Europa Occidental Windows griego Windows turco Windows hebreo Windows rabe MS-DOS MS-DOS, Int MS-DOS, Ruso MS-DOS, Nrdico
o bien ks_c_5601-1987
1251 1252 1253 1254 1255 1256 437 850 866 865
Windows-1251 Windows-1252 Windows-1253 Windows-1254 Windows-1255 Windows-1256 WINDOWS-1252 Windows-1252 Windows-1251 Windows-1252
Nota Cuando se utiliza una codificacin basada en pginas de cdigos(juegos de caracteres tradicionales de byte nico o doble byte de Visual FoxPro), tales como Windows-1252 (cdigo de pgina 1252) o Big5 (cdigo de pgina 950), no es necesaria ninguna otra traduccin de caracteres para una presentacin correcta en Internet Explorer. Nota Cuando la codificacin de los resultados se establece en UTF-8, el resultado establecido puede someterse opcionalmente a una traduccin de caracteres al formato UTF-8. Cuando no hay atributo de codificacin, se asume que el XML es UTF-8, por lo que no es necesario (pero podra ser deseable) agregar el atributo de codificacin UTF-8. Generalmente, para XML: si hay una marca de orden de byte, el formato es Unicode (LE o BE, segn BOM). Si no hay etiqueta de codificacin, el formato es UTF-8. Cuando se establece la codificacin de resultados en UTF-8 (la opcin predeterminada), el conjunto de resultados debe someterse a una traduccin de caracteres al formato UTF-8. Cuando no hay atributo de codificacin, se asume que el XML es UTF-8, por lo que no es necesario (pero podra ser deseable) agregar el atributo de codificacin UTF-8.
nRecords Especifica el nmero de registros que se convertirn en resultados XML. Si nRecords es 0 (la opcin predeterminada), en los resultados se incluyen todos los registros. Si nRecords es mayor que el nmero de registros que quedan en la tabla, se incluyen todos los registros restantes. cSchemaName Especifica el nombre y la ubicacin de la informacin de esquema para los datos de cFileName.
cSchemaName
"" "1" <cSchemaName>
Descripcin
Especifica que no se producir ningn esquema. Especifica que se producir un esquema en lnea. Especifica el nombre y la ruta del archivo externo que contendr el esquema (que tiene como alcance el elemento raz del XML).
Si cSchemaName contiene un nombre de archivo, y no se proporciona el parmetro cSchemaLocation o se deja en blanco, el contenido de cSchemaName se escribe en el atributo xsi:schemaLocation o xsi:noNamespaceSchemaLocation en el XML. En el cdigo siguiente, Visual FoxPro genera un archivo XML genrico, myxmlfile.xml, a partir de labels.dbf del alias "Labels" y el archivo de esquema mySchema, en la misma carpeta. CursorToXML("LABELS", "myXMLFile.xml", 1, 512, 0, "mySchema.xsd") Si se especifica "", en lugar de "mySchema", no se produce ningn esquema; si se especifica "1", como en el ejemplo siguiente, se produce un esquema en lnea: CursorToXML("LABELS", "myXMLFile.xml", 1, 512, 0, "1") cSchemaLocation Especifica una ubicacin opcional donde la aplicacin que lee los datos XML debera buscar el archivo de esquema. El contenido de cSchemaLocation se escribe en el atributo xsi:schemaLocation o xsi:noNamespaceSchemaLocation de los datos XML producidos. Utilice este parmetro slo cuando est desplegando el esquema en una ubicacin distinta a la de los datos XML. cSchemaLocation puede ser una direccin http u otra URL. Deber copiar el archivo de esquema en la ubicacin que especific encSchemaLocation. Por ejemplo: CursorToXML("LABELS", "myXMLFile.xml", 1, 512, 0, ; "mySchema.xsd", "http://www.microsoft.com/mySchema.xsd") producir datos XML que contienen el atributo siguiente: xsi:noNamespaceSchemaLocation=" http://www.microsoft.com/mySchema.xsd"
Si cSchemaName est en blanco, especificar cSchemaLocation har que se escriban los mismos atributos en los datos XML. Esto le permite sealar a un esquema existente sin recrear el esquema cada vez que se llama a CursorToXML. cNamespace Especifica el nombre del archivo xml o el esquema que se va a producir. La cadena vaca, "", es el valor predeterminado. Si no se especifica el parmetro cNamespace y el esquema es externo, en el esquema no se escribe ninguna declaracin de espacio de nombres. Si no se especifica ningn parmetro cNamespace y el esquema est en lnea, el valor de targetNamespace en el esquema se establece en "", la cadena vaca. Si se especifica cNameSpace, el atributo targetNamespace se establece en el mismo valor y se agrega al esquema el atributo elementFormDefault="qualified". Observaciones El resultado de CursorToXML( ) se adhiere al orden de ndice del cursor, SET FIELDS TO, y a las configuraciones de filtro actuales. Esta funcin no conserva la ubicacin del cursor. Despus de la llamada, el puntero del registro del cursor informa de EOF si todos los registros se incluyeron ya en los resultados o apuntar al ltimo registro de los resultados de XML si no se incluyeron an todos los registros. Si cSchemaName incluye una URL, el esquema se escribe en el directorio actual; debe cargarse en el servidor para permitir el acceso al explorador o el analizador. Los esquemas externos se escriben siempre en la misma ubicacin que el archivo XML. Cuando se utilizan conjuntos de caracteres de un solo byte, la codificacin predeterminada, Windows-1252, no necesita ninguna traduccin ms de caracteres para mostrarse correctamente en Internet Explorer. Tanto Unicode como UTF-8 necesitan que el conjunto de resultados se someta a una traduccin de caracteres al formato adecuado y, si se especific que los resultados se guarden en un archivo, que se escriba en el archivo la BOM (Byte Order Mark) correspondiente Unicode o UTF-8, para designar el tipo de archivo como Unicode o UTF-8.
XMLUPDATEGRAM( ) Function
Visual Studio 2005 Other Versions
This topic has not yet been rated Rate this topic
Mirrors changes made in a buffered table or cursor in an XML UpdateGram and returns a character string that contains the UpdateGram. An XML UpdateGram represents the before and after conditions of the changed portion of a Visual FoxPro table or cursor. Through additional processes, you can use an UpdateGram to commit these changes to the data represented by the XML UpdateGram document.
Note
To use XMLUPDATEGRAM( ), you must use SET MULTILOCKS ON and enable table buffering.
Tip
Before calling XMLUPDATEGRAM( ), you should specify the key field list by calling CURSORSETPROP( ) with the KeyFieldList property against existing cursors and tables. If you do not specify key fields, both the before and after representations contains all the fields in the table. If you specify one or more key fields, only those fields appear in the before section.
XMLUPDATEGRAM( [ cAliasList [, nFlags [, cSchemaLocation]]]) Parameters cAliasList Specifies a comma-separated list of open tables or cursors, listed either by name or work area numbers in any combination, to include in the XML UpdateGram. If you specify no value or an empty string ("") forcAliasList, Visual FoxPro uses all open tables and cursors in the current data session that contain buffered changes. nFlags Specifies whether to return a formatted file. The following table lists the additive flags for nFlags.
nFlag
Bit
0000 0001 0010
Output description
(Default) Use UTF-8 formatted XML. Use unformatted, for example, continuous string XML. Enclose empty elements with both open and closing elements, for
0 1 2
example, <cc04><cc04/>. 4 8 16 32 0100 1000 10000 100000 Preserve white space in fields. Wrap Memo fields in CDATA sections. Output encoding. Output encoding. Indicates that a code page should be used.
32768 none
Note
When output encoding is UTF-8 (default), the XML Declaration does not contain an Encoding= attribute (no encoding attribute = UTF-8).
When output encoding is set to default to the code page of the cursor or table, the encoding attribute will be written according to the following table.
Note
Encoding flags are set by combining bits 4 and 5 (0010000).
Encoding flag
+0 +16 +32 +48
cSchemaLocation
Bits 4 and 5
00 01 10 11
Description
(Default) Windows 1252 Set output encoding attribute to the code page of the cursor. Set output encoding attribute to UTF-8 (no character translation). Set output encoding attribute to UTF-8 and translate double-byte characters to UTF-8.
Note
You must supply the mapping schema.
For example, suppose you pass the a schema called mySchema.xsd to cSchemaLocation, the UpdateGram created contains a mapping schema attirbute as it appears in the following XML: <ROOT xmlns:updg="urn:schemas-microsoft-com:xml-updategram"> <updg:sync mapping-schema="mySchema.xsd" >
Return Value
<updg:before>
Character data type. XMLUPDATEGRAM( ) returns a character string that contains the XML UpdateGram.
Remarks
You can use XMLUPDATEGRAM( ) with the OLE DB Provider for Visual FoxPro. However, the_VFP VFPXMLProgID property is not supported because the _VFP system variable is not supported in the OLD EB Provider.
Note
To use the Visual FoxPro OLE DB Provider with XMLUPDATEGRAM( ), you must install MSXML 3.0 on the computer with the OLE DB Provider.
SQL Server and Visual Studio support the DiffGram format for updating XML. However, SQL XML requires a mapping schema to support this format. Therefore, XMLUPDATEGRAM( ) does not support this format. To avoid possible errors generated by XMLUPDATEGRAM( ) on tables containing Memo or General fields, use the CURSORSETPROP( ) function. The following example shows how to include memo data in an XML UpdateGram by setting the KeyFieldList property using CURSORSETPROP( ): SET MULTILOCKS ON CREATE CURSOR Test (mField M, cField I AUTOINC) INSERT INTO Test (mField) VALUES ("123456789") INSERT INTO Test (mField) VALUES ("23456789") INSERT INTO Test (mField) VALUES ("3456789") INSERT INTO Test (mField) VALUES ("456789") CURSORSETPROP("Buffering",5) CURSORSETPROP("keyfieldlist",'cField') UPDATE Test SET mField = "XXXXXXX" WHERE cField < 3 STRTOFILE(XMLUPDATEGRAM(),'xmlupdate.txt') MODIFY FILE xmlupdate.txt RETURN To write memo data in the XML UpdateGram to SQL Server, you must use an explicit schema on the SQL Server and reference the schema in the XML UpdateGram. Unlike the CURSORTOXML( ) function, XMLUPDATEGRAM( ) disregards SET FIELDS statements and reads from the underlying cursor directly. To change the table structure before calling XMLUPDATEGRAM( ), you must copy the data into a new cursor. For example, to change a Numeric field to a Currency field, the following example uses a SQL SELECT statement to create a new cursor and uses that cursor with XMLUPDATEGRAM( ). The example makes the Total_Price field a currency field, enables buffering with CURSORSETPROP( ), adds sales tax with the REPLACE command, and creates an XML UpdateGram using the XMLUPDATEGRAM( ) function.
SELECT OrderID, CustID, NTOM(Total_Price) as Total_Price; FROM Orders INTO CURSOR New_Orders READWRITE CURSORSETPROP("Buffering", 5, "New_Orders") REPLACE Total_Price WITH (Total_Price * 1.083) cXMLUpdg = XMLUPDATEGRAM("New_Orders") When using flag 32768, the flag's 16 and 32 settings can affect which code page is applied depending on the type of data you are writing to XML. The following tables show the possible combinations of settings and the code page each combination applies. For XML documents written with the 32768 flag set, the following code pages are applied.
Flag 32768 is Set XML documents: Window-1252. Unicode data: code page 1252. Character data: default code page, unless a field is marked as NOCPTRANS.
XML documents: Plus-CodePage property of the cursor. If XMLField CodePage property is greater than zero (0) and it doesnt match the cursors code page, an error is reported. Unicode data: the Code page property of the cursor object. Character data: none. Raw data from the Visual FoxPro tables (.dbf) are used instead.
Not set
Set
XML documents: UTF-8 code page. Unicode data: UTF-8 code page. Character data: Default code page unless field is marked as NOCPTRANS, in which case no additional character translation to UTF-8 occurs.
Set
Set
XML documents: UTF-8 code page. Unicode data: UTF-8 code page. Character data: default code page unless a field is marked as NOCPTRANS, in which case the data are translated to UTF-8 using the SYS(3005) setting.
For XML documents written without setting the 32768 flag, the following code pages are applied.
Without the 32768 flag XML documents: Window-1252. Unicode data: code page 1252. Character data: default code page unless a field is marked as NOCPTRANS.
True (.T)
Not set
XML documents: CodePage property of the cursor. Character data: none. Raw data from the Visual FoxPro tables (.dbf) are used instead. Unicode data: code page property of the cursor object.
Not set
Set
XML documents: UTF-8 code page. Unicode data: UTF-8 code page. Character data: default code page unless field is marked as NOCPTRANS, in which case no additional character translation to UTF-8 occurs.
Set
Set
XML documents: UTF-8 code page. Unicode data: UTF-8 code page. Character data: default code page unless field is marked as NOCPTRANS, in which case, they are translated to UTF-8 using code page for the current SYS(3005) setting.
XMLTOCURSOR( ) Function
Visual Studio 2005 Converts XML text into a Visual FoxPro cursor or table. XMLTOCURSOR(eExpression | cXMLFile [, cCursorName [, nFlags ]]) Parameters eExpression Specifies the XML text or an expression that evaluates to valid XML data. The eExpression parameter can be a Visual FoxPro memory variable, memo field contents, the return from an HTTP request, the return result from a SOAP method call, XML from the XMLDOM, or an ADO stream.
Note
XMLTOCURSOR( ) generates an error if eExpression is not found or if eExpression does not parse to valid XML.
cXMLFile
Specifies the name, and, optionally, the path of a physical XML file that resides on your local computer or network. If you do not specify a path, Visual FoxPro searches the path along the Visual FoxPro directory for the XML file. cCursorName Specifies the name of the cursor to store the result and creates the cursor in the current work area. If the cursor name already exists or is open, Visual FoxPro closes the cursor and creates a new one in an unused work area. If you omit or pass an empty string ("") for cCursorName, Visual FoxPro creates a cursor named "XMLRESULT" for returning the result. If cCursorName contains data and nFlags is set to 8192, Visual FoxPro appends the data being imported from the XML file to the existing table or cursor. The table or cursor must be open or in use. IfcCursorName is an empty string (""), Visual FoxPro imports XML into the table or cursor that is open in the current work area. nFlags Specifies how XMLSource eExpression is handled in XMLTOCURSOR( ). The following table describes the values for nFlags.
nFlags
Bit
0000 0100 01000000000
Description
(Default) Treats the first parameter as a string containing XML data. Preserves white space in data and overrides the xml:space attribute of the XML data. Specifies that the first parameter, either an eExpression or a cXMLFile, is a string containing the name and path of an XML data file. NOCPTRANS Creates Character and Memo fields in the resultant cursor with the NOCPTRANS option and inserts the text or XML values in the incoming elements into the Character or Memo field on an untranslated, byte-for-byte basis. When used with flag 1024, XMLTOCURSOR( ) returns a string padded with trailing spaces equal to the actual string, that is, a string twice the length.
0 4 512
1024
10000000000
2048
100000000000
Use when the imported schema has an XML schema definition (XSD) schema containing decimal data type with restrictions, or facets, of totalDigits="19" and fractionDigits="4."
XSD data type values are mapped to the Visual FoxPro Currency data type in the resulting cursor. 4096 1000000000000 Disables base64 decoding. In Visual FoxPro, base64 encoding is intended for encoding only binary data. 8192 1100000000 Specifies that cCursorName is the name or alias of an existing table or cursor and imports the data from the specified XML file into an existing table or predefined cursor. If cCursorName contains data, the data imported from the XML file is appended to the existing data. If cCursorName is an empty string (""), the data from the XML file is imported into the table or cursor in the current work area. Setting nFlags to 8192 can be useful when an XML schema is not available or not practical for use. Indicates that a code page should be used. Maps XML Char fields to native Fox Varchar fields. If not specified, XML Char fields are mapped to Fox Character fields. Maps XML base64Binary fields to native Fox Varbinary fields if less than 255 bytes or Blob fields if greater than this length. If not specified, XML base64Binary fields are mapped to Fox Memo fields.
When you use flag 8192, be aware of the following: You must make sure the table schema matches the incoming XML elements in the appropriate manner. Visual FoxPro enforces the data types in cCursorName as described in the Data Type Matching table in this topic but makes no other assumptions about data types. Attempting to import incompatible values generates the appropriate message. If the XML contains or references a schema, and the data types in the schema conflict with the data types of the cursor or table, the data types in the cursor or table are used. Element names in the XML file are mapped to the column names in cCursorName. In addition, Visual FoxPro imports only data from the element names in the XML file that match the column names in cCusorName. The cursor or table can have fewer columns than those in the XML file, but it must have at least one matching column. The cursor or table can have additional columns that do not correspond to an element in the XML file.
If the table contains autoincrementing fields, XMLTOCURSOR( ) fails if AUTOINCERROR is set to ON. Setting AUTOINCERROR to OFF or turning off autoincrementing in the target table by usingCURSORSETPROP( ) allows XMLTOCURSOR( ) to succeed. The target table's autoincrementing field or fields are incremented according to the values specified, and the values in the source table are not copied. The following table describes data type matching restrictions when setting nFlags to 8192.
Behavior
Character, Character(Binary), Memo,Memo (Binary Accepts any data but truncates any ) data exceeding the length of a Character column. Currency Accepts numeric data within accepted range of the Currency type but truncates numbers outside this range. Accepts XML format date and dateTime values. Visual FoxPro converts the XML date and dateTime formats to the corresponding Visual FoxPro date. Visual FoxPro preserves only the M/D/Y portion of the XML date or dateTime value. DateTime Accepts XML format date and dateTime values. Visual FoxPro converts the XML date and dateTime formats to the corresponding Visual FoxPro date and discards precision beyond the extent supported by Visual FoxPro. Double Accepts numeric data within the accepted range of the Double type but truncates numbers outside this range. Accepts integer data within the accepted range of the Integer type but truncates numbers outside this
Date
Integer
range. Logical Numeric, Float Accepts the values True, .T., 1, False, .F., and 0. Accepts numeric data with or without decimals but truncates numbers outside the accepted range for these types according to Visual FoxPro rules or replaces with the numeric overflow indicator ("*************").
Return Value
Numeric data type. XMLTOCURSOR( ) returns the number of records created.
Remarks
You can use XMLTOCURSOR( ) with the OLE DB Provider for Visual FoxPro. However, the _VFP VFPXMLProgIDproperty is not supported because the _VFP system variable is not supported in the OLE DB Provider.
Note
To use the Visual FoxPro OLE DB Provider with XMLTOCURSOR( ), you must install MSXML 3.0 on the computer with the OLE DB Provider.
XMLTOCURSOR( ) generates a syntax error for record lengths greater than approximately 160 columns. The exact number of columns that cause an error depends on the length of the column names. XMLTOCURSOR( ) does not use the Varchar type when creating a cursor from an XML document. However,XMLTOCURSOR( ) supports appending data into an existing cursor with Varchar fields. When calling XMLTOCURSOR( ) in append mode, Visual FoxPro adds an empty row if no XML element name matches any table or cursor column. XMLTOCURSOR( ) converts Decimal data type to Numeric 20,19 (width, precision). In versions prior to Visual FoxPro 8.0, Decimal mapped to Numeric 8,0. Numeric Overflow Conditions XMLTOCURSOR( ) imports XML data containing Visual FoxPro numeric overflow conditions, for example, "*******", in place of a numeric or integer value. If a schema is provided, Visual FoxPro creates the correct data type in the resulting cursor but changes the overflow from asterisk (*) characters to 0.0 or 0 values. Therefore, the XML parser used by XMLTOCURSOR( ) does not throw an error as a result of character values stored in a decimal type element.
For more information about converting XML to Visual FoxPro data, see Converting Between XML and Visual FoxPro Data.
Visual Studio 2005 You can exchange data more easily with other applications by converting Visual FoxPro data to XML format. Visual FoxPro includes the following functions so you can convert data between XML and Visual FoxPro format: CURSORTOXML( ) Function XMLTOCURSOR( ) Function XMLUPDATEGRAM( ) Function
Note
You must have the Microsoft XML Core Services (MSXML) parser installed before you can use the Visual FoxPro XML functions.
The following sections discuss considerations when converting between XML and Visual FoxPro data: Processing XML Data in Variables or Strings Instead of Files XML String Conversion Importing and Exporting XML Using Schemas You can override the internal functionality of the CURSORTOXML( ), XMLTOCURSOR( ), andXMLUPDATEGRAM( ) functions by referencing a COM component using the VFPXMLProgID property. For more information, see VFPXMLProgID Property. Visual FoxPro supports hierarchically formatted XML for XML DiffGram and .NET Framework ADO.NET DataSet formats by providing the XMLAdapter, XMLTable, and XMLField classes. For more information, see XML Functionality Using XMLAdapters.
The following example opens the Visual FoxPro sample Customer table located in the Visual FoxPro ..\Samples\Data\ directory and converts the data in the Customer table and saves the data in the table to a memory variable, lcXML, as XML: CLEAR CLOSE DATABASES ALL USE HOME()+'samples\data\customer' CURSORTOXML('customer','lcXML',1,48,5,"","","") The following line inserts incorrect characters in the resulting cursor: XMLTOCURSOR(lcXML,"curCustomerList",4) The following line uses the STRCONV( ) function and converts the XML to DBCS data correctly, opens a browse window for the table: XMLTOCURSOR(STRCONV(lcXML,11),"curCustomerList",4) BROWSE
type="xsd:timeInstant"/> <xsd:element name="ts12" minOccurs="0"> <xsd:simpleType> <xsd:restriction base="xsd:binary"> <xsd:encoding value="base64"/> </xsd:restriction> </xsd:simpleType> </xsd:element> </xsd:all> </xsd:complexType> </xsd:element> <xsd:element name="VFPData" msdata:lsDataSet="true"> <xsd:complexType> <xsd:choice maxOccurs="unbounded"> <xsd:element ref="atxm"/> </xsd:choice> </xsd:complexType> </xsd:element> </xsd:schema> Currently, Visual FoxPro exports XML in the following formats: Element-centric Each field in a resulting or source cursor or table is represented by a sub-element of the top-level element. <?xml version="1.0" encoding="Windows-1252" standalone="yes" ?> <!-- Note targetNamespace in root (VfpData) element. If set to default (""), xmlns attrib is not written --> <VfpData xmlns="http://www.microsoft.com"> <alltypesxm> <ikey>2</ikey> <nc00>1.1111</nc00> <mc03>H1111111111111111111</mc03> <cc04>H111111111111111111</cc04> <lc05>true</lc05> <fc06>-1111000</fc06> <yc07>-111111111.1111</yc07> <ic08>-11111111</ic08> <bc09>-111111111111.1</bc09> <dc10>1999-03-02T08:00:00</dc10> <tc11>1999-03-02T09:01:01</tc11> <ts12>AAAAAAAAAr8=</ts12> </alltypesxm> </VfpData> Attribute-centric The cursor is identified by the keyword "VFPData" and each field in a resulting or source cursor or table is represented by an attribute of the VFPData element. <?xml version="1.0" encoding="Windows-1252" ?> <!-- Note targetNamespace in root element --> <VFPData xmlns="http://www.microsoft.com"> <atxm_attr ikey="2" nc00="12345.1111" mc03="H1111111111111111111" cc04="H111111111111111111" lc05="1" fc06="-1111000.0000" yc07="-111111111.1111" ic08="-11111111"
bc09="-111111111111.100000" dc10="1999-03-02" tc11="1999-03-02T01:01:01" ts12="AAAAAAAAAr0=" /> <atxm_attr ikey="3" nc00="2.1111" mc03="H2222222222222222222" cc04="H222222222222222222" lc05="1" fc06="22220000.0000" yc07="2222222222.2222" ic08="222222222" bc09="222222222222.2200000" tc11="2000-10-03T02:02:02" ts12="AAAAAAAAAr8=" /> </VFPData> Raw Each row in a resulting or source cursor or table is represented by an XML element with the generic identifier "row", and each column value is mapped to an attribute of the row element where the attribute name is equal to the column name. This format is identical to Attribute-centric except for "row" as the name of the top-level element. <?xml version="1.0"?> <!-- Note no targetNamespace in root element --> <VFPData> <row CustomerID="CACTU" CompanyName="Cactus Comidas para llevar" ContactName="Patricio Simpson" ContactTitle="Sales Agent" Address="Cerrito 333" City="Buenos Aires" PostalCode="1010" Country="Argentina" Phone="(1) 135-5555" Fax="(1) 135-4892"/> </VFPData>
Visual Studio 2005 The following tables describe the following default data type mappings between Visual FoxPro and XML schema data types: XML Schema Primitive Data Types to Visual FoxPro Data Types XML Schema Derived Types to Visual FoxPro Data Types Visual FoxPro Data Types to XML Schema Definition (XSD) Data Types XML Schema Definition (XSD) Data Types to Visual FoxPro Data Types XML Data Reduced (XDR) Schema Data Types to Visual FoxPro Data Types XML Schema Primitive Data Types to Visual FoxPro Data Types
Description
Represents a Uniform Resource Identifier (URI) as defined by RFC 2396. An anyURI value can be absolute or relative and might have an optional fragment identifier.
Represents base64-encoded arbitrary Memo (Binary), binary data. A base64Binary is the set Varbinary or of finite-length sequences of binary Blob octets.
pattern, whiteSpace Represents Boolean values, which are Logical either true or false. enumeration, pattern, minInclusive, minExclusive, maxInclusive, maxExclusive, whiteSpace enumeration, pattern, minInclusive, minExclusive, Represents a calendar date. The pattern for date is CCYY-MM-DD with an optional time zone indicator as allowed for dateTime. Date
dateTime
Represents a specific instance of time. DateTime The pattern for dateTime is CCYYMM-DDThh:mm:ss where CC
represents the century, YY the year, MM the month, and DD the day, preceded by an optional leading negative (-) character to indicate a negative number. If the negative character is omitted, positive (+) is assumed. The T is the date/time separator and hh, mm, and ss represent hour, minute, and second respectively. Additional digits can be used to increase the precision of fractional seconds if desired. For example, the format ss.ss... with any number of digits after the decimal point is supported. The fractional seconds part is optional. This representation may be immediately followed by a "Z" to indicate Coordinated Universal Time (UTC) or to indicate the time zone. For example, the difference between the local time and Coordinated Universal Time, immediately followed by a sign, + or -, followed by the difference from UTC represented as hh:mm (minutes is required). If the time zone is included, both hours and minutes must be present.
decimal
enumeration, Represents arbitrary precision pattern, totalDigits, numbers. fractionDigits, minInclusive, minExclusive, maxInclusive, maxExclusive, whiteSpace pattern, enumeration, minInclusive, minExclusive, maxInclusive, maxExclusive, Represents double-precision 64-bit floating-point numbers.
double
Double
whiteSpace duration enumeration, pattern, minInclusive, minExclusive, maxInclusive, maxExclusive, whiteSpace Represents duration of time. The Character pattern for duration is (C(30)) PnYnMnDTnHnMnS, where nY represents the number of years, nM the number of months, nD the number of days, T the date/time separator, nH the number of hours, nM the number of minutes, and nS the number of seconds. For example, to indicate a duration of 1 year, 2 months, 3 days, 10 hours, and 30 minutes, you write: P1Y2M3DT10H30M. You could also indicate a duration of minus 120 days as -P120D. float pattern, enumeration, minInclusive, minExclusive, maxInclusive, maxExclusive, whiteSpace enumeration, pattern, minInclusive, minExclusive, maxInclusive, maxExclusive, whiteSpace Represents single-precision 32-bit floating-point numbers. Double
gDay
Represents a Gregorian day that Character recurs, specifically a day of the (C(10)) month, such as the fifth day of the month. A gDay is the space of a set of calendar dates. Specifically, it is a set of one-day long, monthly periodic instances. The pattern for gDay is --DD with an optional time zone indicator as allowed for date.
gMonth
Represents a Gregorian month that recurs every year. A gMonth is the space of a set of calendar months. Specifically, it is a set of one-month long, yearly periodic instances. The pattern for gMonth is -MM- with
Character (C(10))
an optional time zone indicator as allowed for date. gMonthDay enumeration, pattern, minInclusive, minExclusive, maxInclusive, maxExclusive, whiteSpace Represents a specific Gregorian date Character that recurs, specifically a day of the (C(10)) year, such as the third of May. A gMonthDay is the set of calendar dates. Specifically, it is a set of oneday long, annually periodic instances. The pattern for gMonthDay is --MMDD with an optional time zone indicator as allowed for date. Represents a Gregorian year. A set of Character one month-long, nonperiodic (C(15)) instances. The pattern for gYear is CCYY with an optional time zone indicator as allowed for dateTime. Represents a specific Gregorian Character month in a specific Gregorian year. A (C(15)) set of one month-long, nonperiodic instances. The pattern for gYearMonth is CCYYMM with an optional time zone indicator. Represents arbitrary hex-encoded Memo (Binary) binary data. A hexBinary is the set of finite-length sequences of binary octets. Each binary octet is encoded as a character tuple, consisting of two hexadecimal digits ([0-9a-fA-F]) representing the octet code. Memo
gYear
gYearMonth enumeration, pattern, minInclusive, minExclusive, maxInclusive, maxExclusive, whiteSpace hexBinary length, pattern, maxLength, minLength, enumeration, whiteSpace
NOTATION length, enumeration, Represents a NOTATION attribute pattern, maxLength, type. A set of QNames. minLength, whiteSpace QName length, enumeration, Represents a qualified name. A
Memo
pattern, maxLength, qualified name is composed of a minLength, prefix and a local name separated by a whiteSpace colon. Both the prefix and local names must be an NCName. The prefix must be associated with a namespace Uniform Resource Identifier (URI) reference, using a namespace declaration. string length, pattern, maxLength, minLength, enumeration, whiteSpace Represents character strings. Character when maxLength is specified and less than 255 characters. Otherwise, Memo. Character (C(20))
time
Represents an instance of time that recurs every day. The pattern for time is hh:mm:ss.sss with an optional time zone indicator.
Description
byte
enumeration, fractionDigits, pattern, minInclusive, minExclusive, maxInclusive, maxExclusive, totalDigits, whiteSpace length, maxLength, minLength, enumeration, whiteSpace
Represents an integer with a Integer minimum value of -128 and maximum of 127. This data type is derived from short.
ENTITIES
Represents the ENTITIES attribute Character, if type and contains a set of values of maxLength is type ENTITY. specified and less than 255. Otherwise, Memo.
ENTITY
Represents the ENTITY attribute type in XML 1.0 Recommendation. This is a reference to an unparsed entity with a name that matches the specified name. An ENTITY must be an NCName and must be declared in the schema as an unparsed entity name. This data type is derived from NCName. Represents the ID attribute type defined in the XML 1.0 Recommendation. The ID must be a no-colon-name (NCName) and must be unique within an XML document. This data type is derived from NCName. Represents a reference to an element that has an ID attribute that matches the specified ID. An IDREF must be an NCName and must be a value of an element or attribute of type ID within the XML document. This data type is derived from NCName.
ID
length, enumeration, pattern, maxLength, minLength, whiteSpace length, enumeration, pattern, maxLength, minLength, whiteSpace
Character, if maxLength is specified and less than 255. Otherwise, Memo. Character, if maxLength is specified and less than 255. Otherwise, Memo.
IDREF
IDREFS
length, maxLength, minLength, enumeration, whiteSpace enumeration, fractionDigits, pattern, minInclusive, minExclusive, maxInclusive, maxExclusive, totalDigits, whiteSpace enumeration, fractionDigits,
Represents the IDREFS attribute Character, if type and contains a set of values of maxLength is type IDREF. specified and less than 255. Otherwise, Memo. Represents an integer with a Integer minimum value of -2147483648 and maximum of 2147483647. This data type is derived from long.
int
integer
Represents a sequence of decimal Integer, if digits with an optional leading sign totalDigits is
pattern, minInclusive, minExclusive, maxInclusive, maxExclusive, totalDigits, whiteSpace language length, pattern, maxLength, minLength, enumeration, whiteSpace enumeration, fractionDigits, pattern, minInclusive, minExclusive, maxInclusive, maxExclusive, totalDigits, whiteSpace length, pattern, maxLength, minLength, enumeration, whiteSpace
Represents natural language identifiers (defined by RFC 1766). This data type is derived from token.
Character, if maxLength is specified and less than 255. Otherwise, Memo. Integer, if totalDigits is less than 10. Otherwise, Character with totalDigits respected.
long
Represents an integer with a minimum value of -9223372036854775808 and maximum of 9223372036854775807. This data type is derived from integer.
Name
Represents names in XML. A Name is a token that begins with a letter, underscore, or colon and continues with name characters (letters, digits, and other characters). This data type is derived from token. Represents noncolonized names. This data type is the same as Name, except it cannot begin with a colon. This data type is derived from Name. Represents an integer that is less than zero and consists of a negative sign (-) and sequence of decimal digits. This data type is derived from nonPositiveInteger.
Character, if maxLength is specified and less than 255. Otherwise, Memo. Character, if maxLength is specified and less than 255. Otherwise, Memo. Integer, if totalDigits is less than 10. Otherwise, Character with totalDigits
NCName
length, pattern, maxLength, minLength, enumeration, whiteSpace enumeration, fractionDigits, pattern, minInclusive, minExclusive, maxInclusive,
negativeInteger
maxExclusive, totalDigits, whiteSpace NMTOKEN length, pattern, maxLength, minLength, enumeration, whiteSpace Represents the NMTOKEN attribute type. An NMTOKEN is set of name characters, such as letters, digits, and other characters, in any combination. Unlike Name and NCName, NMTOKEN has no restrictions on the starting character. This data type is derived from token.
respected.
NMTOKENS
Represents the NMTOKENS Memo attribute type and contains a set of values of type NMTOKEN.
nonNegativeInteger enumeration, fractionDigits, pattern, minInclusive, minExclusive, maxInclusive, maxExclusive, totalDigits, whiteSpace nonPositiveInteger enumeration, fractionDigits, pattern, minInclusive, minExclusive, maxInclusive, maxExclusive, totalDigits, whiteSpace normalizedString length, pattern, maxLength, minLength, enumeration, whiteSpace
Represents an integer that is greater Integer, if than or equal to zero. This data totalDigits is type is derived from integer. less than 10. Otherwise, Character with totalDigits respected.
Represents an integer that is less than or equal to zero and A nonPositiveInteger consists of a negative sign (-) and sequence of decimal digits. This data type is derived from integer.
Integer, if totalDigits is less than 10. Otherwise, Character with totalDigits respected.
Represents white space normalized Character, if strings. This data type is derived maxLength is from string. specified and less than 255. Otherwise, Memo.
positiveInteger
enumeration, fractionDigits, pattern, minInclusive, minExclusive, maxInclusive, maxExclusive, totalDigits, whiteSpace enumeration, pattern, length, minLength, maxLength, whiteSpace enumeration, fractionDigits, pattern, minInclusive, minExclusive, maxInclusive, maxExclusive, totalDigits, whiteSpace enumeration, fractionDigits, pattern, minInclusive, minExclusive, maxInclusive, maxExclusive, totalDigits, whiteSpace enumeration, fractionDigits, pattern, minInclusive, minExclusive, maxInclusive, maxExclusive, totalDigits, whiteSpace
Represents an integer that is greater Integer, if than zero. This data type is derived totalDigits is from nonNegativeInteger. less than 10. Otherwise, Character with totalDigits respected.
token
Represents tokenized strings. This Character, if data type is derived from maxLength is normalizedString. specified and less than 255. Otherwise, Memo. Represents an integer with a Integer minimum value of -32768 and maximum of 32767. This data type is derived from int.
short
unsignedByte
Represents an integer with a Integer minimum of zero and maximum of 255. This data type is derived from unsignedShort.
unsignedInt
Represents an integer with a minimum of zero and maximum of 4294967295. This data type is derived from unsignedLong.
Integer, if totalDigits is less than 10. Otherwise, Character with totalDigits respected.
unsignedLong
enumeration, fractionDigits, pattern, minInclusive, minExclusive, maxInclusive, maxExclusive, totalDigits, whiteSpace enumeration, fractionDigits, pattern, minInclusive, minExclusive, maxInclusive, maxExclusive, totalDigits, whiteSpace
Represents an integer with a minimum of zero and maximum of 18446744073709551615. This data type is derived from nonNegativeInteger.
Integer, if totalDigits is less than 10. Otherwise, Character with totalDigits respected.
unsignedShort
Represents an integer with a Integer minimum of zero and maximum of 65535. This data type is derived from unsignedInt.
Visual FoxPro Data Types to XML Schema Definition (XSD) Data Types
XSD data type Restrictions and sample Comments and examples restriction
xs:base64Binary
Character
Character (Binary)
<xs:element name="cc04" minOccurs="0"> <xs:simpleType> <xs:restriction base="xs:string"> <xs:maxLength value="128"/> </xs:restriction> </xs:simpleType> </xs:element>
Currency
<xs:element name="yc07" minOccurs="0"> <xs:simpleType> <xs:restriction base="xs:decimal"> <xs:totalDigits value="19"/> <xs:fractionDigits value="4"/> </xs:restriction> </xs:simpleType> </xs:element>
Date
xs:date 1999-05-31
None
DateTime
xs:dateTime 1999-05-
None
31T13:20:00.00005:00 Double xs:double -INF, -1E4, -0, 0, 12.78E-2, 12, INF, NaN None The export value should include the maximum scale allowed for double and not be limited to display scale (internal value of double). totalDigits is the number of digits not including decimal point.
Float
xs:decimal
<xs:element name="fc06" minOccurs="0"> <xs:simpleType> <xs:restriction base="xs:decimal"> <xs:totalDigits value="14"/> <xs:fractionDigits value="4"/> </xs:restriction> </xs:simpleType> </xs:element>
General Integer
Logical
Memo
xs:string
Memo (Binary)
xs:base64Binary
Numeric
<xs:element name="nc00" minOccurs="0"> <xs:simpleType> <xs:restriction base="xs:decimal"> <xs:totalDigits value="10"/> <xs:fractionDigits value="4"/> </xs:restriction> </xs:simpleType> </xs:element >
Varbinary
xs:base64Binary
Varchar
<xs:element name="cc04" minOccurs="0"> <xs:simpleType> <xs:restriction base="xs:string"> <xs:maxLength value="128"/> </xs:restriction> </xs:simpleType> </xs:element>
Varchar (Binary)
<xs:element name="cc04" minOccurs="0"> <xs:simpleType> <xs:restriction base="xs:string"> <xs:maxLength value="128"/> </xs:restriction> </xs:simpleType> </xs:element>
XML Schema Definition (XSD) Data Types to Visual FoxPro Data Types
xsd:dateTime xsd:decimal xsd:double xsd:int xsd:string xsd:string (more than 254 characters in length)
XML Data Reduced (XDR) Schema Data Types to Visual FoxPro Data Types
Specifies hexadecimal-encoded binary data. Memo (Binary) hexBinary Specifies a Boolean value of either 0 or 1. Example: 0 is false and 1 is true. Logical boolean
char date
Specifies a number corresponding to the None Unicode representation of a single character. Specifies the date in a subset of the ISO 8601 format without the time data. Example: "1994-11-05" Date
dateTime
Specifies a date in a subset of the ISO 8601 DateTime format with optional time and no optional zone. Fractional seconds can be as precise as nanoseconds. Example: "1988-04-07T18:39:09"
dateTime
dateTime.tz Specifies a date in a subset of the ISO 8601 None format with optional time and optional zone. Fractional seconds can be as precise as nanoseconds. Example: "1988-04-07T18:39:09-08:00"
None
entity
Specifies a reference to an unparsed entity, requiring a matching <!ENTITY> declaration for each instance of the entity.
None
None
entities
None None
enumeration Similar to nmtoken but with an explicit list of allowed values. Supported on attributes only. Example: "Red Blue Green" fixed.14.4 Specifies a number with no more than fourteen digits to the left of the decimal point and no more than four to the right of the decimal point. Example: 9999.0044 float Specifies a real floating point number. Examples: 111, 3.14, -123.456E+10 i1 Specifies a 1-byte integer with an optional sign ranging from -128 to 127. Examples: 1, 127, -128 i2
Currency
decimal 19,4
Double
double
Integer
byte
Specifies a 2-byte integer with optional sign Integer ranging from -32768 to 32767. Examples: 1, 703, -32768
short
i4
Specifies a 4-byte integer with optional sign Integer ranging from -2147483648 to 2147483647 Examples: 1, 703, -32768, 148343, -1000000000
int
i8
Specifies an 8-byte integer with optional sign ranging from -9223372036854775808 to 9223372036854775807. Examples: 1, 703, -32768, 1483433434334, -1000000000000000
Character or Integer
long
id
Specifies a value that identifies an attribute None as an id type attribute. The id values must be unique throughout the document. In a document, idref(s) attributes refer to an id type attribute, forming a relationship similar to primary key and foreign key in relational databases. Example: Cust1
None
idref
None
None
idrefs
Similar to idref, except it contains multiple id type values separated by white space. Example: Cust1 Cust2 Cust3
None
None
int
Integer
int
nmtoken
Contains values that conform to the rules of None the name token. Example: Cust1
None
nmtokens
Similar to nmtoken except it can have a list None of nmtoken values separated by white space. Example: Cust1 Cust2 Cust3
None
notation number
A NOTATION type A number with no limits on the digits Examples: 111, 3.14, -123.456E+10
None decimal
Note
For ADO RecordSets, a special case exists where the number might have Currency type. When dt:type='number'in an ADO XDR Schema, Visual FoxPro checks for the existence of rs:dbtype='currency'.
r4
Same as float but only 4-byte encoding. Value ranges from 1.17549435E-38F to 3.40282347E+38F.
Double
float
r8
Specifies a floating point number. This data Double type supports only 15 digits of precision and value ranges from 2.2250738585072014E308 to 1.7976931348623157E+308. Specifies a string. Example: "This is a string" Character, if maxLength is less than 255. Otherwise, Memo.
double
string
string
time
Specifies a time in a subset of the ISO 8601 None format with no date and no time zone. Example: "08:15:27"
None
time.tz
Specifies a time in a subset of the ISO 8601 None format with no date but optional time zone. Example: "08:15:27-05:00"
None
ui1
Integer
unsignedByte
ui2
Specifies a 2-byte unsigned integer ranging from 0 to 65535. Examples: 1, 255, 65535
Integer
unsignedShort
ui4
Specifies a 4-byte unsigned integer ranging from 0 to 4294967296. Examples: 1, 703, 3000000000
Character or Integer
unsignedInt
ui8
Specifies an 8-byte unsigned integer ranging Character or from 0 to 18446744073709551615. Integer Example: 1483433434334
unsignedLong
uri
Memo
anyURI
Example: "urn:schemas-microsoftcom:Office9" uuid Contains hexadecimal digits representing octets with optional embedded hyphens that are ignored. Example: 333C7BC4-460F-11D0-BC040080C7055A83
All data in Visual FoxPro have a particular data type, which defines values permitted for the data and the range and size of those values. After you identify and specify the data type you are using, Visual FoxPro can efficiently store and manipulate the data. When you create a table, you can specify the type of data to store in each field of the table. You can specify more data types for fields in a table than for variables and arrays. Variables and arrays can store only a subset of the available Visual FoxPro data types; however. The value you store in a variable or array element determines the type of data in the variable or array element. For more information, see How to: Choose Data Types.
Tip
You can use the TYPE( ) function to determine the type of data stored in a variable, array element, or field.
Visual FoxPro Data Types
Data type
Blob
Description
Size
Range
Limited by available memory and/or 2GB file size limit.
Binary data of indeterminate 4 bytes in a length. table Blob values are in a memo (.fpt) file. No code page translation is performed onBlob data.
Character Alphanumeric text For example, a customer address Currency Monetary amounts For example, the price of an item
Any characters
- $922337203685477.5807 to $922337203685477.5807
Date
Chronological data consisting of month, day, and year For example, an order date
8 bytes
When using strict date formats, {^0001-01-01}, January 1st, 1 A.D to {^9999-12-31}, December 31st, 9999 A.D. When using strict date formats, {^0001-01-01}, January 1st, 1 A.D to {^9999-12-31}, December 31st, 9999 A.D., plus 00:00:00 a.m. to 11:59:59 p.m.
DateTime Chronological data consisting of month, day, year, hours, minutes, and seconds For example, date and time of arrival Logical Boolean value of True or False For example, whether or not an order has been filled Numeric
8 bytes
1 byte
Integers or decimal numbers 8 bytes in memory; 1 to For example, the quantity of 20 bytes in items ordered table
- .9999999999E+19 to . 9999999999E+20
Varbinary Binary values. Varbinary data is similar to Varchar data in that values do not include padding with zero (0) bytes. The length of the contained value is stored internally. No code page translation is performed onVarbinary data. Variant
1 byte per Any hexadecimal value hexadecimal value up to 255 total bytes
Variant data can be any of See other data See other data types. the Visual FoxPro data types types. and the null value. Once a value is stored to a variant, the variant assumes the data type of the data it contains. Variants are designated with
Field type
Description
Size
Range
Character Any Character data that you do not 1 byte per Any characters (Binary) want translated across code pages character to 254 For example, user passwords stored in a table and used in different countries or regions. Double A double-precision floating-point number For example, scientific data requiring a high degree of precision. Float Same as Numeric 8 bytes in memory; 1 to 20 bytes in table 4 bytes in table 8 bytes +/-4.94065645841247E324 to +/8.9884656743115E307
- .9999999999E+19 to . 9999999999E+20
General
Integer
4 bytes
-2147483647 to 2147483647
Integer Same as Integer but also an (Autoinc) automatically incrementing value. Read-only. Memo
4 bytes
Value controlled by autoincrement Next and Step values. Limited by available memory.
Alphanumeric text of indeterminate 4 bytes in length or reference to a block of data table For example, notes about a phone call in a phone log.
Memo (Binary)
Same as Memo except that memo field data does not change across code pages For example, a login script used in different countries or regions.
4 bytes in table
Varchar
Alphanumeric text. Varchar is similar to Character except values in Varcharfields do not include padding with additional spaces. The length of the contained value is stored internally.
Varchar (Binary)
Varchar type data that you do not want translated across code pages.
Each data type has its own characteristics, including storage size: Data Type Storage Differences
To see a list of the functions you can use with each data type, see Language Categories.