Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Loading xml fls to cursor which is created from any pr l
Message
De
19/09/2003 08:10:08
Cetin Basoz
Engineerica Inc.
Izmir, Turquie
 
Information générale
Forum:
Visual FoxPro
Catégorie:
XML, XSD
Divers
Thread ID:
00830574
Message ID:
00830616
Vues:
16
>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>
>
>
Soykan,
Read XMLAdapter help. It's not designed to work from any source and with or w/o schema. XMLAdapter works with others too but is limited. ie: You shouldn't expect it to create hierarchy from say an ADO shaped XML or an XML with no XSD (having hierarchy through tags).
Use XMLToCursor() for general purpose.
Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform