计数节点r,xml2的数量
我有一个XML文件,想使用R。我的XML看起来像以下内容。节点计数应为4。我正在使用XML2
软件包。请注意,还有另一个元素,< tag>
,与我不想计算的相同级别。
感谢您的帮助。谢谢!
<root>
<node>
<string>1</string>
<string>2</string>
<string>3</string>
<string>4</string>
</node>
<node>
<string>5</string>
<string>6</string>
<string>7</string>
<string>8</string>
</node>
<node>
<string>9</string>
<string>10</string>
<string>11</string>
<string>12</string>
</node>
<node>
<string>13</string>
<string>14</string>
<string>15</string>
<string>16</string>
</node>
<tag>
<string>17</string>
</tag>
</root>
I have an xml file and want to know the count of a specific node using R. My xml looks something like below. The node count should be 4. I'm using the xml2
package. Notice there's another element, <tag>
, at the same level that I don't want to count.
I appreciate the help. Thanks!
<root>
<node>
<string>1</string>
<string>2</string>
<string>3</string>
<string>4</string>
</node>
<node>
<string>5</string>
<string>6</string>
<string>7</string>
<string>8</string>
</node>
<node>
<string>9</string>
<string>10</string>
<string>11</string>
<string>12</string>
</node>
<node>
<string>13</string>
<string>14</string>
<string>15</string>
<string>16</string>
</node>
<tag>
<string>17</string>
</tag>
</root>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)