Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Use XML as data source
Message
From
10/05/2005 06:32:03
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
 
To
10/05/2005 03:49:44
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
01012369
Message ID:
01012381
Views:
18
John,
There were some typo and missing elements in your code:
CA=CREATEOBJECT("CURSORADAPTER")
xa=CREATEOBJECT("xmladapter")
xa.LoadXML("myxml.xml",.T.)
ca.SelectCmd="xa.tables.item(1)"
ca.DataSourceType="XML"
ca.CursorFill()    
xa.Tables.Item(1).ToCursor()
xa.ReleaseXML(.F.) 
browse
xa.ToXML('updated.xml','',.T.)
Cetin

>Hi,
>Any sample code to use XMLAdapter and CursorAdapter to access and update XML data source?
>
>I tried the following but it doesn't work!
>
>CA=CREATEOBJECT("CURSORADAPTER")
>xa=CREATEOBJECT("xmladapter")
>xa.LoadXML("myxml",.T.)
>ca.SelectCmd="www.table.item(1)"
>?ca.CursorFill()    && RETURN .F. , Invalid at top level of document
>
>XML - myxml
>--------
>
><?xml version = "1.0" encoding="UTF-8" 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="aaa" minOccurs="0" maxOccurs="unbounded">
>						<xsd:complexType>
>							<xsd:sequence>
>								<xsd:element name="ckey">
>									<xsd:simpleType>
>										<xsd:restriction base="xsd:string">
>											<xsd:maxLength value="10"/>
>										</xsd:restriction>
>									</xsd:simpleType>
>								</xsd:element>
>								<xsd:element name="cclassname">
>									<xsd:simpleType>
>										<xsd:restriction base="xsd:string">
>											<xsd:maxLength value="10"/>
>										</xsd:restriction>
>									</xsd:simpleType>
>								</xsd:element>
>								<xsd:element name="cclasslibrary">
>									<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>
>	<aaa>
>		<ckey>0000000000</ckey>
>		<cclassname>aaaa</cclassname>
>		<cclasslibrary>aaaa</cclasslibrary>
>	</aaa>
>	<aaa>
>		<ckey>1111111111</ckey>
>		<cclassname>BBBB</cclassname>
>		<cclasslibrary/>
>	</aaa>
></VFPDataSet>
>
>
>Beside, how to update changes back to the XML data source?
>
>Thank you
Ç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
Previous
Reply
Map
View

Click here to load this message in the networking platform