first of all Thank You for your reply.
I am sending the program, XSD file and XML file with this post.
Please help me.
==== Program
CLEAR all
CLOSE all
RELEASE all
CLEAR
TEXT TO cxml noshow
<?xml version="1.0" standalone="yes"?>
<NewDataSet>
<xs:schema id="NewDataSet" xmlns="" xmlns:xs="
xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xs:element name="NewDataSet" msdata:IsDataSet="true">
<xs:complexType>
<xs:choice maxOccurs="unbounded">
<xs:element ref="PromoAvails" />
</xs:choice>
</xs:complexType>
</xs:element>
ENDTEXT
pcFile = GETFILE('XML', 'Select XML to open')
lcSchemaFile = GETFILE('XSD', 'Select XSD to open')
pcXSDFileName= lcSchemaFile
pcCallSign = 'ABCD'
cxsd=FILETOSTR(lcSchemaFile)
cxsd=SUBSTR(cxsd,AT("<",cxsd,3)) &&should start with <xs:element name
cxmlfile=FILETOSTR(pcFile)
cxmlfile=SUBSTR(cxmlfile,AT("<",cxmlfile,2))
cxmlfile=[<PromoAvails xmlns:xsi="
xsi:noNamespaceSchemaLocation="] + pcXSDFileName + [" logDate="2009-08-10" callSign="ABCD">]+ cxmlfile
finalcxml=cxml+cxsd+cxmlfile+"</NewDataSet>"
=STRTOFILE(finalcxml,'PromoAvails.xml')
LOCAL loMyXMLAD AS xmladapter
lcMyXMLFile = [PromoAvails.xml]
loMyXMLAD = NEWOBJECT([XMLADAPTER])
loMyXMLAD.LoadXML(finalcxml,.f., .f.)
FOR EACH oTable IN loMyXMLAD.TABLES
FOR EACH ofield IN otable.fields
IF ofield.datatype="M" THEN
ofield.datatype="C"
ofield.maxlength=50
ENDIF
IF oField.MaxLength > 230 THEN
oField.maxLength = 200
ENDIF
ENDFOR
oTable.TOCURSOR()
ENDFOR
SET STEP ON
SELECT('Inventory')
BROWSE
SET STEP ON
======= XSD FILE
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="
elementFormDefault="qualified">
<xs:element name="PromoAvails">
<xs:complexType>
<xs:sequence>
<xs:element name="Program" maxOccurs="unbounded">
<xs:complexType>
<xs:sequence>
<xs:element name="Episode" maxOccurs="unbounded">
<xs:complexType>
<xs:sequence>
<xs:element name="Break" maxOccurs="unbounded">
<xs:complexType>
<xs:sequence>
<xs:element name="Inventory" maxOccurs="unbounded">
<xs:complexType>
<xs:sequence>
<xs:element name="ScheduledPromo" minOccurs="0" maxOccurs="unbounded">
<xs:complexType>
<xs:attribute name="promoId" type="xs:int" use="required"/>
<xs:attribute name="startTime" use="required">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:maxLength value="8"/>
</xs:restriction>
</xs:simpleType>
</xs:attribute>
<xs:attribute name="length" type="xs:string" use="required"/>
</xs:complexType>
</xs:element>
</xs:sequence>
<xs:attribute name="name" use="required">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:maxLength value="50"/>
</xs:restriction>
</xs:simpleType>
</xs:attribute>
<xs:attribute name="capacity" type="xs:string" use="required"/>
<xs:attribute name="capacityUsed" type="xs:string" use="required"/>
<xs:attribute name="startTime" use="required">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:maxLength value="8"/>
</xs:restriction>
</xs:simpleType>
</xs:attribute>
<xs:attribute name="logBreakId" type="xs:string" use="optional"/>
<xs:attribute name="housenumber" use="optional">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:maxLength value="50"/>
</xs:restriction>
</xs:simpleType>
</xs:attribute>
<xs:attribute name="offsetLength" type="xs:string" use="optional"/>
<xs:attribute name="offsetframe" use="optional">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:maxLength value="8"/>
</xs:restriction>
</xs:simpleType>
</xs:attribute>
<xs:attribute name="offsetdirection" type="xs:string" use="optional"/>
</xs:complexType>
</xs:element>
</xs:sequence>
<xs:attribute name="number" type="xs:string" use="optional"/>
<xs:attribute name="name" use="optional">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:maxLength value="50"/>
</xs:restriction>
</xs:simpleType>
</xs:attribute>
<xs:attribute name="startTime" use="required">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:maxLength value="8"/>
</xs:restriction>
</xs:simpleType>
</xs:attribute>
<xs:attribute name="length" use="optional">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:maxLength value="8"/>
</xs:restriction>
</xs:simpleType>
</xs:attribute>
</xs:complexType>
</xs:element>
</xs:sequence>
<xs:attribute name="referenceNumber" use="optional">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:maxLength value="50"/>
</xs:restriction>
</xs:simpleType>
</xs:attribute>
<xs:attribute name="name" use="optional">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:maxLength value="75"/>
</xs:restriction>
</xs:simpleType>
</xs:attribute>
<xs:attribute name="id" type="xs:string" use="optional"/>
<xs:attribute name="length" type="xs:string" use="optional"/>
<xs:attribute name="startTime" use="required">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:maxLength value="8"/>
</xs:restriction>
</xs:simpleType>
</xs:attribute>
</xs:complexType>
</xs:element>
</xs:sequence>
<xs:attribute name="startTime" use="required">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:maxLength value="8"/>
</xs:restriction>
</xs:simpleType>
</xs:attribute>
<xs:attribute name="id" type="xs:string" use="required"/>
<xs:attribute name="name" use="required">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:maxLength value="50"/>
</xs:restriction>
</xs:simpleType>
</xs:attribute>
<xs:attribute name="length" type="xs:string" use="required"/>
</xs:complexType>
</xs:element>
</xs:sequence>
<xs:attribute name="logDate" type="xs:date" use="required"/>
<xs:attribute name="callSign" use="required">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:maxLength value="6"/>
</xs:restriction>
</xs:simpleType>
</xs:attribute>
</xs:complexType>
</xs:element>
</xs:schema>
======== XML File
<PromoAvails logDate="2009-08-10" callSign="ABCD">
<Program startTime="06:30:00" id="PROGRAM ID" name="Craft Lab Mo 630A" length="00:30:00">
<Episode referenceNumber="DCLB-101" name="ABCDES" id="ABZCD-010" length="00:20:00" startTime="06:30:00">
<Break number="S1" name="S1" startTime="06:30:00" length="00:07:07">
<Inventory name="CC1" capacity="00:00:02" capacityUsed="00:00:00" startTime="06:30:00" logBreakId="5" houseNumber="" offsetLength="00:00:02" offsetFrame="00" offsetDirection="Forward" />
<Inventory name="CC2" capacity="00:00:02" capacityUsed="00:00:00" startTime="06:30:00" logBreakId="6" houseNumber="" offsetLength="00:00:30" offsetFrame="00" offsetDirection="Forward" />
<Inventory name="CC3" capacity="00:00:02" capacityUsed="00:00:00" startTime="06:30:00" logBreakId="7" houseNumber="" offsetLength="00:00:30" offsetFrame="00" offsetDirection="Backward" />
</Break>
</Episode>
</Program>
</PromoAvails>