Home AMX User Forum AMX Technical Discussion

Problems creating xml files

Hello forum! I?m new here,

my problem is that i?m trying to create a new XML file from a simple structure, and everything goes ok until i try to open the new file in which i?m going to save the xml.

I?ve tried it with a full path and directly with the name of the file, but in no case a new file is created nowhere

slFile = FILE_OPEN('C:/pruebaxml.xml', FILE_RW_NEW)
slFile = FILE_OPEN('pruebaxml.xml', FILE_RW_NEW)

And i?ve also tried to save the document in an already created .xml file

But in all cases the result is the same: slFile = 0
And i don?t know what is the meaning of 0, what am i doing wrong?

Thanks for your help!!
Salutes.

Comments

  • ericmedleyericmedley Posts: 4,177
    MorgoZ wrote: »
    Hello forum! I?m new here,

    my problem is that i?m trying to create a new XML file from a simple structure, and everything goes ok until i try to open the new file in which i?m going to save the xml.

    I?ve tried it with a full path and directly with the name of the file, but in no case a new file is created nowhere

    slFile = FILE_OPEN('C:/pruebaxml.xml', FILE_RW_NEW)
    slFile = FILE_OPEN('pruebaxml.xml', FILE_RW_NEW)

    And i?ve also tried to save the document in an already created .xml file

    But in all cases the result is the same: slFile = 0
    And i don?t know what is the meaning of 0, what am i doing wrong?

    Thanks for your help!!
    Salutes.

    If you highlight the keyword FILE_OPEN in NS and hit the F1 key, you'll be taken to the help file. From there you can get a lot of useful informatino about what each keyword does and how to use it.

    for example, you question of the result is answered by this from the help file:
    Result:

    If the open operation is successful, this function returns a non-zero integer value representing the handle to the file. This handle must be used in subsequent read, write and close operations.

    >0: Handle to file (open was successful)

    -2: Invalid file path or name

    -3: Invalid value supplied for IOFlag

    -5: Disk I/O error

    -14: Maximum number of files are already open (max is 10)

    -15: Invalid file format

    Hope that helps
    e
  • Spire_JeffSpire_Jeff Posts: 1,917
    The processors are running an OS similar to Linux or Unix. The file system is case sensitive and it is different from the DOS/Windows structure of drive_letter:/. Try this for the file name:

    slFile = FILE_OPEN('\pruebaxml.xml', FILE_RW_NEW)

    Jeff
  • MorgoZMorgoZ Posts: 116
    Thanks for your advices, but it still doesn?t work :(
    ericmedley, at the help there is no mention about a 0 result.

    But i think that i see what could be my problem.... i?m trying to save the XML in an external path....

    so now my question would be where does NetLinx saves the XML files created? And how could i see them?

    And, if i need to load a XML file or to save it in an external PC, is there any way to do so, knowing the IP and the path of the remote computer?
    I mean for example: slFile = FILE_OPEN('\\192.168.1.2\sharedFolder\pruebaXml.xml', FILE_RW_NEW)

    Many thanks for your help!!!!
  • ericmedleyericmedley Posts: 4,177
    ftp into the netlinx master and you'll see the disk. it's saving it there.
  • MorgoZMorgoZ Posts: 116
    Ok, thanks,
    and what is the username/password to access to the ftp? I?ve search it at my NI-400 PI but i didn?t find it.

    and about saving the files from the master to an external device (PC) ????

    Thanks again!!
  • ericmedleyericmedley Posts: 4,177
    MorgoZ wrote: »
    Ok, thanks,
    and what is the username/password to access to the ftp? I?ve search it at my NI-400 PI but i didn?t find it.

    and about saving the files from the master to an external device (PC) ????

    Thanks again!!

    That was set by whomever set up the security on the box. If you're not the original programmer, then who knows?

    As for moving the file, you can either write your own FTP client in code and send it from the master to the server, or kinda reverse the process and pull the file to the Netlinx master to the PC by making the PC the client.

    FTP protocol is not to difficult. I've written a routine to do as you describe before.

    I actually think it would be easier to do from the PC side, however.
  • DHawthorneDHawthorne Posts: 4,584
    MorgoZ wrote: »
    Ok, thanks,
    and what is the username/password to access to the ftp? I?ve search it at my NI-400 PI but i didn?t find it.

    and about saving the files from the master to an external device (PC) ????

    Thanks again!!

    The default is administrator/password. I'm not so sure you can write to an external drive; there are no provisions I am aware of to mount it, and you are going to need some kind of transport layer.
  • MorgoZMorgoZ Posts: 116
    Thanks for the responses,

    i don?t know who set up the security, not me, and the master has one week since i took it out of the box, so it should be the default "administrator/password", thanks DHawthorne.

    For moving the xml file i`ve found the "?!FTPSender", i haven?t test it already, but i think that it could work.

    Thanks to all!
Sign In or Register to comment.