Jump to content

I'm befuddled


TrudyD1474

Recommended Posts

I can get an XML feed from John Deere for our equipment. Using the following code, I am able to read the file.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Untitled Document</title></head><body><form name="feed" method="post" action="http://www.machinefinder.com/dealer_families/9398/machine_feed.xml" <http://www.machinefinder.com/dealer_families/9398/machine_feed.xml%22> >	<input name="key" value="448a6970-a02e-012e-d5e6-xxx">   <input name="password" value="xxxxx">   <input type="submit" name="Submit"></form></body></html>

And I get the following:

<?xml version="1.0" encoding="UTF-8"?><machines><dealer_family_id>9398</dealer_family_id><timestamp>2012-Aug-21 09:27:01 CDT</timestamp><machine><id>968208</id><images><image primary="true"><filePointer>http://www.machinefinder.com/images/machines/08/968208/849054_large_51696.jpg</filePointer></image></images><options><option><label>Type</label><value>Rake</value></option><option><label>Size</label><value>30'</value></option><option><label>Additional Options or Attachments</label><value>Front Guage Wheels shown but not included. add $750.00 for front or rear gauge wheels.</value></option></options><description>New Unit (representative photos)</description><advertised_price><amount>29950</amount><currency>USD</currency></advertised_price><wholesale_price><amount>29950</amount><currency>USD</currency></wholesale_price><dealerId>070859</dealerId><category>Hay Equipment - Handling and Transport</category><manufacturer>Other</manufacturer><model>Twinstar 2030 G2 Rake</model><serialNumber>XXXXX</serialNumber><operationHours/><modelYear>2012</modelYear><isNew>false</isNew><horsePower/><vatPct/><separatorHours/><createdTimestamp>2009-07-02 18:20:41 -0400</createdTimestamp><modifiedTimestamp>2012-05-07 13:54:57 -0400</modifiedTimestamp><stockNumber>May 2012</stockNumber><locationNotes>Othello</locationNotes>

I've found the following example here:

<html><body><script type="text/javascript">if (window.XMLHttpRequest)  {// code for IE7+, Firefox, Chrome, Opera, Safari  xmlhttp=new XMLHttpRequest();  }else  {// code for IE6, IE5  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");  }xmlhttp.open("GET","cd_catalog.xml",false);xmlhttp.send();xmlDoc=xmlhttp.responseXML;document.write("<table border='1'>");var x=xmlDoc.getElementsByTagName("CD");for (i=0;i<x.length;i++)  {  document.write("<tr><td>");  document.write(x[i].getElementsByTagName("ARTIST")[0].childNodes[0].nodeValue);  document.write("</td><td>");  document.write(x[i].getElementsByTagName("TITLE")[0].childNodes[0].nodeValue);  document.write("</td></tr>");  }document.write("</table>");</script></body></html>

Problem is, I don't know how to integrated this into what works at this time. What I want to do is format the data, but can't seem to get the above to work with my xml file.

  1. I need to know how to integrate a password and special key into the above.
  2. Or I need to know how to "write" code the the first example that reads the xml successfully.

My only choice here is HTML. I don't know PHP and my server doesn't support PHP. Please help.Thanks,

  • Like 1
Link to comment
Share on other sites

Maybe this is a bit easier to read. It's formatted fine on IE but won't copy well here.The good test fields to start with would be Model and Category.

<?xml version="1.0" encoding="UTF-8"?> -<machines> <dealer_family_id>9398</dealer_family_id> <timestamp>2012-Aug-21 09:27:01 CDT</timestamp>-<machine> <id>968208</id> -<images> -<image primary="true"> <filePointer>http://www.machinefinder.com/images/machines/08/968208/849054_large_51696.jpg</filePointer> </image> </images>-<options> -<option> <label>Type</label><value>Rake</value> </option> -<option> <label>Size</label> <value>30'</value> </option>-<option> <label>Additional Options or Attachments</label><value>Front Guage Wheels shown but not included. add $750.00 for front or rear gauge wheels.</value> </option> </options> <description>New Unit (representative photos)</description>-<advertised_price> <amount>29950</amount> <currency>USD</currency> </advertised_price>-<wholesale_price> <amount>29950</amount> <currency>USD</currency> </wholesale_price><dealerId>070859</dealerId><category>Hay Equipment - Handling and Transport</category> <manufacturer>Other</manufacturer> <model>Twinstar 2030 G2 Rake</model> <serialNumber>XXXXX</serialNumber><operationHours/> <modelYear>2012</modelYear><isNew>false</isNew> <horsePower/> <vatPct/><separatorHours/> <createdTimestamp>2009-07-02 18:20:41 -0400</createdTimestamp> <modifiedTimestamp>2012-05-07 13:54:57 -0400</modifiedTimestamp><stockNumber>May 2012</stockNumber> <locationNotes>Othello</locationNotes> </machine>

Link to comment
Share on other sites

third party domain data can't be fetched using ajax (the javascript example you have posted) for 'same domain policy'. if you have the xml file in your own domain you can do ajax request to get it and format it using js.otherwise only option you have left for using server side language like php.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...