以文本方式查看主题

-  中文XML论坛 - 专业的XML技术讨论区  (http://bbs.xml.org.cn/index.asp)
--  『 DOM/SAX/XPath 』  (http://bbs.xml.org.cn/list.asp?boardid=11)
----  关于DOM循环读出TAG的方法,请高手予以解答~!  (http://bbs.xml.org.cn/dispbbs.asp?boardid=11&rootid=&id=20044)


--  作者:babykkk
--  发布时间:6/30/2005 6:00:00 PM

--  关于DOM循环读出TAG的方法,请高手予以解答~!
<?xml version="1.0"?>
<map>
   <!-- For the JDBC-ODBC bridge, use
        driver = "sun.jdbc.odbc.JdbcOdbcDriver"
        and
        url = "jdbc:odbc:orders" -->
   <database url="sun.jdbc.odbc.JdbcOdbcDriver"
             driver="jdbc:odbc:orders">
      <order_table>orders</order_table>
      <order_orderid>orderid</order_orderid>
      <order_customer>userid</order_customer>
      <order_productid>productid</order_productid>
      <order_quantity>quantity</order_quantity>
      <order_price>unitprice</order_price>
      <products_table>productOrders</products_table>
      <products_productid>productid</products_productid>
      <products_quantity>quantity</products_quantity>
      <products_total>revenue</products_total>
   </database>  
</map>

比如说有以上xml文件,用 dom 解析这个xml文件

用一个 字符串数据怎么循环读出 tag的内容啊?是不是用getTagName()还是用其他什么
比如 string content[i];

读出以后

content[1]="order_table"
content[2]="order_orderid"
content[3]="order_customer"
content[4]="order_productid"
content[5]="order_quantity"

求高手给与解答


W 3 C h i n a ( since 2003 ) 旗 下 站 点
苏ICP备05006046号《全国人大常委会关于维护互联网安全的决定》《计算机信息网络国际联网安全保护管理办法》
7,609.375ms