Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
http request result used in macro
#1
I would like to receive data from a VLC HTTP request. The request url is in this form
Code:
Copy      Help
http://127.0.0.1:8080/requests/status.xml

[Image: vlcResult.jpg]

Above is an example of what it returns. How can I create variables from the nodes? I tried to use the example in a post I saw that uses iXml but I could not get it to work. To be clear for example how can I create a variable for a node like <state></state> which should result in "stopped"? Thanks
#2
If need only state, the simplest way to get it is a regular expression. Or if don't want to learn regular expressions, use function find and str.get.
If need a single XML element, usually is used XPath, but this XML is too simple. Just get the child element.

Macro Macro201
Code:
Copy      Help
str xml=
;<root>
;;;<a>a</a>
;;;<state>stopped</state>
;</root>

IXml x._create
x.FromString(xml)
IXmlNode e = x.RootElement.Child("state")
out e.Value


Forum Jump:


Users browsing this thread: 1 Guest(s)