Re: Empty URI & URI references

Frans Englich schrieb:
> Hello all,
> 
> Is an empty string a valid URI, URI reference, or both?
> 
> In my particular case I have a C++ class for representing URIs that for long 
> has flagged empty strings as invalid, but when using it to implement 
> specifications I am confronted with that some consider it wrong.
> 
> When one googles around on this topic one finds lots of confusion, and 
> according to my reading, a slight leaning towards treating empty strings as 
> valid:
> 
> * http://www.stylusstudio.com/xmldev/200404/post30160.html
> * http://en.wikipedia.org/wiki/Uniform_Resource_Identifier#URI_reference
> * http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4478501
> * RFC 2396, C.2. Abnormal Examples
> * RFC 2396, 4.2. Same-document References

Well. I'd recommend to look at what's normative.

"URI" is defined in RFC3986, Section 3 
(<http://greenbytes.de/tech/webdav/rfc3986.html#rfc.section.3>), and 
obviously can not be empty.

"relative-ref" is defined in RFC3986, Section 4.2 
(<http://greenbytes.de/tech/webdav/rfc3986.html#rfc.section.4.2>), and 
can be empty.

"URI-reference" is define as:

	URI-reference = URI / relative-ref

> If I'm going to take a shot, I'd say that empty URIs are invalid, but empty 
> URI references are valid.

I'd rephrase that as "an empty string by definition can not be a URI".

> I'd say that URI is more of an abstract concept, and that URI references is 
> what we deal with. The latter being the shadow image of the perfect figure we 
> cannot touch or see.

Both are just syntactical constructs, so I don't see how one is abstract 
and the other isn't...

> So, for a class that 'parses "URIs"', I'd say that accepting the empty string 
> is the right thing to do.

I would say it's the wrong thing. A URI reference is not a URI. Say 
"parses URI references" instead.

> Disentanglement, clarification would be highly appreciated.

Hope this helps,

Julian

Received on Tuesday, 19 December 2006 14:42:38 UTC