Jump to content

XML questions


denny199

Recommended Posts

Hai there,

I'm working on a new script with xml, but now I've got some problems, the saving is working fine, but the exporting isn't so good.

How could I get the text after NAAM_

so only this: NAAM_Danny or NAAM_Danny3 or NAAM_path and so on.

So only after the underscore, underscore = _ .

Here's my xml.

  
    <radio> 
         
        <NAAM_Danny naamradio="Danny" posx="232.17012023926" posy="-1205.9498291016" posz="75.3125" distance="5"></NAAM_Danny> 
        <NAAM_Danny3 naamradio="Danny3" posx="238.56645202637" posy="-1206.4357910156" posz="75.3125" distance="6"></NAAM_Danny3> 
        <NAAM_path naamradio="path" posx="239.8809967041" posy="-1195.0231933594" posz="75.34440612793" distance="44"></NAAM_path> 
    </radio> 
  

I've no idea how to start.

Regards,

Danny

Link to comment
local radioFile = xmlLoadFile ( "radio.xml" ) 
if ( radioFile ) then 
    for _, path in ipairs ( xmlNodeGetChildren ( radioFile ) ) do 
        local name = xmlNodeGetName ( path ):gsub ( "NAAM_", "" ) 
        outputChatBox ( name ) 
    end 
end 

That should do it if I'm right.

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...