Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Is there a way to convert XSD to a table structure?
Message
General information
Forum:
Visual FoxPro
Category:
XML, XSD
Environment versions
Visual FoxPro:
VFP 9
OS:
Windows XP SP2
Network:
Windows 2000 Server
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01025314
Message ID:
01027897
Views:
39
>>Aleksey,
>>
>>I did install the SDK but I don't know where the help file is installed or the name of the help file.
>>
>>Could you tell me what the file name is and where it would be installed?
>>If I were to create an instance of SOM, what class name should use in CreateObject?
>>
>>Thanks again,
>
>Hi Dawa,
>
>A short-cut to the help file should appear in your start menu. For me it is "Start Menu\Programs\MSXML 4.0\Microsoft XML 4.0 Parser SDK". Below is a small example how to get Schema object and work with it:
>
>
>CLEAR
>CLOSE TABLES ALL
>
>TEXT TO cSomeSchema NOSHOW
><?xml version = "1.0" encoding="Windows-1252" standalone="yes"?>
><xsd:schema id="VFPDataSet" xmlns:xsd="http://www.w3.org/2001/XMLSchema"
&gt;				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="15"/>
>									</xsd:restriction>
>								</xsd:simpleType>
>							</xsd:element>
>						</xsd:sequence>
>					</xsd:complexType>
>				</xsd:element>
>			</xsd:choice>
>			<xsd:anyAttribute namespace="http://www.w3.org/XML/1998/namespace"
&gt;						processContents="lax"/>
>		</xsd:complexType>
>	</xsd:element>
></xsd:schema>
>ENDTEXT
>
>cSchemaFileName=SYS(5)+CURDIR()+"schema.xsd"
>STRTOFILE(cSomeSchema, cSchemaFileName)
>
>oDom=CREATEOBJECT("Msxml2.DOMDocument.4.0")
>oDom.load(cSchemaFileName)
>oCache=CREATEOBJECT("Msxml2.XMLSchemaCache.4.0")
>oCache.add("",oDom.documentElement)
>oSchema=oCache.getSchema("")
>
>oVFPDataSet=oSchema.elements(0)
>?oVFPDataSet.name
>oSomeTable=oVFPDataSet.type.contentModel.particles(0)
>?oSomeTable.name
>oSomefield=oSomeTable.type.contentModel.particles(0)
>?oSomefield.name, oSomefield.type.baseTypes(0).name, oSomefield.type.maxLength
>
>
>Thanks,
>Aleksey.

Aleksey,

Thanks for the sample code!

I don't have "Start Menu\Programs\MSXML 4.0\Microsoft XML 4.0 Parser SDK" menu item at all anywhere under "Start Menu".

Based on your sample, I tried to read my XSD as follows:
oDom=CREATEOBJECT("Msxml2.DOMDocument.4.0")
m.odom.load("abcroot.xsd")
oCache=CREATEOBJECT("Msxml2.XMLSchemaCache.4.0")
m.ocache.add("http://www.myserver.com/abc",m.odom.documentElement)
oSchema = m.ocache.getSchema("http://www.myserver.com/abc")
I am getting an error at this line:
oSchema=oCache.getSchema("http://www.myserver.com/abc")
when I apply it to my schema file. My schema has a namespaceURI. The error says "OLE Error code 0x80020003: Member not found".

Thanks again
Dawa Tsering


"Do not let any unwholesome talk come out of your mouths,
but only what is helpful for building others up according to their needs,
that it may benefit those who listen."

- Ephesians 4:29-30 NIV

Dare to Question -- Care to Answer

Time is like water in a sponge, as long as you are willing you can always squeeze some.

--Lu Xun, Father of Modern Chinese Literature

Previous
Next
Reply
Map
View

Click here to load this message in the networking platform