Help PhP and XML !!

M

mkdirect

Hi,

I am having a real nightmare working with XML data.

I have the following code in my site:

<!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>
<title>Checker</title>
</head>
<body>
<form style="WIDTH: 433px; HEIGHT: 540px"
action="https://partners.enta.net/xml/ADSLChecker.php" method="get"
name="ADSLChecker">
Telephone No
<input name="PhoneNo">
<input type="submit" name="submit" value="Submit">
</form>
</body>
</html>

The form works great, and returns a page with an XML Tree full of
information but I cannot seem to work out how to capture the the XML
data format it and then display the sections that I need for the user.

I am probably missing something really obvious and any help will be
greatly appreciated.

Thanks in advance.

PJ
 
D

David Dorward

I am having a real nightmare working with XML data.

I have the following code in my site:
<input name="PhoneNo">
<input type="submit" name="submit" value="Submit">

Your XHTML is invalid and not well-formed. Any XML parser is required to
throw an error when dealing with it.
The form works great, and returns a page with an XML Tree full of
information but I cannot seem to work out how to capture the the XML
data format it and then display the sections that I need for the user.

So when the form is submitted, the server returns some XML data? And you
want to present that data to the user?

That makes the code you've shown us largely irrelevant. The best option is
likely to be to change your server side script so it returns HTML instead
of XML. Otherwise you could look into client side XSLT (and there are no
shortage of XSLT tutorials out there).
 
P

PJ

Hi David,

Thanks for your response.

The code in the form is basic HTML and is submitted to a PHP page on my
suppliers server.

This page then generates and returns XML data which is what I am having
trouble working with as I cannot seem to be able to capture the XML
prior to it being displayed so that it could be formatted in to
something meaningful for the user/viewer.

Any suggestions would be really appreciated.

PJ
 
J

Johannes Koch

PJ said:
The code in the form is basic HTML and is submitted to a PHP page on my
suppliers server.

This page then generates and returns XML data which is what I am having
trouble working with as I cannot seem to be able to capture the XML
prior to it being displayed so that it could be formatted in to
something meaningful for the user/viewer.

So the HTML code you posted _is_ irrelevant to your problem. Your
problem is in the PHP code. There are methods in PHP to parse/transform
XML. Use these and then send the result back to the user agent.
 
A

Andy Dingley

The form works great, and returns a page with an XML Tree full of
information

<form>s don't return information. The _targets_ of <form>s return
information. In your case this is some 3rd party server.

Don't return this XML to your user. In general, don't _ever_ return
3rd party information to your user. Process it on your server first,
using a simple XSLT transformation to turn it into HTML.

Also check the licensing of the 3rd party service and whether you're
allowed to do this. Also check (an ongoing task) that their server
keeps working, and keeps working in the same way. Subtle changes to
their output could break your code, particularly if you don't code your
XSLT to be robust.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,001
Messages
2,570,250
Members
46,848
Latest member
Graciela Mitchell

Latest Threads

Top