Parse XML data

I am trying to read XML data in Arduino from a google spreadsheet published to the web using an HTTP GET request to the following link.

https://spreadsheets.google.com/feeds/cells/SpreadsheetID/5/public/basic?&range=D10
I receive the following reply along with some headers which I can observe on the serial port.

I want to parse the data written in bold format in the above reply. The data can be a real number and can be positive & negative. Please help me to find a way to parse this data.

http://www.grinninglizard.com/tinyxml/

I think that an 8 bit Arduino is unable to hold the DOM tree, created by TinyXML. Instead a stream-oriented parser (SAX…) should be used. Which Arduino do you want to use?

DrDiettrich:
I think that an 8 bit Arduino is unable to hold the DOM tree, created by TinyXML. Instead a stream-oriented parser (SAX...) should be used. Which Arduino do you want to use?

I doubt it. I'm using it to parse a huge page already. I can't recall how, but it does, flawlessly.

Then either the documentation is wrong, or you use an Arduino with much more than only a few kB RAM.

Can you please tell me if tinyxml will be able to parse data from the above image? I am new to Arduino. Please help if possible with the code.

Thanks. :slightly_smiling_face:

DrDiettrich:
Then either the documentation is wrong, or you use an Arduino with much more than only a few kB RAM.

It seems like there might be more than one tinyXML. The one I have is purportedly by J. Crouchley, although it might be a file mixup, as it mentions a display library:

/* LCD library for noka 3110 display
 * Date: January 2010
 * Author: J Crouchley
 *
 * This is a table driven parser for simple XML,
 * Pass the XML into the library one character at a time
 * the callback function will be called at 'interesting'
 * point (got a tag, got an attribute value, tag text, end of tag)
 * with information about the tags and any values.

The way that reads, I think there is no DOM tree, just a parse table. Honestly, I have it running on a Mega, but I don't think it uses that much memory. Strangely, I cannot locate the original source. I don't even have a zip file. This is the reason I started saving links to all the libraries that I use now. But this one slipped through the cracks. It probably works the way the other one you mentioned works.

komalhm:
Can you please tell me if tinyxml will be able to parse data from the above image? I am new to Arduino. Please help if possible with the code.

Thanks. :slightly_smiling_face:

Download SAX and have a look. I will too. :slight_smile:

Downloaded SAX library. I am not understanding how I'll be able to use it with an Arduino.

komalhm:
Downloaded SAX library. I am not understanding how I'll be able to use it with an Arduino.

Why?

Can you provide me an example?

Are there no examples included with the library?

It doesn't look like a standard library that is available for Arduino. There are no examples. May be I have downloaded something wrong. Please provide me with a link for the correct download file.

How about you provide me with a link for the one you have?

If you want to use the alternate tinyXML library, I found it here:
http://john.crouchley.com/blog/archives/454

https://sourceforge.net/projects/sax/files/

Is this the proper link?

I added a link. So now I'm not sure which link you are referring to by "this".

SAX: Simple API for XML - Browse Files at SourceForge.net i mean this link for SAX library

komalhm:
SAX: Simple API for XML - Browse Files at SourceForge.net

This is Java code. It won't run on an Arduino. I think Crouchley's library is your only hope, I linked to it in reply #13.

komalhm:
Can you provide me an example?

An example for real spreadsheet files will be very long, due to the many tags in such XML files. The file you linked in your first post is only an XML scheme, which only contains a description of the file format, but no data.

Please try to find the file containing the data, and post at least some lines containing the values you want to get. Then we can try to construct an specialized parser for these values.