Condividi tramite


LoadXML Method

Loads XML from a file or string into a Document Object Model (DOM) document and attaches it to the XMLAdapter object.

XMLAdapter.LoadXML( cXMLDocument [, lFile [, lValidateOnParse ]] )

Parameters

  • cXMLDocument
    Specifies an XML file name, XML string, or expression that evaluates to a valid XML file name or string.
  • lFile
    Specifies whether cXMLDocument is a file name. The default value of lFile is False (.F.).
  • lValidateOnParse
    Specifies whether the XML should be validated upon parsing. The default value of lValidateOnParse is True (.T.).

    For more information about how DOM performs validation, see the Microsoft XML Core Services (MSXML) 4.0 SDK on the MSDN Library Web site at https://msdn.microsoft.com/library/.

Remarks

Applies To: XMLAdapter Class

LoadXML sets the XMLAdapter IXMLDOMElement property. In addition, if the XML schema is analyzed, Visual FoxPro populates the Tables collection with a new set of XMLTable objects and sets the XMLAdapter XMLName, XMLNamespace, XMLPrefix, IsDiffgram, and SOM properties to appropriate values.

If the RespectNesting property of the XMLAdapter object is True (.T.), the LoadXML method preserves the XML hierarchy within the document. However, the method ignores the top level element declaration if that element is referenced from some other complex element. In that case, the method nests the XMLTable object for the referenced element into the XMLTable object for the element that has a reference to it.

If the XML document is not formatted as a Visual Studio dataset, then the XMLAdapter object leaves the XMLName and XMLPrefix properties empty. The XMLNamspace property is set to the targetNamespace attribute value for the xsd:schema node. Each XML element declared as an xsd:complexType is mapped to an XMLTable object, and the XMLNamespace property is set to namespaceURI for the element. The IsDiffgram and SOM properties are set to appropriate values.

The following property settings affect how LoadXML method is executed:

See Also

Reference

XMLAdapter Object Properties, Methods, and Events
IXMLDOMElement Property
Tables Collection (XMLAdapter)
XMLName Property
XMLNamespace Property
XMLPrefix Property
IsDiffGram Property
SOM Property
RespectNesting Property

Other Resources

Methods (Visual FoxPro)