• Hello Klaus,

    I believe I have uncovered a bug in the JS viewer.

    I followed directions regards using the Safari Browser to check Iphone and Ipad - I am choosing User Agent 4 Safari .3.3 iPad.

    My XML file is in two parts because I am using one of the methods mentioned elsewere in a forum to set language ( English French German ) variables inside an XML file that then calls the generic XML which uses those variables in order to translate button text and so on.

    I have reduced the bug down to its barest elements ( please note all these examples work in the flash viewer - the bug report relates to the JS viewer ).

    ==============================================================

    Case1: ( This works ok ) - simple single file

    <krpano version="1.0.8.14" onstart="startup();" debugmode="true" >
    <data></data>
    <data></data>
    </krpano>

    ==============================================================

    Case2: ( This does not work ) - two files which should be equivalent to case1

    FILE1

    <krpano version="1.0.8.14" onstart="startup();" debugmode="true" >
    <include url="sthut1.xml"/>
    </krpano>

    FILE2 ( named sthut1.xml )

    <data></data>
    <data></data>

    Reported error - xml parsing failed

    ==============================================================

    Case3: (This does work) - same as case 2 but include file has only one tag pair.

    FILE1

    <krpano version="1.0.8.14" onstart="startup();" debugmode="true" >

    <include url="sthut1.xml"/>

    </krpano>


    FILE2 ( named sthut1.xml )

    <data></data>

    ==============================================================

    After experimentation it would seem that the JS viewer does not tolerate more than one tag pair in the imported file - this is the only difference between cases 2 and 3. I tried other tag types in the imported file to replace the example tag type <data></data> and the result was the same.

    The same XML under flash operation ( by changing the user agent ) works fine.

    Obviously my example is not useful - I took my real example and stripped out everything step by step and substituted complex code by simple code to capture the problem like this.

    Is the forum the usual place to report bugs?

    Kind regards

    Jon


    I have purchased the js 'iPhone' license - I am actually still getting the demo
    version title on the panorama - I placed the js licence in the swf
    folder as instructed. I have not fully explored this issue so it may be that I am just making an error. I
    did wish to organise my folders "pano_swf" "pano_js" "pano_xml" which
    seems incompatiable with the instruction that the js licence goes in the
    same folder as the SWF file so I guess I will have to revise my proposed directory structure and keep JS and SWFs in one single folder. At the moment my licence is in the folder "pano_swf" and the "krpano.js" file is in the pano_js folder although it is renamed.

    2 Mal editiert, zuletzt von Jonnie (29. Dezember 2011 um 00:03)

  • Did your include files start and end with <krpano> and </krpano> ?

    After re-reading though, you got example 3 to work so I guess you do have the start and end tags.

    Hi

    No, see documentation for include...

    The <include> node:

    The include nodes can be used to load and include other xml files.
    Before krpano starts to parse and resolve a xml file, it searches
    the xml for all include nodes. When a include node will be found,
    the given xml will be loaded and the content of the loaded xml file will
    replace the include node in the source xml structure.

    This is similar to PHP and other languages - the contents of the included file replace the <include> statement in the calling file.

    Adding krpano start and end tags in the include file would result in doubly nested krpano tags which I take to be incorrect although the doc for <krpano>
    does not state this explicity.

    "The root node of the xml file is <krpano> node.
    All other nodes must be placed inside this node. The most nodes can be defined more than once."

    I would take this to mean only one krpano node per nested ( via include mechanism ) set of xml files since the include mechanism is supposed to deliver the same
    result as would be obtained if all the included files were expanded out into the top level file.

    But as you say example 3 works fine so I dont think this is the issue.

    Regards
    Jon

  • Those data tags have unique names right?


    <data name="P1">foo</data>
    <data name="P2">bar</data>

    Hi

    I started off with a complex file and paired it down to isolate the problem so what you see is bare bones and yes on some occassions I tried tags with no names or
    other attributes but other times I used tags directly cut and pasted in from the online doc examples precisely to ensure that I was not myopically ignoring some constant error or typo on my part.

    The only constant factor was that two tag pairs ( by a tag pair I mean <xyz></xyz> ) resulted in error and one tag pair did not so I have tried a whole set of combinations with and without names and so on.

    This makes me think that the JS viewer has problems if the include file includes more than one tag pair. Also of course the flash version works just fine on these files.

    regards

    Jon

  • No this would result in a parse error.
    You must have a top level xml in all xml includes. krpano loads each xml so it must be valid.
    Not the same in php.. if you want to use a php include for this xml.. like I do, then you can omit the top level tag because it would become transparent to krpano.

    I whipped up a quick example, and everything worked fine with my include.

    Code
    <krpano>
    <data name="F1"></data>
    <data name="F2"></data>
    <data name="F3"></data>
    </krpano>

    I guess that's your problem. Why it works in flash I don't know.

    [quote='Jarredja',index.php?page=Thread&postID=34436#post34436]Did your include files start and end with <krpano> and </krpano> ?

    Adding krpano start and end tags in the include file would result in doubly nested krpano tags which I take to be incorrect although the doc for <krpano>
    does not state this explicity.

    Regards
    Jon

  • Hi Sacha,

    Thanks for the reply.

    I just added <krpano></krpano> to wrap the file I was trying to include and yes you are right, the problem goes away.

    I would like to ask Klaus to highlight this issue in the doc I think the definition of include is mis-leading on this issue.

    The <include> node:


    The include nodes can be used to load and include other xml files.

    Before krpano starts to parse and resolve a xml file, it searches

    the xml for all include nodes. When a include node will be found,

    the given xml will be loaded and the content of the loaded xml file will

    replace the include node in the source xml structure.

    I think that the words "replace" strongly suggests that there should be no difference between a file that imports some content via <include> and another file where the programmer decides not to use the include mechanism and simply has one longer top level xml file with all his code in one file. I feel this doc and the use of the word "replace" leads to the conclusion that the include file should only contain the content intended to "appear" at the designated place whereas actually it requires an additional krpano wrapper that would not be required if the programmer had simply writtten one long top level xml file with all his code in one file.

    I think it needs to be explicitly stated in the above doc that included files must have their own krpano wrappers if this is the intended behaviour.

    Thanks for your help on this issue.

    Kind regards

    Jonnie

    No this would result in a parse error.
    You must have a top level xml in all xml includes. krpano loads each xml so it must be valid.
    Not the same in php.. if you want to use a php include for this xml.. like I do, then you can omit the top level tag because it would become transparent to krpano.

    I whipped up a quick example, and everything worked fine with my include.

    Code
    <krpano>
    <data name="F1"></data>
    <data name="F2"></data>
    <data name="F3"></data>
    </krpano>

    I guess that's your problem. Why it works in flash I don't know.

  • I think because the JS version perhaps uses some xml library.. and loads it as a real XML, without the top node the XML is invalid per XML specs and throws a parse error.
    If you navigate to your xml that you included in a browser, it will also show invalid. There can never be enough documentation, but these forums also help tremendously. I'm happy you were able to solve your problem. Also, the examples that came with krpano show a lot of great information. For example, you can see how they use includes as well.

  • From my memory, in general an XML file must have a root tag. Alsoo having a xml dtd helps too.

    http://www.w3schools.com/xml/xml_tree.asp

    I think it can be any tag for instance

    <xml>
    <data name="f1" />
    </xml>

    will probally work too.

    the flash xml parser is more flexible then the javascript one.

    An dtd helps the browser to recognize the file better

    <?xml version="1.0" encoding="ISO-8859-1"?> or <?xml version="1.0" encoding="utf-8"?> at line 1 before the root tag

  • Hi,

    I think that the words "replace" strongly suggests that there should be no difference between a file that imports some content via <include> and another file where the programmer decides not to use the include mechanism and simply has one longer top level xml file with all his code in one file. I feel this doc and the use of the word "replace" leads to the conclusion that the include file should only contain the content intended to "appear" at the designated place whereas actually it requires an additional krpano wrapper that would not be required if the programmer had simply writtten one long top level xml file with all his code in one file.

    I think it needs to be explicitly stated in the above doc that included files must have their own krpano wrappers if this is the intended behaviour.

    this was (and is) the right state in the krpano Flash viewer,

    but in HTML5 viewer (which was developed later after the krpano Flash viewer) the xml parser of the browser was used, and there the xml parser is more sensitive to xml errors - that means there a xml root is absolutely necessary (different to Flash),

    so using a <krpano> xml root note was necessary there,

    but you're right - the documentation should describe that - I will change that,

    best regards,
    Klaus

Jetzt mitmachen!

Sie haben noch kein Benutzerkonto auf unserer Seite? Registrieren Sie sich kostenlos und nehmen Sie an unserer Community teil!