不用DOM对象,怎样取得一个XML文件中某节点下的节点个数。

想知道一个节点下的节点个数,不用DOM对象,通过什么方法取得?
有这样的方法码?
---------------------------------------------------------------

1. if you are using SAX, use a static or global variable, inside startElement method, increment the variable, at the end, the variable should contain the number of nodes

2. if you are using XSLT, try

1<xsl:value-of select="count(//*)"></xsl:value-of>
Published At
Categories with Web编程
Tagged with
comments powered by Disqus