W3C home > Mailing lists > Public > xmlschema-dev@w3.org > January 2001

Re: posting xml to xsv

From: Dan Connolly <connolly@w3.org>
Date: Mon, 08 Jan 2001 14:01:55 -0600
To: Donna Bergmark <bergmark@CS.Cornell.EDU>
Cc: xmlschema-dev@w3.org
Message-id: <3A5A1CB3.29A9F0FD@w3.org>
Donna Bergmark wrote:
> Hello,
> I wish to use xsv to validate submissions to the Open Archive Initiative.
> Therefore, I would like to use your service from a cgi script.  I have
> attempted a POST to your url, with the content set to docFile=filename,
> style=text.  What I get back from the validator is:

Er... you're trying to pass docFile by reference? That won't work;
the process running on our machine can't read the file on your
machine; you have to send the _contents_, not the filename,
in the request.

> Traceback (most recent call last):
>   File "/usr/local/Jigsaw/Jigsaw/WWW/cgi-bin/new-xmlschema-check", line 250, in ?
>     serveRequest()
>   File "/usr/local/Jigsaw/Jigsaw/WWW/cgi-bin/new-xmlschema-check", line 155, in serveRequest
>     data = upFile.file.read()
> AttributeError: 'None' object has no attribute 'read'

What's going on here is (most probably) that the code expects
an uploaded file (see "11.2.2 Using the cgi module"
for details)
but you're just giving it a string.

The diagnostic could be improved,
Henry, with a try..except block around the upFile.file.read() thingy
to catch this exceptional case.

Donna, try passing docFile by value, using multipart/form-data.
See multipart/form-data in the HTMl 4.01 spec

and/or your API documentation; if you're using python:

	12.4 MimeWriter -- Generic MIME file writer
	Mon, 16 Oct 2000 14:56:14 GMT

I'm sure there are examples of file upload clients out there, if you're
willing to surf around a bit.

> It would appear that it is not picking up the docFile value.  To check
> it out, I decided to use the form itself, interactively.  It did nothing.
> The file in question is world-readable.
> What could be wrong?  Donna

Dan Connolly, W3C http://www.w3.org/People/Connolly/
Received on Monday, 8 January 2001 15:08:28 UTC

This archive was generated by hypermail 2.3.1 : Wednesday, 7 January 2015 14:55:50 UTC