rcmaehl Posted June 15, 2018 Posted June 15, 2018 (edited) Hi all, I've recently be kinda forced into trying to learn OOP within AutoIt. I'm trying to convert XML into objects I guess instead of trying to parse it into arrays within arrays. An example is below: <User> <roles> <role>Agent</role> <role>Supervisor</role> </roles> </user> How can I convert this? Would <roles> be $User.Roles? If so would the children be $User.Roles.Role.Agent and $User.Roles.Role.Supervisor? If not, how do I reference each Object? Any assistance would be appreciated. I tried to understand XML.au3 but I'm so confused trying to wrap my head around this. Edited June 15, 2018 by rcmaehl My UDFs are generally for me. If they aren't updated for a while, it means I'm not using them myself. As soon as I start using them again, they'll get updated.My Projects WhyNotWin11Cisco Finesse, Github, IRC UDF, WindowEx UDF
jdelaney Posted June 15, 2018 Posted June 15, 2018 (edited) Forum search .selectnodes. return that to a variable like $oRoles. xpath is //role Loop through like: For $oRole in $oRoles consolewrite ($oRole.text & @crlf) Next Edited June 15, 2018 by jdelaney rcmaehl 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.
rcmaehl Posted June 15, 2018 Author Posted June 15, 2018 (edited) _XML_SelectNodes expects XML input for the first parameter and the "path" as the second? Does it return an array or strings? I'm still so confused at exactly the $oNodes_coll return is... Edit: Just saw your edit. I'll try that. Edited June 15, 2018 by rcmaehl My UDFs are generally for me. If they aren't updated for a while, it means I'm not using them myself. As soon as I start using them again, they'll get updated.My Projects WhyNotWin11Cisco Finesse, Github, IRC UDF, WindowEx UDF
rcmaehl Posted June 15, 2018 Author Posted June 15, 2018 (edited) I seem to be getting a DOMVersion (4) error. However @extended is "0". I'm confused if I'm doing something wrong? Edit: It appears I'm getting IsNotObject. I guess I need to convert my XML text to an Object for the First Parameter of _XML_SelectNodes? Edited June 15, 2018 by rcmaehl My UDFs are generally for me. If they aren't updated for a while, it means I'm not using them myself. As soon as I start using them again, they'll get updated.My Projects WhyNotWin11Cisco Finesse, Github, IRC UDF, WindowEx UDF
rcmaehl Posted June 15, 2018 Author Posted June 15, 2018 Hey! I did it! I was missing _XML_LoadXML ! My UDFs are generally for me. If they aren't updated for a while, it means I'm not using them myself. As soon as I start using them again, they'll get updated.My Projects WhyNotWin11Cisco Finesse, Github, IRC UDF, WindowEx UDF
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