我在XML中使用XML作为字符串。但是这个XML只在一行中。我想要显示在JSP中格式化的这个XML字符串。如何显示xml格式的jsp
例如:
<?xml version="1.0"?><catalog><book id="bk101"><author>Gambardella, Matthew</author><title>XML Developer's Guide</title><genre>Computer</genre><price>44.95</price>...(is going on)
我想这显示在JSP如下:
<?xml version="1.0"?>
<catalog>
<book id="bk101">
<author>Gambardella, Matthew</author>
<title>XML Developer's Guide</title>
<genre>Computer</genre>
<price>44.95</price>...(going on)
我怎样才能做到这一点?
我明白你的意思。但我不是指如何在jsp中显示字符串。我的意思是我可以如何显示这个字符串格式化XML树结构。 – omer 2011-04-12 11:53:45
@omer:从我的答案中使用方法来获取解析的字符串并在jsp中显示该字符串。它会显示整个XML。 – 2011-04-12 12:46:43