Hi, from what I understand all the loaded xml is accessible via xml.content before a scene is loaded, then only the scene xml will be accessible right ?
https://krpano.com/docu/actions/#xml.content
when I do a trace(xml.content) when a scene is loaded it works as expected, but if I try before loading any scene then it looks that xml.content doesn't exist ?
How can I have access to the whole content of the currently loaded xml file ?
Many thx !
![](https://krpano.com/forum/wbb/core/images/avatars/57/373-57aaa41e6e06b159c99e71f2e77cf4fddbf582b7.png)
xml.content
-
-
The xml.content variable contains the whole content of the currently loaded xml file as string. After loading a <scene> with the loadscene() action, the xml.content variable will contain only the content of the <scene> element.
-
My question was how to get xml.content BEFORE loading a scene ;)
-
-
I'm not trying to get scene content but all xml file content
-
despite it looks possible in the docs
https://krpano.com/docu/actions/#xml.content
xml.content never has a value before it gets the scene contentatm, i dont think it is possible to get the non-scene xml content.
-
I was hopping reading the docs ;)
-
I was hopping reading the docs ;)
normally worksi just tried preinit... there xml.content is empty
onxmlcomplete and onloadcomplete ... there xml.content already has the scene content
maybe klaus will shed a light on this :)would be interesting to check if xml.complete holds the main xml if there is no scene in the xml.
-
Hi,
the first onxmlcomplete event should contain the whole xml content.
xml loaded => onxmlcomplete => xml.content = the whole xml content
scene loaded => onxmlcomplete => xml.content = only the scene xml contentAlternatively you could use loadFile to load the xml again (would be typically loaded from cache):
https://krpano.com/docu/plugininterface/#loadFileE.g.
Code<action ... type="Javascript"> krpano.loadFile("%CURRENTXML%/tour.xml", function(loader) { console.log(loader.data); }); </action>
Best regards,
Klaus -
Thx Klaus,
the loadfile method works perfect.
however I never managed to get the whole content with xml.content and onxmlcomplete ?Code<events name="storexml" onxmlcomplete="if(!myxml,copy(myxml,xml.content);showlog();trace(myxml))" keep="true"/>
only the first loaded scene content is traced, and 3 times ?
and if I don't load a scene I have in the consol INFO : xml.content -
Hi,
I have checked that now and right, sorry, there was unfortunatly a bug (not sure yet when introduced) that caused the xml.content variable to be not set.
Will be fixed in 1.20.9.Best regards,
Klaus -
i guess it will contain the merged xml after processing all includes?
(probably including the scene definitions)best, index
-
Hi,
no, it contains just the original xml file content (like it does in older versions).
The include resolving and so an happens later internally during parsing. That means there exists no kind of 'merged xml'.
Best regards,
Klaus
Jetzt mitmachen!
Sie haben noch kein Benutzerkonto auf unserer Seite? Registrieren Sie sich kostenlos und nehmen Sie an unserer Community teil!