Skip to Content
0
Jun 02, 2014 at 09:12 AM

Error calling XML view - subfolder not "found"

143 Views


Hello,

We have a strange issue calling an XML view. In our app, we want to use both JS and XML views, for the sake of comparison.

In our index.html, we have the following code to switch between JS and XML views (we basically want to test both varieties):

if (gup("uiModel") === "XML")
{
sap.ui.localResources("xml_directory");
var view = sap.ui.view({id:"xmlMain", viewName:"xml_directory.main", type:sap.ui.core.mvc.ViewType.XML});
view.placeAt("content");
}
else
{
sap.ui.localResources("javascript_directory");
var view = sap.ui.view({id:"idmain1", viewName:"javascript_directory.main", type:sap.ui.core.mvc.ViewType.JS});
view.placeAt("content");
}

(The "gup" function is defined in the same file - just omitted here for sake of clarity. I've also changed the "real" directory names here).

The idea is that the UI5 app will branch to the JS view by default, unless we specify "?uiModel=XML" in the URL - as a parameter. For the JS version, this works nicely. However, when adding the uiModel parameter, we get the following error:


"uncaught error: resource xml_directory/main.view.xml could not be loaded from ./xml_directory/main.view.xml. Check for 'file not found' or parse errors."

It seems like the XML directory cannot be found - even though it is a subfolder of WebContent, just like the JC directory.

Commenting out the check on uiModel = XML and branching straight to the XML directory also fails.

In other words, the JS folder seems to be "found", whereas the XML folder goes unnoticed. Has anyone had similar issues?

For the record: our folder structure is:

../WebContent/xml_directory

and

../WebContent/javascript_directory

The index.html file is of course under the WebContent directory. Both javascript_directory and xml_directory contains main views (main.view.js and main.view.xml repsectively, plus their "main" controllers).


In short, the JS version of our view works, whereas the XML version cannot be "found". Seems like the subfolder is not "visible". Anyone have an idea?

Regards,

Trond