Share via


ToCursor Method

Creates a cursor specified by XMLTable with the fields described by the XMLTableFields collection and loads it with data from the referenced XML document.

The ToCursor method is supported only for XMLTable objects in the XMLAdapter Tables collection.

XMLTable.ToCursor( [ lAppend [, cAlias [, nCodePage ]]] )

Parameters

  • lAppend
    Specifies whether to append data or records to an existing cursor specified by the cAlias parameter. The following table lists the values for lAppend.

    lAppend Description

    False (.F.)

    (Default) Does not add fields to an existing cursor.

    True. (.T.)

    Adds fields to an existing cursor.

  • cAlias
    Specifies the alias for the target cursor. The value of cAlias defaults to the XMLTableAlias property, including when cAlias is an empty string ("").
  • nCodePage
    Specifies a code page. The default value is zero (0).

Remarks

Applies To: XMLTable Class

If the XMLField Alias property is empty, the XMLTable ToCursor method disregards XMLField objects and creates a cursor that does not include any fields specified by those XMLField objects.

The nCodePage parameter must exist in the list of supported code pages. If nCodePage is zero (0) and the UseCodePage property is False (.F), the current default code page is used. For more information, see Code Pages Supported by Visual FoxPro and the UseCodePage Property.

When you use ToCursor to append data, Visual FoxPro adds an empty row if no XMLField object name matches any cursor column.

When mapping binary fields to Character data types, Visual FoxPro fills any remaining white space with 0x00 characters (CHR(0) or zeros) after decoding.

If the RespectNesting property of the XMLAdapter is True (.T.), the node must be an immediate child for the outer table's node. If the table is not nested, the node must be an immediate child for the XMLAdapter's node.

The ToCursor method fails if XMLAdapter.XMLNameIsXPath property is True (.T.) and XMLAdapter.IsDiffgram is True (.T.).

See Also

Reference

XMLTable Object Properties, Methods, and Events
Fields Collection (XMLTable)
XMLName Property
RespectNesting Property
Alias Property
XMLNameIsXPath Property
IsDiffGram Property
ToCursor Method
XMLField Class

Other Resources

Methods (Visual FoxPro)