Jump to content

[help] xmlSaveFile


HunT

Recommended Posts

Where Wrong ? :roll: (first time with xml)

  
function memo () 
myMemo = guiCreateMemo(19,58,360,275,"",false,MemoPanel) 
  
--------------------------------------------------------------------------- 
elseif (source == mapbott2) then -- botton open memo 
memo () -- work 
LoadText() -- work 
elseif (source == mapbott6) then -- botton close memo 
SaveText() -- work 
  
function LoadText() 
        local mapText = xmlLoadFile("img/maptest.xml") 
        if (mapText) then 
                local value = xmlNodeGetValue(mapText) 
                guiSetText(myMemo, value) 
        end 
end 
  
function SaveText() 
         xmlNodeSetValue(mapText, guiGetText(myMemo)) -- debug error 
         xmlSaveFile(mapText) -- debug error 
         xmlUnloadFile(mapText) -- debug error 
         end 
  

Tnx.

Link to comment
function memo () 
myMemo = guiCreateMemo(19,58,360,275,"",false,MemoPanel) 
  
--------------------------------------------------------------------------- 
elseif (source == mapbott2) then -- botton open memo 
memo () -- work 
LoadText() -- work 
elseif (source == mapbott6) then -- botton close memo 
SaveText() -- work 
  
function LoadText() 
    local mapText = xmlLoadFile("img/maptest.xml") 
    if (mapText) then 
        local value = xmlNodeGetValue(mapText) 
        guiSetText(myMemo, tostring(value)) 
        xmlUnloadFile(mapText) 
    end 
end 
  
function SaveText() 
    local mapText = xmlLoadFile("img/maptest.xml") 
    if (mapText) then 
        xmlNodeSetValue(mapText, guiGetText(myMemo)) 
        xmlSaveFile(mapText) 
        xmlUnloadFile(mapText) 
    end 
end 

You have the file "resourceName/img/maptest.xml" at downloaded client side folder, right?

Link to comment

Work Tnx :wink:

Other Question.

Why in memo with key p open the admin panel? t show the cursor for chat . . .y etc.

is impossible to write PAPPATAPA in memo :mrgreen: why open 4 times the admin panel and 2 times the cursor :|

Link to comment

Omg xml Stress me :roll:

For export the map list i have :

  
mapEdit = guiCreateEdit(140,339,117,26,"date xml",false,MemoPanel)  
  
elseif (source == mapbott7) then -- botton for create xml with name from edit 
exportDate = guiGetText(mapEdit) 
exportText = guiGetText(myMemo) 
local FinalText =  xmlCreateFile(exportDate,exportText) 
xmlSaveFile ( FinalText ) 
xmlUnloadFile ( FinalText ) 
  

Work Fine but the name file is not .xml

Link to comment
mapEdit = guiCreateEdit(140,339,117,26,"date xml",false,MemoPanel) 
  
elseif (source == mapbott7) then -- botton for create xml with name from edit 
exportDate = guiGetText(mapEdit) 
exportText = guiGetText(myMemo) 
local FinalText =  xmlCreateFile(exportDate ..".xml",exportText) 
xmlSaveFile ( FinalText ) 
xmlUnloadFile ( FinalText ) 

Link to comment

Other Problem With XML :roll:

My Problem Now is The "OutPut Code"

The script Work Fine:

  
elseif (source == mapbott7) then -- Botton for create xml 
local exportDate = guiGetText(myEdit) -- get the text from the edit 
local exportText = guiGetText(myMemo) -- get the text from the memo 
local metaNode =  xmlCreateFile(exportDate ..".xml",exportDate) -- crate the file and root with the text from  edit 
if (metaNode) then 
xmlNodeSetValue(metaNode, exportText) -- set the value (text) with text from memo 
xmlSaveFile ( metaNode ) 
xmlUnloadFile ( metaNode ) 
  

image :

20120321171207.png

XML :

  
<21-03-2012>ACCEPTED :1: BADlands BLASTAround        race-badlandsblastaroundDECLINED :</21-03-2012> 
  

?????

Tnx for help

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...