LibXML: How to load XML from a string?

BlitzMax Forums/Brucey's Modules/LibXML: How to load XML from a string?

Murilo(Posted 2010) [#1]
I'm back to writing my Google Docs app (after having a nightmare upgrading the RAM in my Mac Mini).

Using Brucey's (fantastic) LibCurl module, I'm able to post my HTTP requests to Google, and a response containing XML is being returned. I now want to use LibXML to process the response. I have the XML stored in a string variable.

What's the best way to load the contents of this variable into a LibXML document?

The examples seem to use the "FromFile" method, but my XML is contained in an in-memory string. I'm sure I'm overlooking something here, but my BlitzMax is still a little rusty.

Thanks


Brucey(Posted 2010) [#2]
There are several APIs available. Usually the "Doc" functions are the ones which handle String representations.

The TxmlTextReader API has fromFile() and fromDoc().

TxmlDoc has parseFile(), parseDoc(), readFile() and readDoc().
The readDoc() function also comes with TStream support.

At some point, I also may be able to provide TStream support for fromDoc().
When you have TStream support, you can do things like parsing directly from HTTP streams or memory banks.

HTH

:o)


Murilo(Posted 2010) [#3]
Great stuff! Thanks Brucey.