Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Processing an XML file to VFP cursors
Message
General information
Forum:
Visual FoxPro
Category:
XML, XSD
Miscellaneous
Thread ID:
00904549
Message ID:
00906646
Views:
24
Hi Jamie,

If I run the following code the 'Loop 1' executes once.
'Loop 2' does not execute at all.

Help !
Thanks
Carmel



ox = Createobject("MSXml.DOMDocument")
ox.Load('ReadNodes_Request.xml') && or ox.LoadXML( YourXMLString )
myXmlString = ox.DocumentElement

** loop through the customer nodes
myCustomers = myXmlString.SelectNodes( "customers" )
For Each oCustumer In myCustomers
WAIT WINDOW 'loop 1'
tmpName = oCustumer.SelectSingleNode("customer/name")
? tmpName.Text
ENDFOR

myCustomers = myXmlString.SelectNodes( "customer" )
for each oCustomer in myCustomers
WAIT WINDOW 'loop 2'
tmpName = oCustomer.SelectSingleNode("customer_id")
? tmpName.Text
endfor



HERE IS THE XML FILE - ReadNodes_Request.XML
<?xml version="1.0" encoding="UTF-8"?><export_customers_response>
  <authentication>
    <revision>2.0</revision>
    <reseller_shortcut>eric</reseller_shortcut>
    <user_email>test@test.com</user_email>
  </authentication>
  <customers>
    <customer>
      <customer_number>AC0127</customer_number>
      <address_id>626</address_id>
      <name>acme corp</name>
      <address1>1234 lane ave</address1>
      <address2 />
      <address_line1>1234 lane ave</address_line1>
      <address_line2 />
      <city>powell</city>
      <state>Ohio</state>
      <state_abbrv>OH</state_abbrv>
      <zip>43065</zip>
      <country>United States</country>
      <country_abbrv>USA</country_abbrv>
      <phone />
      <fax />
      <website />
      <lead_source />
      <tax_exempt />
      <tax_id />
      <comments />
      <terms>No Terms</terms>
      <credit_limit />
      <sales>
        <name>Lundin, Eric</name>
        <email>eric.lundin@cnet.com</email>
        <price_profile>22% Mark-Up</price_profile>
        <price_profile_email>channelsupport@cnet.com</price_profile_email>
      </sales>
      <billing>
        <address_id>627</address_id>
        <title />
        <firstname>pat</firstname>
        <lastname>leneghan</lastname>
        <company>acme corp</company>
        <address1>1234 lane ave</address1>
        <address2 />
        <city>powell</city>
        <state>Ohio</state>
        <state_abbrv>OH</state_abbrv>
        <zip>43065</zip>
        <country>United States</country>
        <phone />
        <extension />
      </billing>
      <shipping>
        <address_id>627</address_id>
        <title />
        <firstname>pat</firstname>
        <lastname>leneghan</lastname>
        <company>acme corp</company>
        <address1>1234 lane ave</address1>
        <address2 />
        <city>powell</city>
        <state>Ohio</state>
        <state_abbrv>OH</state_abbrv>
        <zip>43065</zip>
        <country>United States</country>
        <phone />
        <extension />
      </shipping>
    </customer>
    <customer>
      <customer_number>111111</customer_number>
      <address_id>379</address_id>
      <name>University of Iowa</name>
      <address1>123</address1>
      <address2>main street</address2>
      <address_line1>123</address_line1>
      <address_line2>main street</address_line2>
      <city>Iowa City</city>
      <state>Iowa</state>
      <state_abbrv>IA</state_abbrv>
      <zip />
      <country>United States</country>
      <country_abbrv>USA</country_abbrv>
      <phone>111111111</phone>
      <fax />
      <website />
      <lead_source />
      <tax_exempt>1</tax_exempt>
      <tax_id>1</tax_id>
      <comments />
      <terms>Net 30 Days</terms>
      <credit_limit />
      <sales>
        <name>Lundin, Eric</name>
        <email>eric.lundin@cnet.com</email>
        <price_profile>Gold</price_profile>
        <price_profile_email>eric.lundin@cnet.com</price_profile_email>
      </sales>
      <billing>
        <address_id>383</address_id>
        <title />
        <firstname>joe</firstname>
        <lastname>Smith</lastname>
        <company>University of Iowa</company>
        <address1>123</address1>
        <address2>main street</address2>
        <city>Iowa City</city>
        <state>Iowa</state>
        <state_abbrv>IA</state_abbrv>
        <zip />
        <country>United States</country>
        <phone>111111111</phone>
        <extension />
      </billing>
      <shipping>
        <address_id>383</address_id>
        <title />
        <firstname>joe</firstname>
        <lastname>Smith</lastname>
        <company>University of Iowa</company>
        <address1>123</address1>
        <address2>main street</address2>
        <city>Iowa City</city>
        <state>Iowa</state>
        <state_abbrv>IA</state_abbrv>
        <zip />
        <country>United States</country>
        <phone>111111111</phone>
        <extension />
      </shipping>
      <contact>
        <address_id>80859</address_id>
        <title>Buyer</title>
        <firstname>Joe</firstname>
        <lastname>Smith</lastname>
        <company>University of Iowa</company>
        <address1>123 Main Street</address1>
        <address2 />
        <city>Iowa City</city>
        <state>Iowa</state>
        <state_abbrv>IA</state_abbrv>
        <zip />
        <country>United States</country>
        <phone>111111111</phone>
        <extension />
        <home_phone />
        <home_extension />
        <fax />
        <fax_extension />
        <email>joe@boise.com</email>
        <mobile />
        <mobile_extension />
        <pager />
        <website />
        <other />
        <other_extension />
      </contact>
      <contact>
        <address_id>80883</address_id>
        <title>buyer</title>
        <firstname>janet</firstname>
        <lastname>rich</lastname>
        <company>University of Iowa</company>
        <address1>123 main st</address1>
        <address2 />
        <city>Iowa</city>
        <state>Iowa</state>
        <state_abbrv>IA</state_abbrv>
        <zip>123435</zip>
        <country>United States</country>
        <phone />
        <extension />
        <home_phone />
        <home_extension />
        <fax />
        <fax_extension />
        <email>janet@boise.com</email>
        <mobile />
        <mobile_extension />
        <pager />
        <website />
        <other />
        <other_extension />
      </contact>
      <contact>
        <address_id>80884</address_id>
        <title>buyer</title>
        <firstname>worrell</firstname>
        <lastname>ray</lastname>
        <company>University of Iowa</company>
        <address1>1323 main</address1>
        <address2 />
        <city>Iowa</city>
        <state>Iowa</state>
        <state_abbrv>IA</state_abbrv>
        <zip>123456</zip>
        <country>United States</country>
        <phone />
        <extension />
        <home_phone />
        <home_extension />
        <fax />
        <fax_extension />
        <email>ray@boise.com</email>
        <mobile />
        <mobile_extension />
        <pager />
        <website />
        <other />
        <other_extension />
      </contact>
    </customer>
    <customer>
      <customer_number>AL0276</customer_number>
      <address_id>1103</address_id>
      <name>ADVANCED LOGIC INDUSTRIES</name>
      <address1>922 UNIVERSITY CITY BLVD</address1>
      <address2 />
      <address_line1>922 UNIVERSITY CITY BLVD</address_line1>
      <address_line2 />
      <city>BLACKSBURG</city>
      <state>Virginia</state>
      <state_abbrv>VA</state_abbrv>
      <zip>24060</zip>
      <country>United States</country>
      <country_abbrv>USA</country_abbrv>
      <phone>540-443-3378</phone>
      <fax>540-443-3365</fax>
      <website>http://ALI-INC.COM</website>
      <lead_source>WORD OF MOUTH</lead_source>
      <tax_exempt />
      <tax_id />
      <comments />
      <terms>Net 30 Days</terms>
      <credit_limit />
      <sales>
        <name>King, Ann</name>
        <email>ann@ali-inc.com</email>
        <price_profile>SILVER</price_profile>
        <price_profile_email>ann@ali-inc.com</price_profile_email>
      </sales>
      </customer>
    <customer>
      <customer_number>DO0206</customer_number>
      <address_id>878</address_id>
      <name>Difeo Oil</name>
      <address1 />
      <address2 />
      <address_line1 />
      <address_line2 />
      <city />
      <state>New Hampshire</state>
      <state_abbrv>NH</state_abbrv>
      <zip />
      <country>United States</country>
      <country_abbrv>USA</country_abbrv>
      <phone />
      <fax />
      <website />
      <lead_source />
      <tax_exempt />
      <tax_id />
      <comments />
      <terms>No Terms</terms>
      <credit_limit />
      <sales>
        <name>Hodgdon, David</name>
        <email>dave@portsmouthcomputergroup.com</email>
        <price_profile>22% Mark-Up</price_profile>
        <price_profile_email>channelsupport@cnet.com</price_profile_email>
      </sales>
    </customer>
  </customers>
</export_customers_response>
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform