You are not logged in.

1

Thursday, February 19th 2015, 2:47pm

Extracting the generated xml

Hi,

I am trying to extract the generated (i.e. 'live view') XML from KRPano using the API. It seems that the variable "xml.content" only contains the original XML before it was manipulated (e.g. hotspot added).

I can see that the Editor plugin has a "get generated xml" button which does exactly what I require, but the plugin source is not available to see how it is done.

How can I extract the 'live' XML from memory?

Thanks.

Martin

Umalo

Professional

Posts: 1,051

Location: Osijek, Croatia, EU

  • Send private message

2

Thursday, February 19th 2015, 8:02pm

"Live" xml doesn't exist in memory like that. Using original xml and adding new hotspots from memory is the way on how to make new xml.

3

Friday, February 20th 2015, 11:28am

Hi,

right - there is no live xml, the xml is only a transport/storage format - internally krpano is organized in an object structure (similar to the HTML DOM).

You could either manually store the original xml and modify if (by inserting, remove or replace texts) or manually rebuild the xml by reading-out all values and generating the xml this way, this would be like a snapshot of the current state (e.g. the editor plugin is doing this), but that's not always the optimal solution when things were build dynamically by scripts.

Best regards,
Klaus

4

Friday, February 20th 2015, 2:04pm

Thanks for the reply.

Having looked into it further I've also realised that the objects (hotspots, etc.) are not held in a single object 'graph' but are in separate arrays of objects.

I guess I misinterpreted the editor.swf, thinking that it showed use of an API call to retrieve the updated XML. (I think it should be more clear that there is no underlying single KRPano state.)

Edit: thanks for confirming Klaus - I didn't see your reply until I had already clicked 'Submit'. We will extract the properties from KRPano and apply the changes to the original XML stored in our database. It's an extra step but not a big problem.