Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Is there a way to convert XSD to a table structure?
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
XML, XSD
Versions des environnements
Visual FoxPro:
VFP 9
OS:
Windows XP SP2
Network:
Windows 2000 Server
Database:
Visual FoxPro
Divers
Thread ID:
01025314
Message ID:
01028248
Vues:
26
>Hi Dawa,
>
>>I don't have "Start Menu\Programs\MSXML 4.0\Microsoft XML 4.0 Parser SDK" menu item at all anywhere under "Start Menu".
>>
>
>Check installation folder for MSXML SDK. On my system I have C:\Program Files\MSXML 4.0\doc folder, which contains xmlsdk.chm file. If it is not there, you may need to rerun setup, perhaps help file installation is optional and you didn't chose to install it.
>
>
>>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".
>>
>
>I don't know why you are getting this error. The following code uses XML Schema with a Namespace, it doesn't report any error for me:
>
>
>CLEAR
>CLOSE TABLES ALL
>
>TEXT TO cSomeSchema NOSHOW
><?xml version = "1.0" encoding="Windows-1252" standalone="yes"?>
><xsd:schema id="VFPDataSet" targetNamespace="SomeNamespace" xmlns="SomeNamespace"
&gt;		xmlns:xsd="http://www.w3.org/2001/XMLSchema"
&gt;		xmlns:msdata="urn:schemas-microsoft-com:xml-msdata"
&gt;		attributeFormDefault="qualified" elementFormDefault="qualified">
>	<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" 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("SomeNamespace",oDom.documentElement)
>oSchema=oCache.getSchema("SomeNamespace")
>?oSchema.targetNamespace
>oVFPDataSet=oSchema.elements(0)
>?oVFPDataSet.namespaceURI,oVFPDataSet.name
>oSomeTable=oVFPDataSet.type.contentModel.particles(0)
>?oSomeTable.namespaceURI,oSomeTable.name
>oSomefield=oSomeTable.type.contentModel.particles(0)
>?oSomefield.namespaceURI,oSomefield.name, ;
>	oSomefield.type.baseTypes(0).name, oSomefield.type.maxLength
>
>

Aleksey,

I found out why I'm getting the error. It was because of the case sensitity of XML document, I had the last three letters of the namespaceURI spelled in lower case which should have been upper case.

I've something else though.
In the following line:
oSomeTable=oVFPDataSet.type.contentModel.particles(0)
I don't see contentModel in the IntelliSense list.

May be I'm missing something with MSXML installation. I've downloaded and installed MSXML 4.0 Service Pack 2 (Microsoft XML Core Services) from http://www.microsoft.com/downloads/details.aspx?FamilyID=3144b72b-b4f2-46da-b4b6-c5d7485f2b42&DisplayLang=en

Should I download something different?

Thanks,
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

Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform