jsp中的参数和xml中的结果


parameter in jsp and result in xml

我想用jsp代码中的参数调用一个php链接,并检索xml格式的返回值。

http://www.example.com/test.php?id=10

它在xml块中返回id和值

我如何将这个xml返回到我的jsp页面,并解析它以表格形式呈现

id值

谢谢!提前

假设我们有以下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!