antmar904 Posted November 21, 2016 Share Posted November 21, 2016 Hi all. I'm having issues reading a xml file and returning the version number <rules version="467"> Here is an example of the xml file: <rules version="467"> <docMode> <domain docMode="9">site1</domain> <domain docMode="9">site2</domain> <domain docMode="8">site3</domain> <domain docMode="5">site4</domain> <domain docMode="9">site5</domain> <domain docMode="9">site6</domain> </docMode> I am trying to get the "<rules version="467">" number 467 but when I read the file it does not return that line. ConsoleWrite(FileRead("C:\Test\temp.xml") & @CRLF) console output: <docMode> <domain docMode="9">site1</domain> <domain docMode="9">site2</domain> <domain docMode="8">site3</domain> <domain docMode="5">site4</domain> <domain docMode="9">site5</domain> <domain docMode="9">site6</domain> </docMode> and is missing <rules version="467"> Link to comment Share on other sites More sharing options...
Moderators JLogan3o13 Posted November 21, 2016 Moderators Share Posted November 21, 2016 It works for me: Quote >Running:(3.3.14.2):C:\Program Files (x86)\AutoIt3\autoit3.exe "C:\Users\LoganJ\Desktop\Test Forum Scripts.au3" --> Press Ctrl+Alt+Break to Restart or Ctrl+Break to Stop <rules version="467"> <docMode> <domain docMode="9">site1</domain> <domain docMode="9">site2</domain> <domain docMode="8">site3</domain> <domain docMode="5">site4</domain> <domain docMode="9">site5</domain> <domain docMode="9">site6</domain> </docMode> Are you trying to extract just the 467 number, or the whole string? "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum! Link to comment Share on other sites More sharing options...
antmar904 Posted November 21, 2016 Author Share Posted November 21, 2016 (edited) just the 467. the rules version number will be manually changed everytime the xml file is edited. Edited November 21, 2016 by antmar904 Link to comment Share on other sites More sharing options...
jdelaney Posted November 22, 2016 Share Posted November 22, 2016 (edited) $oXML = ObjCreate("Microsoft.XMLDOM") $oXML.Load(@DesktopDir & "\test.xml") $oNode = $oXML.selectSingleNode('//rules') $sVersion = $oNode.getAttribute('version') ConsoleWrite($sVersion & @CRLF) return: 467 Only works when I made the XML valid: <rules version="467"> <docMode> <domain docMode="9">site1</domain> <domain docMode="9">site2</domain> <domain docMode="8">site3</domain> <domain docMode="5">site4</domain> <domain docMode="9">site5</domain> <domain docMode="9">site6</domain> </docMode> </rules> Edited November 22, 2016 by jdelaney antmar904 1 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. Link to comment Share on other sites More sharing options...
antmar904 Posted November 30, 2016 Author Share Posted November 30, 2016 Thanks Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now