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)
    				ret.set_string("");
    			else if (this.runtime.isIE)
    				ret.set_string(result.nodeValue || "");
    			else
    				ret.set_string(result.stringValue || "");
    [/code:2p5lwknn]
    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=http://help.dottoro.com/ljmmmksq.php]nodeTypedValue[/url] method. 
    Actually, I've modified the code as
    [code:2p5lwknn]
    			if (!result)
    				ret.set_string("");
    			else if (this.runtime.isIE)
    				ret.set_string(result.nodeTypedValue || ""); //Workaround by RisingPixel
    			else
    				ret.set_string(result.stringValue || "");
    [/code:2p5lwknn]
    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=http://imgur.com/8aCx4Er]http://imgur.com/8aCx4Er[/url]
    If you need, I can make a custom .capx later
    
    [b]Steps to Reproduce Bug[/b]
    [ul]
        [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]
    [ul]
        [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
  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • In the meantime, you can append text() to your xpath and force it to select the text node.

  • Thanks, fixed for next build.

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