开发者

How to read the XML file in java [closed]

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, over开发者_如何学运维ly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center. Closed 11 years ago.
<?xml version="1.0"?> 
<smooks-resource-list xmlns="http://www.milyn.org/xsd/smooks-1.1.xsd" 
xmlns:ftl="http://www.milyn.org/xsd/smooks/freemarker-1.1.xsd" 
xmlns:db="http://www.milyn.org/xsd/smooks/db-routing-1.1.xsd" 
xmlns:jb="http://www.milyn.org/xsd/smooks/javabean-1.2.xsd" 
xmlns:ds="http://www.milyn.org/xsd/smooks/datasource-1.1.xsd"> 

<ds:direct bindOnElement="#document" datasource="DB" driver="com.mysql.jdbc.Driver" url="jdbc:mysql://localhost/dbase" username="root" password="praya123"   autoCommit="false" /> 
<db:executor executeOnElement="Invoice" datasource="DB" executeBefore="true"> 
<db:statement>SELECT * FROM custinfo</db:statement> 
<db:resultSet name="rs_custinfo" /> 
</db:executor> 
<db:executor executeOnElement="Invoice" datasource="DB" executeBefore="true"> 
<db:statement>select * from callRates</db:statement> 
<db:resultSet name="rs_callRates" /> 
</db:executor> 
<db:executor executeOnElement="Invoice" datasource="DB" executeBefore="true"> 
<db:statement>select * from InvoiceSummary</db:statement> 
<db:resultSet name="rs_InvoiceSummary" /> 
</db:executor> 
<db:executor executeOnElement="Invoice" datasource="DB" executeBefore="true"> 
<db:statement>select * from InvoiceDetail</db:statement> 
<db:resultSet name="rs_InvoiceDetail" /> 
</db:executor> 

<ftl:freemarker applyOnElement="Invoice"> 
<ftl:template> 

<!-- 
<#assign x=1> 
<#list 1..x as i> 

<DETAIL> 
<DT_INV_HDR1>${rs_custinfo[i].BillingAccNo}</DT_INV_HDR1> 
<DT_INV_HDR2>${rs_custinfo[i].CustNo}</DT_INV_HDR2> 
<DT_INV_HDR3>${rs_custinfo[i].InvoiceNo}</DT_INV_HDR3> 
<DT_INV_HDR4>${rs_custinfo[i].InvoiceDate}</DT_INV_HDR4> 
<DT_INV_HDR5>${rs_custinfo[i].PaymentDueDate}</DT_INV_HDR5> 
<DT_INV_HDR6/> 
<DT_INV_HDR7/> 
</DETAIL> 

</#list> 
--> 

</ftl:template> 
</ftl:freemarker> 
</smooks-resource-list>

how to fetch data with java ? Can anyone give any specific way to do that ?


DZone has a very good, comprehensive refacrd on this you should read.


Look here: http://www.mkyong.com/java/how-to-read-xml-file-in-java-dom-parser/

Edit: You'll find a class to parse XML, it may be useful.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜