Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Create cursors from an xsd file, no xml yet
Message
De
20/12/2007 17:27:38
 
 
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:
01276914
Vues:
29
Wow, very cool. Thanks Sergey! :0) I looked all through the help for a way to do it and I totally missed it...

>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)...
>>
.·*´¨)
.·`TCH
(..·*

010000110101001101101000011000010111001001110000010011110111001001000010011101010111001101110100
"When the debate is lost, slander becomes the tool of the loser." - Socrates
Vita contingit, Vive cum eo. (Life Happens, Live With it.)
"Life is not measured by the number of breaths we take, but by the moments that take our breath away." -- author unknown
"De omnibus dubitandum"
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform