Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Create cursors from an xsd file, no xml yet
Message
 
 
À
20/12/2007 16:21:18
Information générale
Forum:
Visual FoxPro
Catégorie:
XML, XSD
Versions des environnements
Visual FoxPro:
VFP 9 SP1
OS:
Windows XP SP2
Network:
Windows 2003 Server
Database:
MS SQL Server
Divers
Thread ID:
01276819
Message ID:
01276913
Vues:
28
This message has been marked as a message which has helped to the initial question of the thread.
Hi Tracy,

Sure
CLEAR
CLOSE TABLES ALL 

TEXT TO cDummyXML NOSHOW TEXTMERGE
<?xml version = "1.0" encoding="Windows-1252" standalone="yes"?>
<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="someTable" minOccurs="0" maxOccurs="unbounded">
					<xsd:complexType>
						<xsd:sequence>
							<xsd:element name="somefield">
								<xsd:simpleType>
									<xsd:restriction base="xsd:string">
										<xsd:maxLength value="10"/>
									</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>
ENDTEXT 

*** Wrap schema into Recordset tags ***
cDummyXML = STUFF(cDummyXML, AT("?>", cDummyXML)+2, 0, "<VFPDataSet>") + "</VFPDataSet>"
***

LOCAL oXA as XMLAdapter, oXT as XMLTable

oXA=CREATEOBJECT("XMLAdapter")
oXA.LoadXML(cDummyXML)

FOR EACH oXT IN oXA.Tables
	oXT.ToCursor()
	SELECT (oXT.Alias)
	?"Alias=",ALIAS()
	AFIELDS(aflds)
	DISPLAY MEMORY LIKE aflds 
NEXT
>Beautiful, thanks Sergey! :o)
>
>Another question you may know the answer to: is there anyway to use a schema in memory instead of on disk with the xmladapter? I'd like to keep from storing the xsd on disk. I have it in a prg and use
>
>TEXT TO cschema ...
>ENDTEXT
>
>STRTOFILE(cschema)...
>
--sb--
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform