Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Loading xml fls to cursor which is created from any pr lang.
Message
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
XML, XSD
Title:
Loading xml fls to cursor which is created from any pr lang.
Miscellaneous
Thread ID:
00830574
Message ID:
00830574
Views:
60
Hi All,
with two sample below we can create and load xml files , but i wantto know that , these xml files creating by vfp ,sometimes we can to come acrros xml files created by vb,delphi or c++ etc. When we want to load these xml files they wont be include , xsd etc.. tags in xml files . How is the best way to load xml files to vfp cursors which created from any programming languages ?

TIA
* creating xml file...
cFile = "c:\vfptemp\EmployeeXML.xml"
OPEN DATABASE (_samples+"\northwind\northwind")
SELECT employeeid, lastname ;
FROM Employees;
INTO CURSOR curEmployees
oAdapter = CREATEOBJECT("XMLAdapter")
oAdapter.AddTableSchema("curEmployees")
oAdapter.ToXML(cFile,,.T.) 

* showing xml file 
cFile = "c:\vfptemp\employeexml.xml"
oAdapter = CREATEOBJECT("XMLAdapter")
oAdapter.LoadXML(cFile,.T.)
oAdapter.Tables(1).ToCursor()
BROWSE

* created xml file

<?xml version = "1.0" encoding="Windows-1252" standalone="yes"?>
<VFPDataSet>
    <xsd:schema id="VFPDataSet" xmlns:xsd="http://www.w3.org/2001/XMLSchema"; xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
        <xsd:element name="VFPDataSet" msdata:IsDataSet="true">
            <xsd:complexType>
                <xsd:choice maxOccurs="unbounded">
                    <xsd:element name="curEmployees" minOccurs="0" maxOccurs="unbounded">
                        <xsd:complexType>
                            <xsd:sequence>
                                <xsd:element name="employeeid" type="xsd:int"/>
                                <xsd:element name="lastname">
                                    <xsd:simpleType>
                                        <xsd:restriction base="xsd:string">
                                            <xsd:maxLength value="20"/>
                                        </xsd:restriction>
                                    </xsd:simpleType>
                                </xsd:element>
                            </xsd:sequence>
                        </xsd:complexType>
                    </xsd:element>
                </xsd:choice>
                <xsd:anyAttribute namespace="http://www.w3.org/XML/1998/namespace"; processContents="lax"/>
            </xsd:complexType>
        </xsd:element>
    </xsd:schema>
    <curEmployees>
        <employeeid>1</employeeid>
        <lastname>Davolio</lastname>
    </curEmployees>
    <curEmployees>
        <employeeid>2</employeeid>
        <lastname>Fuller</lastname>
    </curEmployees>
    <curEmployees>
        <employeeid>3</employeeid>
        <lastname>Leverling</lastname>
    </curEmployees>
    <curEmployees>
        <employeeid>4</employeeid>
        <lastname>Peacock</lastname>
    </curEmployees>
    <curEmployees>
        <employeeid>5</employeeid>
        <lastname>Buchanan</lastname>
    </curEmployees>
    <curEmployees>
        <employeeid>6</employeeid>
        <lastname>Suyama</lastname>
    </curEmployees>
    <curEmployees>
        <employeeid>7</employeeid>
        <lastname>King</lastname>
    </curEmployees>
    <curEmployees>
        <employeeid>8</employeeid>
        <lastname>Callahan</lastname>
    </curEmployees>
    <curEmployees>
        <employeeid>9</employeeid>
        <lastname>Dodsworth</lastname>
    </curEmployees>
</VFPDataSet>
Next
Reply
Map
View

Click here to load this message in the networking platform