Jump to content

Recommended Posts

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 post
Share on other sites

#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 post
Share on other sites

#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 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
  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...