Take type/label from XML node

  • I want get name/label from node (" <line id="a"> </line>" , where I want get that "line" )

    My plan is use it for make a sequence of events, but of course, the events must follow the node list order, but for parse the events I want know which type of event is.

    my example XML:

    <?xml version="1.0" encoding="UTF-8"?> 
    <!-- char 0 = narrador -->
    <visualnovel>
    	<scenes>
    		<scene id="start">
                             <show s="t">smile</show>
    			 <line s="t">
    				Hello
     			</line>
    			<line s="t">
    				What doing here?
    			</line>
    		</scene>
    	</scenes>
    </visualnovel>
    [/code:100nff6v]
    
    I already found this post: 
    
    I'm using this inside a normal for each xml, but it not recovers nothing: XML.StringValue("name()") 
    
    I can move inside the for each node by node with this : /visualnovel/scenes/scene [@id="start"]/*[ "&actualnode&"]
    
    There is somebody here witch used "name()" with sucess ? there is an alternative? thanks you.
  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Improved Question

    Edit:

    I'm using Xpath visualizer tool http://xpathvisualizer.codeplex.com and I can't even make it work there. There is something I'm doing bad and perhaps it's out from construct scope

  • I remember having used the name() function successfully, but I can't seem to be able to get it to work now... Maybe a bug ?

    edit: Okay, I think I know why I can't get it to work anymore. I'm currently using Firefox for my test, and there's a workaround for some Firefox related problem implemented in the XML plugin. Strangely, the workaround isn't needed when using the name() function. Testing with IE fails too, although I don't know why... Chrome and NW.js works like a charm!

  • You are right. Works only under chrome ( I was trying under firefox, like you). I will update with test under mobile browsers.

    Thanks you, Magistross, I was expecting something from you, like I already read almost everything about xml at this forums.

  • Ok, its confirmed:

    Works

    On desktop:

    Yes:

    chrome

    No:

    Firefox

    On android:

    Yes:

    Dolphin

    Android standard navigator

    Chrome

    No:

    Firefox (again!)

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