Spenhouet Posted May 29, 2012 Posted May 29, 2012 Hi AutoIT Forum. I have some problems with the XML DOM Wrapper. This is my XML for example: <i> <name>INAME1 <iserver>iserver</iserver> <username>username</username> <password>password</password> <sserver>sserver</sserver> </name> <name>INAME2 <iserver>iserver</iserver> <username>username</username> <password>password</password> <sserver>sserver</sserver> </name> <name>INAME3 <iserver>iserver</iserver> <username>username</username> <password>password</password> <sserver>sserver</sserver> </name> </i> I want to get the path of <name>INAME2. How can i do that? I want to write and read at this path....
JohnOne Posted May 29, 2012 Posted May 29, 2012 Can you post the code you tried? AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans.
stormbreaker Posted May 29, 2012 Posted May 29, 2012 Why use XML DOM Wrapper? I think this could be done with _StringBetween function (isn't it possible?) ---------------------------------------- :bye: Hey there, was I helpful? ---------------------------------------- My Current OS: Win8 PRO (64-bit); Current AutoIt Version: v3.3.8.1
Spenhouet Posted May 29, 2012 Author Posted May 29, 2012 Why use XML DOM Wrapper? I think this could be done with _StringBetween function (isn't it possible?) I don't only want to read from the xml file, also i want to write in it. I think i have solved the problem nearly with /name[1]... So i can geht the Index out of an array.
supersonic Posted May 29, 2012 Posted May 29, 2012 Spenhouet, please, could you provide a code example of how you solved it? Thank you!
jdelaney Posted May 29, 2012 Posted May 29, 2012 That isn't well formed XML. If this is your own, i would suggest putting the text into an attribute within the parent tag...then you can use actual XML to specify the parent with a specific attribute value. 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.
Spenhouet Posted May 30, 2012 Author Posted May 30, 2012 My solution: ; --------------- $oprofilelesenname = oprofilelesen() $file = _XMLFileOpen($sPath) $oplna = _ArraySearch($oprofilelesenname, $the_Profile) If $oplna = -1 Then _XMLCreateChildNode("/o_profiles", "name", $the_Profile) EndIf _XMLSaveDoc($sPath) $oprofilelesenname = oprofilelesen() $file = _XMLFileOpen($sPath) $oplnaIndex = _ArraySearch($oprofilelesenname, $the_Profile) $oprofiles_name = "/o_profiles/name[" & $oplnaIndex & "]" ;------------------ Func oprofilelesen() $sPath = @MyDocumentsDir & "OPlug-In TestEingabemaske Profileprofiles.xml" $file = _XMLFileOpen($sPath) $oprofilelesenname = _XMLGetValue("/o_profiles/name") _XMLSaveDoc($sPath) Return ($oprofilelesenname) EndFunc It works very well
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