I am trying to dynamically display some SVG content. This content is stored as a string in my data source. An example string would look like the following:
You can use jQuery SVG plugin The official website is down, but poke around for instructions.
The relevant part you are asking is answer in this section, I believe..
load(url, settings) this wrapper Load an external SVG document. Note that the browser may not allow you to load documents from sites other than that of the original page. If no callback is provided and an error arises, the error message is displayed within the SVG container.
url (string) is the location of the SVG document or the actual SVG document inline.
settings (boolean) see addTo below or (function) see onLoad below or (object) additional settings for the load with attributes below:
addTo (boolean, optional) true to add to what's already there, or false (the default) to clear the canvas first changeSize (boolean, optional) true to allow the canvas size to change, or false (the default) to retain the original size onLoad (function, optional) callback after the document has loaded, this function receives the SVG wrapper object and an optional error message as parameters, and within which this is the SVG container division.
svg.load('images/rect01.svg',
{addTo: true, onLoad: loadDone});
svg.load('', loadDone);
also, for kicks, here is some PHP code I used to insert such an SVG in a looping statement, that worked nicely..
if (ICON_FILE_EXT == "svg") {
print "\