PDA

View Full Version : Problem with loading objects and xml



Samwise
01-24-2008, 08:12 PM
I have searched through the forums but have not been able to find a solution. It seems whenever I load info from an external file into my project it then becomes impossible to load from another.
eg:


XML.Load("MyXML.xml");
Image.Load("Image1",AnImage);
XML.InsertXML("node","some info"); --doesn't work with this line removed either
XML.Save("MyXML.xml");

This produces the following error--> TRACE: LastError = 37001 ("Error saving XML file.")
I stripped back my code until I got to the equivilant of the above block so I am pretty sure it is the fact that I am loading one object after the other and it is not loving it. I have had the same problem reading INI files as well. In one instance I was able to work around by restarting my program but that isn't applicable for all situations.
I originally ran in to this problem using AMS 6.0 but didn't post about it because I wanted to wait and see if it had been resolved in AMS 7.0. Any help on this one would be really appreciated. Am I just missing something?

note: Not sure if I have this in the right place so if someone could move this if it is in the wrong place that would be awesome.

FoxLeader
01-25-2008, 11:14 PM
Hello!

First, welcome to the forums ;) Second, you're in the right place so don't worry, someone should be able to help you :)
(On my part, I'm getting tired and I'll probably fall asleep on my desk in the following minutes, so I'm better end this post now :D)

Regards,
FoxLeader

TimeSurfer
01-26-2008, 03:37 AM
Well 1 problem I see is that your filepath is incorrect. But I also had a problem with inserting.

Here is the code I used. which works it inserts the string data 'test' to the element NodeInfo located under the element called Node.


Image.Load("Image1", "AutoPlay\\Images\\630A01257.jpg");
XML.Load("AutoPlay\\Docs\\my.xml");
XML.SetValue("Node/NodeInfo", "test", false);
XML.Save("AutoPlay\\Docs\\myFile.xml");

SetValue allows you to change the data for a element

hope this helps you.

Samwise
01-26-2008, 09:05 AM
The details i put in were just filler and not accurate but i'll give that one a try. But it is 1:30am here so not right now :D

TJ_Tigger
01-29-2008, 11:25 AM
Another thing to pay attention to is whether or not you have permissions to write to that directory. Is this running on XP or a Vista machine. Have you tried to write to a temp directory to see if you can srite the file at all?

Tigg

Samwise
01-29-2008, 06:53 PM
The directory can be written to. The actions themselves are not actually a problem when handled one at a time. It is just when you put them tgether they no longer work. For example one way to get around it is to have your prgram restart after doing one action before continuing on to the next. But that is hardly an ideal solution unfortunatly. :/

Samwise
02-11-2008, 10:37 PM
Ok doke then. In AMS 7 I am able to get an image to load to an image object then save an xml file no problems. Now my problem is when I try to allow the user to select an image to load using a Dialog.FileBrowse option. Anyone else run in to this and/or have a solution?

Samwise
02-11-2008, 11:10 PM
Nevermind. It was just me disregarding the need for "_SourceFolder" in my file paths. Sorry for all the trouble folks and thanks for the help above.

garagestudios
02-14-2008, 03:15 PM
I am having the same problem. Can you post a sample of the code that fixed the original XML issue? Thanks.

TimeSurfer
02-14-2008, 04:33 PM
garagestudios,
Post the code where problem is and I will help you fix it.

Samwise
02-20-2008, 08:18 PM
I am having the same problem. Can you post a sample of the code that fixed the original XML issue? Thanks.

My problem was I was treating the app too simply (and in a lazy way). So



XML.Save("\\AutoPlay\\myxml.xml")

became


XML.Save(_SourceFolder .."\\AutoPlay\\myxml.xml")


and the same goes for loading images etc. If thats not your problem then maybe I can compare my code to yours to see where we both went wrong because this problem drove me batty for quite a while :D