How to start reading from a specifc line in an XML

2019-09-02 07:13发布

问题:

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