大家一起讨论一下XML 解析的方法吧

adonn 2002-10-09 04:54:03
同上
使用java 1.4.1 中所提供的 xml parser
...全文
43 8 打赏 收藏 转发到动态 举报
写回复
用AI写文章
8 条回复
切换为时间正序
请发表友善的回复…
发表回复
fdxjj 2002-10-14
  • 打赏
  • 举报
回复
有没有人自己编解析器的?
ggzzkk 2002-10-13
  • 打赏
  • 举报
回复
mark
TIYILON 2002-10-10
  • 打赏
  • 举报
回复
很简单的阿,还是推荐你先看一些基础教程。
sonicsir 2002-10-10
  • 打赏
  • 举报
回复
严重关注!
adonn 2002-10-09
  • 打赏
  • 举报
回复
假如我要实现如下情况:
<root>
<table>
<name age='30'>David Lee</name>
<address>SH Road</address>
<tel attribute='home>65101699</tel>
<language>Java, Javascript, VB, C++</language>
</table>
<table>
<name age='25'>Reys</name>
<address>BJ Road</address>
<tel attribute='home>66778899</tel>
<language>VB, PowerBuilder</language>
</table>
<table>
<name age='23'>Simon Tsai</name>
<address>NJ Road</address>
<tel attribute='home>66778909</tel>
<language>VC, VB, .NET</language>
</table>
<Records>3</Records>
<Elapsed>0.004</Elapsed>
</root>

注意:
o. 必須使用 java 1.4.1 中所提供的 xml parser.
可使用以下幾個 parser :
import javax.xml.parsers.*;
import org.w3c.dom.*;
import org.xml.sax.*;
o. 可以在 dos 之下執行. 也可以放在 jsp 中執行(tomcat).

經過 xml parser 解析之後, 必須出現以下結果:

Records Count : 3
Elapsed Time : 0.004

Table Count : 3

Table 1 :
Name : David Lee
Age : 30
Address : SH Road
tel : 65101699
language : Java, Javascript, VB, C++

Table 2 :
Name : Reys
age : 25
Address : BJ Road
tel : 66778899
language : VB, PowerBuilder

Table 3 :
Name : Simon Tsai
Age : 23
Address : NJ Road
tel : 66778909
language : VC, VB, .NET
JollyFred 2002-10-09
  • 打赏
  • 举报
回复
想入门的话,可以去看看IBM DeveloperWorks上的相关教程,浅显易懂!
http://www-900.ibm.com/developerWorks/cn/xml/index.shtml
saucer 2002-10-09
  • 打赏
  • 举报
回复
see
Java API for XML Processing
http://java.sun.com/webservices/docs/1.0/tutorial/doc/JAXPIntro.html

Processing XML with Java
http://www.cafeconleche.org/books/xmljava/
adonn 2002-10-09
  • 打赏
  • 举报
回复
有人能详细描述一下吗?

8,906

社区成员

发帖
与我相关
我的任务
社区描述
XML/XSL相关问题讨论专区
社区管理员
  • XML/XSL社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧