Hi! I don't have much knowledge of the Blockly framework (out of bounds of my expertise), and I looked at the .bky XML structure it produces (when saved to .aia or embedded in the image).
I've mapped/parsed those structures internally to my own data structures. But had a question after completely mapping every (too late I know).
How often can these structures change? Will they change every Blockly version update?
What's the best way to parse blocks to my own data structure? (in Java?)
Generally the structure shouldn't change that frequently. We've only done a few major updates of the Blockly library in App Inventor's history. It's still possible today to load an XML file from the original Blockly sources in App Inventor. However, at some point we may switch to using the JSON serialization scheme rather than the XML serialization now that we are on a version of Blockly that supports it.
In Java, you'll probably need to write a SAX style parser to parse it with any of the common XML parsing libraries. If you're using Python, we publish a library called aiatools that can read an AIA file and provides a number of querying capabilities. It's mostly used for our own internal analysis so the documentation is a bit sparse though.