Sign in to follow this  
Followers 0
BrandNewTester

Reading the contents of the Xml file.

4 posts in this topic

Hi all..

I m traying to read contents from the xml file.

xml file tags are repeated..

I have pasted my xml file below..

plz any one help me...

aaa.xml

<?xml version="1.0" encoding="utf-8" ?>

- <node xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://schemas.alpan.com/nodes/ws/">

<id>###################################</id>

<hasLogs>true</hasLogs>

- <hints>

<objectStorageId xmlns="http://schemas.alpan.com/utility/ws/">0</objectStorageId>

- <hints>

- <hint>

<First xmlns="http://schemas.alpan.com/utility/ws/">Isdirected</First>

<Second xmlns="http://schemas.alpan.com/utility/ws/">True</Second>

</hint>

- <hint>

<First xmlns="http://schemas.alpan.com/utility/ws/">CanBeMonitored</First>

<Second xmlns="http://schemas.alpan.com/utility/ws/">True</Second>

</hint>

- <hint>

<First xmlns="http://schemas.alpan.com/utility/ws/">MachineSmbiosId</First>

<Second xmlns="http://schemas.alpan.com/utility/ws/">##################</Second>

</hint>

- <hint>

<First xmlns="http://schemas.alpan.com/utility/ws/">MachineAddress</First>

<Second xmlns="http://schemas.alpan.com/utility/ws/">###################</Second>

</hint>

- <hint>

<First xmlns="http://schemas.alpan.com/utility/ws/">MachineType</First>

<Second xmlns="http://schemas.alpan.com/utility/ws/">#################</Second>

</hint>

- <hint>

<First xmlns="http://schemas.alpan.com/utility/ws/">MachineVersionMajor</First>

<Second xmlns="http://schemas.alpan.com/utility/ws/">############</Second>

</hint>

- <hint>

<First xmlns="http://schemas.alpan.com/utility/ws/">MachineOSEdition</First>

<Second xmlns="http://schemas.alpan.com/utility/ws/">###################</Second>

</hint>

- <hint>

<First xmlns="http://schemas.alpan.com/utility/ws/">SiteId</First>

<Second xmlns="http://schemas.alpan.com/utility/ws/">#######################</Second>

</hint>

- <hint>

<First xmlns="http://schemas.alpan.com/utility/ws/">Credential</First>

<Second xmlns="http://schemas.alpan.com/utility/ws/">#########################</Second>

</hint>

</hints>

</hints>

<detailsName>sles9</detailsName>

<detailsType>alpan.RemoteInventory.Sdk.Api.Schemas.Machines.Contained.VMwareESXVirtualMachine</detailsType>

<detailsUrl>IInventoryRepo.Servic</detailsUrl>

- <imageResource>

<id xmlns="http://schemas.alpan.com/resources/ws/">#################</id>

</imageResource>

<existence>aaaaaaaaaa</existence>

</node>

In this xml file,I required values like...

MachineSmbiosId

MachineType

MachineAddress

MachineMajorVersion

MachineOsEdition

How to get these values..

please any one help me .........

thanks in advance.........

BNT

Share this post


Link to post
Share on other sites



:guitar: Perhaps, this could help you get started: Good luck

Regards...


----------------------------------------

:bye: Hey there, was I helpful?

----------------------------------------

My Current OS: Win8 PRO (64-bit); Current AutoIt Version: v3.3.8.1

Share this post


Link to post
Share on other sites

Hi MKISH

Thanks for replay....

I could work on that.But failed to get the values.....

my xml file have repeated fields...

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

Load in the xml, use the xpath of the repeated node you want, and then do a loop to an array, or a loop to whatever you need of it:

$stest being your XML file, and whatever your legit xpath is in the selectnodes()

$oXML=ObjCreate("Microsoft.XMLDOM")

$oXML.load($stest) ; load document

$result = $oXML.selectNodes( '//First' )
For $Node In $result
consolewrite($Node.text & @crlf )

Next
Edited by jdelaney

IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0