RE : Uploading files

Posted by Peymirat Damien on
URL: https://discuss.orbeon.com/Uploading-files-tp30091p30104.html

Hi Erik,

   All the files (main.xsd and base.xsd) are on a client's computer. So I upload the main.xsd like this :

View.xhtml:

<xforms:upload ref="file" xhtml:size="30">
        <xforms:label></xforms:label>
        <xforms:filename ref="@filename"/>
        <xforms:mediatype ref="@mediatype"/>
        <xxforms:size ref="@size"/>
        <xforms:hint>Choisissez le Schema XML à importer</xforms:hint>
</xforms:upload>

Model.xpl
...
<p:processor name="oxf:xslt">
        <p:input name="data" href="#instance"/>
        <p:input name="config">
                <config xsl:version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
                        <url>
                                <xsl:value-of select="/*/file"/>
                        </url>
                        <content-type>application/xml</content-type>
                        <force-content-type>true</force-content-type>
                        <cache-control>
                                <use-local-cache>false</use-local-cache>
                        </cache-control>
                </config>
        </p:input>
        <p:output name="data" id="url-config"/>
</p:processor>
<p:processor name="oxf:url-generator">
        <p:input name="config" href="#url-config"/>
        <p:output name="data" ref="data" id="output-file" debug="true"/>
</p:processor>
...


My problem is that I can't see how to upload the import element of main.xsd without asking the user. When I have uploaded the main.xsd, the only informations I have is <xs:import namespace="http://www.example.com/SYS/base/2.0/  schemaLocation="SYS/base/2.0/base.xsd"/> . And I don't know how to upload the file base.xsd (which is on client's computer) to the server ???


Thanks


Damien.




-----Message d'origine-----
De : Erik Bruchez [mailto:[hidden email]] De la part de Erik Bruchez
Envoyé : samedi 19 août 2006 03:24
À : [hidden email]
Objet : Re: [ops-users] Uploading files


Damien,

> How can I get the full url of my uploading file ?? Because to upload
> the file include in the schemaLocation, I need to have the path before
> SYS/base/2.0/base.xsd .

I don't quite understand the question. I assume the file is initially on
a client's computer, where its "URL" doesn't matter. Then you will
upload it into a database, and it is up to you to figure out through
which URL that schema will be accessible, for example through the eXist
REST API, or through your own code that serves the schema to whoever
uses it.

-Erik

--
Orbeon - XForms Everywhere:
http://www.orbeon.com/blog/

> Absolutely correct.
>
> -Erik
>
> Peymirat Damien wrote:
>> Thank you Erik for your answer,
>>
>>    However, the url schemaLocation="SYS/base/2.0/base.xsd" is not
>> complete. So I can't see how to use the url generator ?? I think I
>> have to build with xslt the complete url before using the url
>> generator but how to have the url of the uploading file ??
>>
>> Thanks again
>>
>> Damien.
>>
>>
>>> Roughly, one way of doing it:
>>>
>>> o Upload your main schema to a service implemented with XPL o With
>>> p:for-each, iterate over the schema imports
>>>    o For each import, fetch the imported schema with the URL generator
>>>    o Maybe modify the schemaLocation attribute in the main schema to
>>>      point to the future location in eXist
>>>    o Insert the imported schema into eXist
>>> o Insert the main schema into eXist
>>>
>>> -Erik
>>>
>>> Peymirat Damien wrote:
>>>> Hi all,
>>>>
>>>>
>>>>    I'm trying to build a XML Schema database. At the moment, I can
>>>> upload on my eXist database a XML file with a xforms:upload.
>>>> However, I have some XML Schema which have an import element like
>>>> that : <xs:import
>>>> namespace="http://www.example.com/SYS/base/2.0/"
>>>> schemaLocation="SYS/base/2.0/base.xsd"/>. So I would like to know how
>>>> to
>>>> put this file (base.xsd) in my eXist database without asking the user
>>>> to
>>>> upload it ?? In fact I just want that the user uploads his schema and
>>>> automatically the XML schema included in the import element is saved
>>>> in
>>>> my eXist database.
>>>>
>>>>
>>>> Thank you for your suggestions
>>>>
>>>> Best regards
>>>>
>>>> Damien.
>>>>
>>>>
>>>>
>>>> -------------------------------------------------------------------
>>>> -----
>>>>
>>>>
>>>> --
>>>> You receive this message as a subscriber of the
>>>> [hidden email] mailing list.
>>>> To unsubscribe: mailto:[hidden email]
>>>> For general help: mailto:[hidden email]?subject=help
>>>> ObjectWeb mailing lists service home page:
>>>> http://www.objectweb.org/wws
>>>
>>> --
>>> Orbeon - XForms Everywhere:
>>> http://www.orbeon.com/blog/
>>>
>>>
>>
>>
>>
>>
>> ---------------------------------------------------------------------
>> ---
>>
>>
>> --
>> You receive this message as a subscriber of the
>> [hidden email] mailing list. To unsubscribe:
>> mailto:[hidden email]
>> For general help: mailto:[hidden email]?subject=help
>> ObjectWeb mailing lists service home page:
>> http://www.objectweb.org/wws
>
>
> --
> Orbeon - XForms Everywhere:
> http://www.orbeon.com/blog/
>
>


--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
ObjectWeb mailing lists service home page: http://www.objectweb.org/wws