Forum Moderators: phranque

Message Too Old, No Replies

XML Help Needed

How is it done?

         

MarkHutch

7:34 am on Jul 30, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I'm hoping someone here can help me with an XML question. What I'm trying to do is suppose to be simple, but I don't understand XML.

I have uploaded a search box where consumers can enter a car type and enter their zip code.

When the information is submitted, the other computer server replies with this response:

<?xml version="1.0"?>
- <response>
- <data-validation>
<data-validation-status>ok</data-validation-status>
</data-validation>
<dealer-available>true</dealer-available>
<lead-accepted>N/A</lead-accepted>
</response>

There are two possible <dealer-available> responses. TRUE OR FALSE.

What I want to do is have my website serve up one URL if the answer is "true" and another URL if the answer is "false". I was told this would be easy to do, but I can't figure out how to do it. If anyone can help, please post a reply. Thank you in advance.

[edited by: sugarkane at 9:33 am (utc) on July 31, 2003]
[edit reason] No URLs please [/edit]

DaveAtIFG

2:17 am on Aug 1, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I'll bet I know less than you about XML! :) We don't seem to have an abundance of XML wizards as members yet either...

This sounds like a commercial venture, possibly affiliate related, and some instructions are being provided to you. Perhaps if you paste the relavent parts into a post, we can help you decipher them.

Are you requesting data via a form at your site? At their site perhaps? How do you submit the data? It may give us a clue about how it is returned and how to handle it...

Is anyone familiar with this type thing? HALP!

bilalak

5:49 am on Aug 1, 2003 (gmt 0)

10+ Year Member



Hi
First of all, you have to use an XML parser. PHP has a great one and v easy to use.

When u parse this xml reply, you would get the xml structure into a multi dimensional array with its values and attributes. Then u can seelct the URL to redirect based on the value of this variable.

If you like to use just Client side, scripting, I think u can use VB to parse the XML and then display the corresponding URL.
This is not a pure XML programming but it is more related to Scripting.

dmorison

8:20 am on Aug 1, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



You don't really need the overhead of an XML parser for such a small result;

Simply do a string search of the entire response for <dealer-available>, get the starting position (call it n), and read the next 4 characters from position n+18. They will either be "true" or "fals".

This would be easy to do client side (in Javascript) or server side in any scripting language.

Mark - as DaveAtIFG says, we'd need a bit more context in order to provide more help...