josheee12 Posted May 18, 2009 Share Posted May 18, 2009 i have xml with this format <root><myitem id="123456789"><text>toothbrush</text></myitem></root> how would i extract "toothbrush" using xmldomwrapper? i figured out how to get "123456789", but i cannot figure out how to extract text without a tag of some sort. Link to comment Share on other sites More sharing options...
weaponx Posted May 18, 2009 Share Posted May 18, 2009 #include "_XMLDomWrapper.au3" $sXMLFile = "test2.xml" $result = _XMLFileOpen($sXMLFile) If $result = 0 Then Exit $value = _GetFirstValue("/root/myitem[@id='123456789']/text") MsgBox(0,"",$value) ;Get the first real value returned from the _XMLGetValue() return array. Func _GetFirstValue($node) $ret_val = _XMLGetValue($node) If IsArray($ret_val) Then Return ($ret_val[1]) Return SetError(1,3,0) EndFunc Link to comment Share on other sites More sharing options...
josheee12 Posted May 21, 2009 Author Share Posted May 21, 2009 #include "_XMLDomWrapper.au3" $sXMLFile = "test2.xml" $result = _XMLFileOpen($sXMLFile) If $result = 0 Then Exit $value = _GetFirstValue("/root/myitem[@id='123456789']/text") MsgBox(0,"",$value) ;Get the first real value returned from the _XMLGetValue() return array. Func _GetFirstValue($node) $ret_val = _XMLGetValue($node) If IsArray($ret_val) Then Return ($ret_val[1]) Return SetError(1,3,0) EndFunc it returns C:\scripts\api.au3 (27) : ==> Array variable has incorrect number of subscripts or subscript dimension range exceeded.: 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