Welcome, Guest. Please Login.
IRobotSoft Robot
07/22/19 at 14:15:09
News: IRobotSoft is the Best Visual Web Computing Platform!
Home Help Search Login
Google
 


Pages: 1
Send Topic Print
XML files by iRobot that can be read in MS EXCEL (Read 7312 times)
tspiderus
Junior Member
**


I Love IRobotSoft

Posts: 12
XML files by iRobot that can be read in MS EXCEL
04/08/11 at 16:14:04
 
I managed to make a robot and save variables in XML file.
 
The structure of the newly created XML file is as follows:
 
Code:
<Variables Name="" Date="2011/04/08 21:40:32">
   <var_1>xxx1</var_1>
   <var_2>xxx2</var_2>
</Variables>
<Variables Name="" Date="2011/04/08 21:40:32">
   <var_1>xxx3</var_1>
   <var_2>xxx4</var_2>
</Variables>
 


 
When i try to open it in MS EXCELL the following error occurs: "XML Parse error".
 
I suppose that this happens because an the iRobot XML file does not comply with this format:
Code:
<?xml version="1.0"?>
<note>    //there is only ONE top level tag
   <to>Tove</to>    
   <from>Jani</from>    
   <heading>Reminder</heading>    
   <body>Don't forget me this weekend!</body>
</note> 
 


More details here: http://www.w3schools.com/xml/default.asp
 
So, how can i generate, with iRobot, a XML file which can be opened in MS EXCEL FILE?
 
My suggestion would be to add at the begining and the end of the XML file a top level tag as below (this is what i cannot achive):
 
Code:
<?xml version="1.0"?>
<note>
   <Variables Name="" Date="2011/04/08 21:40:32">
      <var_1>xxx1</var_1>
      <var_2>xxx2</var_2>
   </Variables>
   <Variables Name="" Date="2011/04/08 21:40:32">
      <var_1>xxx3</var_1>
      <var_2>xxx4</var_2>
   </Variables>
</note>
 

 
 
Your help is greatly appreciated! Thanx
Back to top
 
 
  IP Logged
IRobotSoft Administrator
IRobotSoft Administrator
*****


IRobotSoft, the Best
Internet Robot
System

Posts: 1608
Gender: male
Re: XML files by iRobot that can be read in MS EXC
Reply #1 - 04/08/11 at 21:25:58
 
Typically, you can add two events to the action to load the original xml and save it to a new xml.  For example:  
 
Event: after each tuple; Name: items; Value: readFile('xxxxx.xml')
Event: after each tuple;  Value: saveFile('yyyyy.xml', strcat('<?xml version="1.0"?>\r\n<note>\r\n', '\r\n', items, '\r\n', '</note>\r\n'))
 
Back to top
 
 

The Administrator.
WWW   IP Logged
tspiderus
Junior Member
**


I Love IRobotSoft

Posts: 12
Re: XML files by iRobot that can be read in MS EXC
Reply #2 - 04/11/11 at 13:18:22
 
Quote from IRobotSoft Administrator on 04/08/11 at 21:25:58:
Typically, you can add two events to the action to load the original xml and save it to a new xml.  For example:

Event: after each tuple; Name: items; Value: readFile('xxxxx.xml')
Event: after each tuple;  Value: saveFile('yyyyy.xml', strcat('<?xml version="1.0"?>\r\n<note>\r\n', '\r\n', items, '\r\n', '</note>\r\n'))


 
I did the steps mentioned above and it worked.
 
Now my XML file has the below structure and can be opened in MS Office (or any other XML viewer) without any errors.
 
Code:
<?xml version="1.0"?>
<note>  

   <Variables Name="" Date="2011/04/08 21:40:32">
      <var_1>xxx1</var_1>
      <var_2>xxx2</var_2> 
   </Variables>
   <Variables Name="" Date="2011/04/08 21:40:32">
      <var_1>xxx3</var_1>
      <var_2>xxx4</var_2>
   </Variables>

</note>
 


 
Thanks!
Back to top
 
 
  IP Logged
IRobotSoft Administrator
IRobotSoft Administrator
*****


IRobotSoft, the Best
Internet Robot
System

Posts: 1608
Gender: male
Re: XML files by iRobot that can be read in MS EXC
Reply #3 - 04/13/11 at 09:46:39
 
That is really nice!  It seems office has several nice XML viewer interfaces.
Back to top
 
 

The Administrator.
WWW   IP Logged
Pages: 1
Send Topic Print