cancel
Showing results for 
Search instead for 
Did you mean: 

importing XSD in web forms

unmeshjoshi
Champ in-the-making
Champ in-the-making
Hi,

We are trying to include a XSD file from the home directory to alfresco template. We have shared.xsd in alfresco home and we are importing it in other xsds for webforms.
If we import XSD as,

<xs:import schemaLocation="/shared.xsd" namespace="http://www.myhome.com'/>

Alfresco somehow replaces it as following.

<xs:import namespace="http://www.myhome.com" schemaLocation="http://user-name.company-home.www--sandbox.127-0-0-1.ip.alfrescodemo.net:8180/shared.xsd'/>

And we can not create the content, because it can not resolve elements in shared.xsd. Anyone knows how to import XSDs in webforms?

Thanks,
Unmesh
2 REPLIES 2

unmeshjoshi
Champ in-the-making
Champ in-the-making
Hi,

Looking at the alfresco source code, I found following
// It's a web project asset include / import
               final String baseURI = (uri.charAt(0) == '/'
                                       ? AVMUtil.getPreviewURI(AVMUtil.getStoreName(cwdAvmPath))
                                       : AVMUtil.getPreviewURI(cwdAvmPath));

               finalURI = baseURI + uri;

So alfresco replaces inline callouts with preview url.

I tried previewing the shared XSD file from alfresco web UI. But I am unable to. When I click on "preview" icon, it opens up browser with following url

http://user.webproject.www--sandbox.127-0-0-1.ip.alfrescodemo.net:8180/services/shared.xsd

If I click on the file directly. (not the 'preview' button), it opens up the file correctly with following url in browser
http://localhost:8180/alfresco/d/d/avm/webproject--user/-1;www;avm_webapps;services;shared.xsd/share...

Is this a bug with alfresco? Or we need to do some setting so that preview urls are correctly generated, so that inline includes/imports work in WCM?

I am using alfresco version 2.2

Thanks,
Unmesh

unmeshjoshi
Champ in-the-making
Champ in-the-making
Well I needed to start virtualization server. I do not know if its documented anywhere.

If you need to import/include local XSD in webforms, you need to start virtualization server.
A simple looking XSD import like
<xs:include schemaLocation="/shared.xsd">
gets translated to
<xs:include schemaLocation="http://admin.webproject.www--sandbox.127.0.0.1.ip.alfrescodemo.net:8180/shared.xsd'/>

Only after you start the virtualization server (./virtual_start.sh), this works.