Re: [exslt] URL check
by Jeni Tennison other posts by this author
Aug 8 2001 8:36AM messages near this date
Re: [exslt] URL check
|
Re: [exslt] URL check
Bruce Gray wrote:
> Therefore it would seem either two functions are required (one
> accepting only well formed resources, the other accepting any
> existing resource) or one function that provides some mechanism for
> handling these different scenarios.
It sounds to me like three separate functions:
document() - accesses a well-formed XML document; returns an empty
node set if the document is unavailable or not a
well-formed XML document
file() - accesses a text document; returns a string with the content
of the text document (not interpreted as XML), or an empty
string if the file is unavailable
file-exists() - returns true if a file exists, false if it does not;
the file may be of any type, which allows you to
check for the existence of images etc.
I/O always leads to the possibility of side-effects, so these should
be carefully worded to indicate that calling the three functions on
the same document will result in only one access of the document; if a
file exists it *must* be accessible through file(), and if you access
an XML document with document() then the string that you get from
file() must be a logical representation of the node tree retrieved
through the document() function.
There would be encoding issues with the file() function, I think? We
would need to have a third argument to indicate the expected content
encoding of the file (which could be overridden through by an encoding
indicated by HTTP headers).
The file-exists() function would meet Oliver's original requirements,
but there is the possibility of going further with a whole host of
HTTP-related functions that we should probably steer clear of for now?
As far as a module for all this goes, we've had several suggestions:
HTML (html)
Network (net)
System (sys)
Could also be Files (file). Possibly document() could go in the Common
module. Any ideas/preferences?
Cheers,
Jeni
---
Jeni Tennison
http://www.jenitennison.com/
_______________________________________________
exslt mailing list
list@[...].org
http://www.exslt.org/list
Thread:
Bruce Gray
Jeni Tennison
Norman Walsh
Michael Kay
Jeni Tennison
Michael Kay
|