How to start reading from a specifc line in an XML file?

本小妞迷上赌 提交于 2019-12-13 05:49:27

问题


I have an XML file and I need to start reading from a specific line number. As if the previous lines don't exist.

For example, if I need to count number of nodes starting from line # 23. This is to be done using VBScript in UFT (QTP).


回答1:


You can skip lines in text (line orientated) files by using the SkipLine method.

But XML documents are trees of nodes/elements. Whitespace out of elements has no meaning. So it may make sense to ask for the number of child nodes of a specific node (whether it starts on line #23 or not).

So

  1. describe your real world problem in a way that explains why you assume lines are relevant
  2. publish (a small but illustrative part of) your input xml
  3. state the expected output
  4. show the code your are experimenting with


来源:https://stackoverflow.com/questions/31680506/how-to-start-reading-from-a-specifc-line-in-an-xml-file

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!