![]() ![]() Hence, as shown in the above section, we have to extract XML data and push those data to a PowerShell hash as an intermediate format. We do not have a straightforward approach to converting an XML document to a JSON string. Letâs write the arrays into PowerShell console windows. string xml Alan.![]() The reference variables $empIds, $empAges and $empDesigs contains array of values for respective XML nodes. The XPath expression looks like the following for each node.Ä®mpID node can be accessed by the XPath query "//Employee//EmpId".Ä®mpAge node can be accessed by the XPath query "//Employee//EmpIAge".Ä®mpDesignation node can be accessed by the XPath query "//Employee//EmpDesignation". Since we need to fetch three nodes per employee object, PowerShell foreach has been used. In this example, the -Path is the location where the employeeinfo.xml is located. $empIds = Select-Xml -Path "D:\codes\employeeinfo.xml" -XPath "//Employee//EmpId" | foreach ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |