Keith Hopper wrote:
In article <[EMAIL PROTECTED]>,
   Eric van der Vlist <[EMAIL PROTECTED]> wrote:

Just a (theorical) comment about:


<file filename="" mediatype="" size="" xsi:type="xs:anyURI"/>


According to the W3C XML Schema spec, this should mean that the "file"
element has a simple type "xs:anyURI" and thus that it has no attribute
which is clearly not what you want to express.


[snip]

     I suspect the problem is that the filename attribute should be of
xsd:anyURI - the file element is just a file surely - of almost anything!

No, the type information here concerns only the text content of the <file> element, e.g. when a file is uploaded to the server, you can decide to have:


<file>file:/C:/Tomcat/temp/upload_00000005.tmp</file>

or:

<file>
/9j/4AAQSkZJRgABAQEBygHKAAD/2wBDAAQDAwQDAwQEBAQFBQQFBwsHBwYGBw4KCggLEA4R ... KKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooA//2Q==
</file>


I.e., the file content is available either as a URI, or directly encoded as Base64.

Now what Eric was saying was that in the XML Schema world, if you put an xsi:type attribute on an element, it determines the type of that element, which includes its content, but also also whether the element has attributes or not and what they are. Here, using simple types like xs:anyURI, or xs:base64Binary, we explicitly say that the <file> element does not have any attributes, which is the case in my little example above, but may not always be the case. For example, as a user you can decide that in your XForms instance, the file name information is stored as an attribute on the <file> element:

<xf:upload ref="file">
    <xf:filename ref="@filename"/>
</xf:upload>

Which results in:

<file filename="blah.jpg">file:/C:/Tomcat/temp/upload_00000005.tmp</file>

In such a case, it is no longer correct to have xsi:type="anyURI" on <file>, because of the attribute.

BTW the choice of having a <file> element is also determined by the user. E.g. you can have in your XForms instance:

<files>
    <first-file filename="" mediatype="" size=""/>
</files>

And then in your view:

<xf:upload ref="files/first-file">
    <xf:filename ref="@filename"/>
    <xf:mediatype ref="@mediatype"/>
    <xxf:size ref="@size"/>
</xf:upload>

In which case, the element containing either the URI or the Base64 data will be <first-file> not <file>.

-Erik


------------------------------------------------------- This SF.Net email is sponsored by: IntelliVIEW -- Interactive Reporting Tool for open source databases. Create drag-&-drop reports. Save time by over 75%! Publish reports on the web. Export to DOC, XLS, RTF, etc. Download a FREE copy at http://www.intelliview.com/go/osdn_nl _______________________________________________ orbeon-user mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/orbeon-user

Reply via email to