我想从我的jsp代码中调用带有参数的php链接,并检索xml格式的返回值。
http://www.example.com/test.php?id=10
它在xml块中返回id和值
如何获取此xml以返回我的jsp页面并将其解析为以表格形式呈现
id值
谢谢!提前。
答案 0 :(得分:0)
假设我们有以下XML文件“note.xml”:
<?xml version="1.0" encoding="ISO-8859-1"?>
<note>
<to>Tove</to>
<from>Jani</from>
<heading>Reminder</heading>
<body>Don't forget me this weekend!</body>
</note>
现在我们要从上面的XML文件中输出不同的信息:
<?php
$xml=simplexml_load_file("note.xml");
echo $xml->to . "<br>";
echo $xml->from . "<br>";
echo $xml->heading . "<br>";
echo $xml->body;
?>
输出将是: -
Tove
Jani
Reminder
Don't forget me this weekend!