Read StringValue XML on IE (Bug+Fix)

0 favourites
  • 3 posts
  • Problem Description

    "StringValue" Method of "XML" plugin doesn't work properly on IE.

    In the runtime.js of xml plugin (row 270) actually Construct use this method

    			if (!result)
    			else if (this.runtime.isIE)
    				ret.set_string(result.nodeValue || "");
    				ret.set_string(result.stringValue || "");
    But The nodeValue property of XML elements is always null, because the element content is actually stored within text nodes inside the element. If the content is simple enough, you can do something like [i]result.firstChild.nodeValue[/i] but i personally prefer the [url=]nodeTypedValue[/url] method. 
    Actually, I've modified the code as
    			if (!result)
    			else if (this.runtime.isIE)
    				ret.set_string(result.nodeTypedValue || ""); //Workaround by RisingPixel
    				ret.set_string(result.stringValue || "");
    And it works!
    [b]Attach a Capx[/b]
    I can't upload my full project at this moment, but i can attach a screenshot of the debugger's precise line [url=][/url]
    If you need, I can make a custom .capx later
    [b]Steps to Reproduce Bug[/b]
        [li] Create a multi-level XML with some text and number value
        [/li][li] Use XMLPlugin.StringValue('/yournode/yourchildnode") in a console.log or in a textbox[/li][/ul]
    [b]Observed Result[/b]
     Returns nothing...
    [b]Expected Result[/b]
    Returns some text
    [b]Affected Browsers[/b]
        [li] Chrome: (NO)
        [/li][li] FireFox: (NO)
        [/li][li] Internet Explorer: (YES)[/li][/ul]
    [b]Operating System and Service Pack[/b]
    Windows 8.1 with Internet Explorer 11
    [b]Construct 2 Version ID[/b]
    Construct R200 64bit with Business license
  • In the meantime, you can append text() to your xpath and force it to select the text node.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Thanks, fixed for next build.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)