Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
XMLAdapter Code Examples
Message
General information
Forum:
Visual FoxPro
Category:
XML, XSD
Environment versions
Visual FoxPro:
VFP 9 SP1
OS:
Windows XP SP2
Miscellaneous
Thread ID:
01131922
Message ID:
01131966
Views:
16
Well, I tried and while I do believe that will work its not working because of something in the schema that is messing things up for me. Here's the code I put together
loXMLAdapter = CREATEOBJECT('XMLAdapter')

WITH m.loXMLAdapter
	.UTF8Encoded = .T.
	.RespectNesting = .T.
	.LoadXML('export_pos_response-test.xml', .T.)
ENDWITH

FOR i = 1 TO loXMLAdapter.Tables.Count
	loXMLAdapter.Tables(i).Tocursor()
ENDFOR

RETURN
The error I am getting is

XML Error: XML Parse error: The element 'export_pos_response' is used but not declared in the DTD/Schema.

Below is the XML. Note the schema being referred to is a website outside my control.

Thanks again
<?xml version="1.0" encoding="UTF-8"?>
<export_pos_response xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 

xsi:noNamespaceSchemaLocation="https://xxx.xxxxxxxxxxxxx.xxx/xxxxx/xxx/export_pos_response.xsd" schemaVersion="4.3">
  <authentication>
    <shortcut>someshortcut</shortcut>
    <email>someone@somesite.com</email>
    <userAgent>someagent</userAgent>
  </authentication>
  <purchaseOrders>
    <purchaseOrder purchaseOrderNumber="407446" purchaseOrderId="31">
      <description>None</description>
      <status>Shipped</status>
      <confirmationNumber>PO# 0 1887045</confirmationNumber>
      <endUserPONumber>internal</endUserPONumber>
      <deleted>false</deleted>
      <autofulfill>true</autofulfill>
      <dropship>true</dropship>
      <blindPackaging>true</blindPackaging>
      <shipComplete>false</shipComplete>
      <allowBackorder>false</allowBackorder>
      <event type="created" when="2006-06-21T10:19:59-04:00">
        <user userId="626263">
          <firstName>John</firstName>
          <lastName>Smith</lastName>
          <email>someone@somesite.com</email>
        </user>
      </event>
      <event type="ordered" when="2006-06-21T10:23:56-04:00">
        <user userId="626263">
          <firstName>John</firstName>
          <lastName>Smith</lastName>
          <email>someone@somesite.com</email>
        </user>
      </event>
      <event type="modified" when="2006-06-21T10:23:56-04:00">
        <user userId="626263">
          <firstName>John</firstName>
          <lastName>Smith</lastName>
          <email>someone@somesite.com</email>
        </user>
      </event>
      <note type="Internal" />
      <note type="External" />
      <note type="Shipping" />
      <carrierAccount />
      <shipTo addressId="80" code="">
        <description>Chris, Smith, 101 An.., Anywhe..</description>
        <firstName>Chris</firstName>
        <lastName>Smith</lastName>
        <title />
        <companyName>Canon Technology Solutions</companyName>
        <addressLine1>1 Any street</addressLine1>
        <addressLine2 />
        <city>Anywhere</city>
        <state abbreviation="PA">Pennsylvania</state>
        <country abbreviation="USA">United States</country>
        <postalCode>98765</postalCode>
        <work_phone />
        <fax />
        <email />
      </shipTo>
      <billTo addressId="79" code="">
        <description>John, Jones, 1 An.., Anywhe..</description>
        <firstName>John</firstName>
        <lastName>Jones</lastName>
        <title />
        <companyName>Canon Technology Solutions</companyName>
        <addressLine1>1 Any Street</addressLine1>
        <addressLine2 />
        <city>Anywhere</city>
        <state abbreviation="PA">Pennsylvania</state>
        <country abbreviation="USA">United States</country>
        <postalCode>98765</postalCode>
        <work_phone>123.456.7890</work_phone>
        <fax>123.456.9876</fax>
        <email />
      </billTo>
      <buyer userId="626263">
        <firstName>John</firstName>
        <lastName>Jones</lastName>
        <email>someone@somesite.com</email>
      </buyer>
      <supplier supplierId="3" accountNumber="654321">SUPPLIER</supplier>
      <supplierSalesPerson userId="0">
        <firstName />
        <lastName />
        <email />
      </supplierSalesPerson>
      <shippingMethod>
        <carrier carrierId="5">UPS</carrier>
        <service shipServiceId="3">UPS Ground</service>
      </shippingMethod>
      <payment paymentType="American Express">
        <PONumber>407446</PONumber>
        <authorizationNumber />
      </payment>
      <itemList>
        <product selected="false" lineNumber="1" itemId="11" productId="M002209333">
          <supplier supplierId="3" accountNumber="654321">SUPPLIER</supplier>
          <SKU>1031802</SKU>
          <partNumber>ST625211U-RK</partNumber>
          <manufacturer>SEAGATE</manufacturer>
          <inventory>28</inventory>
          <unitOfMeasure />
          <description>2.5GB 2MB USB2.0 Pocket 1inch</description>
          <cost unit="USD" priceLevel="" priceCode="0">77.06</cost>
          <MSRP unit="USD">99.00</MSRP>
          <weight>0.50</weight>
          <quantity>2</quantity>
          <note />
          <category code="C">Storage Devices</category>
          <subCategory code="CA">Hard Drives</subCategory>
          <productLinks>
            <linkedItemId docId="28" docNumber="1010" quantity="2" dropship="true">41</linkedItemId>
          </productLinks>
          <containers>
            <container containerId="3">
              <shipStatus>Shipped</shipStatus>
              <shipMethod>
                <carrier carrierId="2">FedEx</carrier>
                <service shipServiceId="18">Ground</service>
              </shipMethod>
              <quantity>2</quantity>
              <trackingNumber>117584219172889</trackingNumber>
              <shipDate>2006-06-21T18:00:37</shipDate>
              <serialNumber>3MD02GGJ</serialNumber>
              <serialNumber>3MD02ZZH</serialNumber>
            </container>
          </containers>
        </product>
      </itemList>
      <totalItemCost unit="USD">154.12</totalItemCost>
      <subTotal unit="USD">154.12</subTotal>
      <tax unit="USD">0.00</tax>
      <shippingHandling unit="USD">0.00</shippingHandling>
      <total unit="USD">154.12</total>
    </purchaseOrder>
  </purchaseOrders>
</export_pos_response>
>>Are there any good straight code examples of using the XMLAdapter to create tables from XML. I've managed to do a .LoadXML but I'm really not sure what I need to do next to turn what has been loaded into a table or even how to navigate it.
>
>Something like this maybe?
>
>* read in received XML data
>Local oXA2 as XMLAdapter
>oXA2 = NewObject("xmladapter")
>oXA2.LoadXML("c:\temp\myxmlfile.xml",.T.,.T.)
>Close Tables all
>For i = 1 to oXA2.tables.Count
>   oXA2.Tables.Item(i).ToCursor()
>EndFor
>oXA2.ReleaseXML(.t.)
>
John Gundrum
Canon Technology Solutions Inc.
Previous
Reply
Map
View

Click here to load this message in the networking platform