- From: Ralph R. Swick <swick@csail.mit.edu>
- Date: Fri, 22 Jul 2005 09:17:48 -0400
- To: public-cwm-bugs@w3.org
A bug in several RDF/XML parsers' interpretations of xml:base
recently came to light [1]. The bug had to do with failure to
interpret nested xml:base attributes correctly; in particular,
the XML Base Recommendation allows an xml:base attribute
to contain a relative URI which is then interpreted in the context
of the base URI of the parent element [3].
[1] http://lists.w3.org/Archives/Public/semantic-web/2005Jul/0040.html
[2] http://www.w3.org/TR/xmlbase/
[3] http://www.w3.org/TR/xmlbase/#matching
The test case in the bug report [1] reveals that several RDF/XML
parsers fail to correctly resolve such nested xml:base attributes.
Running this test through cwm reveals that cwm (rev 1.162,
xml2rdf.py rev 1.20, xmllib rev 1.2, sax2rdf.py rev 1.42) does not
even permit relative URIs in xml:base:
% cwm --rdf << EOF
? <?xml version="1.0"?>
? <rdf:RDF xml:base="http://example.org/"
? xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
? xmlns:dc="http://purl.org/dc/elements/1.1/">
? <rdf:Description rdf:about="http://www.w3.org/" xml:base="test1/">
? <dc:title>World Wide Web Consortium</dc:title>
? <dc:source rdf:resource="test2/"/>
? <dc:relation rdf:resource=""/>
? </rdf:Description>
? </rdf:RDF>
? EOF
Traceback (most recent call last):
File "/home/swick/pub/2000/10/swap/cwm.py", line 635, in ?
doCommand()
File "/home/swick/pub/2000/10/swap/cwm.py", line 366, in doCommand
why = becauseCwm)
File "/afs/w3.org/pub/WWW/2000/10/swap/llyn.py", line 1152, in load
referer=referer, why=why)
File "/afs/w3.org/pub/WWW/2000/10/swap/webAccess.py", line 127, in load
p.feed(buffer)
File "/afs/w3.org/pub/WWW/2000/10/swap/sax2rdf.py", line 643, in feed
self._p.feed(data)
File "/usr/lib/python2.2/site-packages/_xmlplus/sax/expatreader.py", line 216, in feed
self._parser.Parse(data, isFinal)
File "/usr/lib/python2.2/site-packages/_xmlplus/sax/expatreader.py", line 353, in start_element_ns
AttributesNSImpl(newattrs, qnames))
File "/afs/w3.org/pub/WWW/2000/10/swap/sax2rdf.py", line 450, in startElementNS
x = self.sink.newSymbol(self.uriref(value))
File "/afs/w3.org/pub/WWW/2000/10/swap/sax2rdf.py", line 156, in uriref
return uripath.join(self._base, str)
File "/afs/w3.org/pub/WWW/2000/10/swap/uripath.py", line 106, in join
assert(bcolonl >= 0), "Base uri '%s' is not absolute" % here # else it's not absolute
AssertionError: Base uri 'test1/' is not absolute
%
Received on Friday, 22 July 2005 14:34:25 UTC