freethought78's Recent Forum Activity

  • try:

    Append newline & "Output: " & XML.StringValue("/test/text()")

  • that is REALLY strange, i dont even know how i could have entered that incorrectly but whats stranger is that its working now... i cant get it to work for the life of me in the other project i'm working on.

    Anyhow I've updated the project file to include the correction and I've noticed a few people asking for an example project using the xml object so theres one here now.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Hello to everyone here at the Scirra forums.

    Thanks for taking the time to assist me with my problem.

    I'm working on a project which will be sending data back and forth between a construct 2 application and a web server which I'm using to host the application itself, as well as some php scripts and mysql datbases.

    I've chosen to use XML to receive incoming data from the server into the construct 2 application via an ajax request. This is just raw XML data, not a file that I'm sending into the application. It's more convenient for my purposes to do it this way and according to the Construct 2 manual:

    "XML must be loaded as a string with the Load action. If you have a small snippet of XML, you can paste it directly in to the action parameter. However, it's recommended to request an XML file from a server using the AJAX object."

    I've been trying to use XML directly in the action parameter, but no matter how I try, what data I input, what XPath I use, I cannot get the XML Object to return ANY data.

    I've duplicated the problem in a project file which is much less complicated than the actual project that I'm working on: XML BLues

    <img src="http://dl.dropbox.com/s/xl5f0r9e8d7cf9d/Layout.jpg" border="0">

    The Layout consists of 3 Text Objects:

    Label will always simply state 'The test was a:'

    ResultMessage is set with a default value: 'Failure'.

    If it never receives new data in the event sheet it will remain that way.

    The goal is to replace it with the contents of some XML containing the string 'Success'

    The 'Tested' Text object is initialized to the value 'To be tested', and on the start of the layout, its contents are changed to reflect the contents of a global variable which hold the XML data that is being passed into the XML object.

    <img src="http://dl.dropbox.com/s/sri8chzkjzmchld/EventSheet.jpg" border="0">

    The event sheet specifies that if the XML object returns any value other than "", that value should replace the string in the 'ResultMessage' Text object. However, no combination of XML or XPath specification that I have tried will yield any result other than "", and the result remains 'Failure'.

    <img src="http://dl.dropbox.com/s/tl0b6tku0myw2mf/Result.jpg" border="0">

    I have tried loading the XML with and without the header information. I have tired using an XPath with or wihtout including the text() component. I have tried loading the string from the result of an AJAX request containing XML. I have tried just about everything I can think of other than loading the XML from a file, which does not fit with my project, and as I stated earlier the documentation claims that working directly from a string is possible.

    Can anyone show me what I am doing wrong?

    EDIT: thanks for the help on that simple solution, now if only i could find the bug in my other code. Problem has been solved, see below.

freethought78's avatar

freethought78

Member since 24 May, 2012

None one is following freethought78 yet!

Trophy Case

  • 12-Year Club
  • Email Verified

Progress

13/44
How to earn trophies