Compartir a través de


XMLTOCURSOR( ) Function

Converts XML text into a Visual FoxPro cursor or table.

XMLTOCURSOR(XMLSource eExpression | cXMLFile [, cCursorName [, nFlags ]])

Returns

Numeric. The number of records created.

Parameters

  • eExpression
    Specifies the XML text or an expression that evaluates to valid XML data. This parameter can be a Visual FoxPro memory variable, memo field contents, or the return from an HTTP request. You also can specify return from a SOAP method call, XML from the XMLDOM, or an ADO stream. XMLCURSOR( ) generates an error if XMLSource is not found, or if eExpression does not parse to valid XML.
  • cXMLFile
    Name, and optionally, path of a physical XML file residing on the local machine or accessible on the network. If you do not specify a path, Visual FoxPro searches the FoxPro path for the XML file.
  • cCursorName
    Specifies the name of the cursor to contain the result. If you specify no cCursorName, Visual FoxPro returns the result to XMLRESULT. The cursor is created in the current work area unless it is already in use. In that case, the cursor is written to an unused work area.
  • nFlags
    Specifies how XMLSource eExpression is handled in XMLTOCURSOR( ) according to the following table:
    nFlag Bit Description
    4 0100 Preserve white space in data. Overrides the xml:space attribute of the XML data.
    512 01000000000 Parameter one (XMLSource eExpression or cXMLFile) is a string containing the name and path of an XML data file. The default nFlag value, 0, treats parameter one as a string containing XML data.
    1024 10000000000 NOCPTRANS – Character and Memo fields in the resultant cursor will be created with the NOCPTRANS option, and the text or xml values in the incoming elements will be inserted into the Character or Memo field on an untranslated, byte-for-byte basis.

Remarks

If a cursor is already open using the same name as the output cursor specified by cCursorName (or the default XMLRESULT if cCursorName is not specified), then the existing cursor is closed and the new cursor is created in the first available work area.

Visual FoxPro interprets XML files with or without schema. If no schema is provided, Visual FoxPro makes two passes through the XML data. The structure is determined during the first pass; the conversion is performed during the second pass. Visual FoxPro uses either external or internal schema to determine the cursor or table structure before making a single pass through the XML data.

See Also

Visual FoxPro and XML | CursorToXML( ) Function | XML UpdateGram( ) Function