1
我想使用JSTL解析来自Web服务的XML。 XML包含导致具有分析问题的命名空间,并输出结果使用JSTL解析包含名称空间的XML
XML字符串:
<MonthlyPayments:paymentsSummary xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:MonthlyPayments="http://www.zillow.com/static/xsd/MonthlyPayments.xsd" xsi:schemaLocation="http://www.zillow.com/static/xsd/MonthlyPayments.xsd http://www.zillowstatic.com/vstatic/LATEST/static/xsd/MonthlyPayments.xsd">
<request>
<price>100000</price>
<down>15</down>
<zip>98104</zip>
</request>
<payment loanType="thirtyYearFixed">
<rate>4.2</rate>
<monthlyPrincipalAndInterest>416</monthlyPrincipalAndInterest>
<monthlyMortgageInsurance>31</monthlyMortgageInsurance>
</payment>
</MonthlyPayments:paymentsSummary>
JSP文件(resultString包含XML):
<c:set var="xmldocument">${map.resultString}</c:set>
<x:parse var="doc" xml="${xmldocument}" />
...
<x:out select="$doc/MonthlyPayments/request/price" />
在拆除中的paymentSummary部分XML的输出是正确的1000000.我需要能够解析包含命名空间的XML。请帮忙?
检查类似的问题这里:http://stackoverflow.com/questions/17580051/accessing-imported-xml-element-attri弼与-A-给定名称空间中-A-JSP – Prasad