View Full Version : Read from XML document in AMS 6.0
abcnormal
12-30-2005, 08:58 PM
Hi,
I am trying to figure out how to read from a xml document inside the \\autoplay\doc folder.
I have created a button, and when the user presses the button I want it to read from the xml file. But I can not figure out how to do this.
If any of you have some useful insigths on how to do this, please let me know as soon as possible.
If I can read to a page by clicking on the button, then my problems are solved. Then I can start building my project.
I have enclosed a test project, so that you will understand what I mean.
Thanks for any input.
hi abcnormal,
it's all explained in the ams6 help file.
just load your xml file into memory
XML.Load(_TempFolder.."\\Temp.xml");
get the value of the specified element
local Result = XML.GetValue("report/result");
local Error = XML.GetValue("report/error");
byte
abcnormal
12-31-2005, 09:43 AM
But when I try that it returns Error loading XML file.
I have the following code in the button:
-- Load an XML file into memory.
XML.Load(_TempFolder.."\\AutoPlay\\Docs\\001.xml");
-- Check whether an error occurred
error = Application.GetLastError();
-- If no errors occurred...
if (error == XML.OK) then
local Result = XML.GetValue("product/item/id");
local Nope = XML.GetValue("product/item/id");
Dialog.Message("worked",Result);
Dialog.Message("did not work",Nope);
-- if no errors occurred, show id value
error = Application.GetLastError();
if (error == XML.OK) then
else
Dialog.Message("Error", _tblErrorMessages[error]);
end
else
Dialog.Message("Error", _tblErrorMessages[error]);
end
And the following in the xml doc:
<?xml version="1.0"?>
<product>
<item>
<id>001</id>
<name>Productname 1</name>
<description>This is a testproduct</description>
<price>12</price>
</item>
</product>
azmanar
12-31-2005, 12:51 PM
Hi,
Talking about XML, OpenOffice 2.0 has now totally revamped their file formats to OpenText Document ( basically XML ).
The files output are from Impress ( like MS PowerPoint ), Calc ( like MS Excel ) and Write ( like MS Doc ). I don't know whether OpenOffice Database can export to XML format or not, but I have imported DB CSV files into Calc and Write successfully.
Check out >> www.openoffice.org , if you want to try.
It's interesting to note that lots of companies are converting from MS to OpenOffice. This has huge potentials for AMS users to enrich themselves with more channels of opportunities.
Has anyone delved with Porting AMS with OpenOffice documents?
Dermot
12-31-2005, 01:27 PM
I download OpenOffice 2.0 the other day and I was very impressed. :yes I had tried it a few years ago but didn't like it. I now prefer using Write over Word. Also love the the presentaion program can output to Flash with a few clicks. :yes :yes
Haven't tried accessing OpenOffice documents with AMS but I read this in the help file so it may very well be possible:
The OpenDocument file format is an XML file format standardized by OASIS (Organization for the Advancement of Structured Information Standards).
azmanar
12-31-2005, 02:03 PM
I download OpenOffice 2.0 the other day and I was very impressed. :yes I had tried it a few years ago but didn't like it. I now prefer using Write over Word. Also love the the presentaion program can output to Flash with a few clicks. :yes :yes
Haven't tried accessing OpenOffice documents with AMS but I read this in the help file so it may very well be possible:
Hi,
Really keen to Port AMS with OpenOffice.
It's something like importing a presentation file and then straight away doing little redesign over AMS. Also like importing pages of documents and set navigation using AMS, as a result becoming eBooks. Or even getting spreadsheet tables.
Bottomline, it is about cutting production time and impressing clients with AMS goodies.
azmanar
12-31-2005, 03:59 PM
Hi Dermot,
I'm exploring thru this XML link examples:
http://www.indigorose.com/forums/search.php?searchid=227033 .
Usually the examples are extremely helpful.
Thanx for the tip.
Corey
12-31-2005, 04:10 PM
Really keen to Port AMS with OpenOffice.
You should add that to the suggestions forum. Sounds like a good idea. :yes
abcnormal
12-31-2005, 05:30 PM
azmanar, your link did not work.
Can anyone tell me what I've done wrong on this one?
azmanar
12-31-2005, 05:36 PM
azmanar, your link did not work.
Can anyone tell me what I've done wrong on this one?
Hi,
Sorry about that. Here's a better link.
http://www.indigorose.com/forums/showthread.php?t=13131&highlight=XML
Dermot
12-31-2005, 05:58 PM
azmanar, your link did not work.
Can anyone tell me what I've done wrong on this one?
Change this:
-- Load an XML file into memory.
XML.Load("\\AutoPlay\\Docs\\001.xml");
To:
-- Load an XML file into memory.
XML.Load("AutoPlay\\Docs\\001.xml");
abcnormal
12-31-2005, 07:20 PM
Thanks, that did it. :)
I have to remember to start with "AutoPlay\\.." instead of "\\AutoPlay\\..".
Thanks for letting me know, now it becomes much easier.
Happy new year everybody.
:yes
Corey
12-31-2005, 09:01 PM
Happy new year abcnormal. :yes
vBulletin® v3.8.4, Copyright ©2000-2009, Jelsoft Enterprises Ltd.