How to get line number of selected node in xml using powershell
问题 I would want to get the line number of node which is changed/manipulated in XML using powershell. $($node.LineNumber) doesn't seem to be working. For example: $node.ParentNode.InsertBefore($nodeToInsert, $node) //which inserts a node I want to get the line number of this node. 回答1: Lines and line numbers exist in the lexical XML that you supply as input to the XML parser. They don't exist (usually) in the tree of in-memory nodes that is output by the XML parser, and which your program is