Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
I'm a complete idiot about this topic
Message
From
17/06/2009 11:05:51
 
 
To
16/06/2009 16:22:50
General information
Forum:
Visual FoxPro
Category:
XML, XSD
Miscellaneous
Thread ID:
01406387
Message ID:
01406595
Views:
91
That worked but as that xml had no data in it, I switched to one that does. It's a basic Decode table.

This code works, except that I end up with 2 fields and no data rows
LOCAL oxml as XMLAdapter
oxml = NEWOBJECT("xmladapter")
oxml.XMLSchemaLocation = 'c:\cmbhs\caredecodetables.xml'
oxml.LoadXML("c:\cmbhs\CareDecodetables.xml",.t.,.t.)
?oXML.Tables.Item(1).Fields.Item(1).DataType	&& returns 'M'
?oxml.Tables.Count		&& returns 1
oxml.tables.Item(1).tocursor	&& creates cursor named 'cmbhscodetables'
here is the first part of the xml
<?xml version="1.0"?><xs:schema targetNamespace="http://CMBHSSchemas.MHCenter.CareDecodeTables" 
      xmlns="http://CMBHSSchemas.MHCenter.CareDecodeTables" 
  xmlns:b="http://schemas.microsoft.com/BizTalk/2003" 
  xmlns:xs="http://www.w3.org/2001/XMLSchema">
  <xs:element name="CMBHSCodeTables">
    <xs:complexType>
      <xs:sequence>
        <xs:element name="texas_zipcode" type="texas_zipcode"/>
        <xs:element name="presenting_problem" type="presenting_problem"/>
      </xs:sequence>
    </xs:complexType>
  </xs:element>

  <xs:simpleType name="presenting_problem">
    <xs:restriction base="xs:string">
      <xs:enumeration value="1"/>
      <!-- 1 MH (Mental Health) -->
      <xs:enumeration value="2"/>
      <!-- 2 MR (Mental Retardation) -->
      <xs:enumeration value="3"/>
      <!-- 3 ECI/DD (Early Childhood Intervention/Developmentally Delayed)-->
      <xs:enumeration value="4"/>
      <!-- 4 SA (Substance Abuse) -->
      <xs:enumeration value="5"/>
      <!-- 5 Related Condition - MR -->
    </xs:restriction>
  </xs:simpleType>
  <xs:simpleType name="texas_zipcode">
    <xs:restriction base="xs:string">
  <xs:enumeration value="75973"/>
  <xs:enumeration value="75973"/>
I figure you didn't want to see a million lines of Texas' zipcodes

Question is, how do I get the data to load? Am I incorrect in expecting the LoadXML to do it all in one pass?



>>ok, using the minimal code from their examples
>>
>>
>>LOCAL oxml as XMLAdapter
>>oxml = NEWOBJECT("xmladapter")
>>oxml.LoadXML("c:\cmbhs\cmbhsadultuniformassessment.xml")
>>?oXMLAdapter.Tables.Item(1).Fields.Item(1).DataType
>>
>>
>>It still fails on the "c:references tag"
>>
>>
>
>
>Dorris,
>
>If the file you posted earlier is the schema
>
>try the following
>
>if it does not work, post the contents of c:\cmbhs\cmbhsadultuniformassessment.xml
>
>
>>LOCAL oxml as XMLAdapter
>>oxml = NEWOBJECT("xmladapter")
>
>oxml.XMLSchemaLocation = 'The file you posted earlier'
>
>
>>oxml.LoadXML("c:\cmbhs\cmbhsadultuniformassessment.xml", .t., .t.)
>>?oxml .Tables.Item(1).Fields.Item(1).DataType
>
"You don't manage people. You manage things - people you lead" Adm. Grace Hopper
Pflugerville, between a Rock and a Weird Place
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform