From: Florian G. H. <fg...@bk...> - 2002-06-06 22:11:12
|
Hello, I've now changed the rewritten Merge utility according to Kal's suggestio= n of=20 using the TopicMapProviderImpl class. However, one issue arises (try the=20 Merge utility with "http://www.topicmaps.org/xtm/1.0/core.xtm" for an=20 illustration): TopicMapProviderBase creates an InputSource from an InputStream. Let's sa= y=20 that the stream was obtained by invoking the getInputStream() method on a= =20 URLConnection because one was trying to read/add/merge a topic map identi= fied=20 by a URL (a common scenario, I guess). The InputSource has no way of know= ing=20 how to resolve URI's relative to the document that the InputStream=20 represents: for all it cares, it only deals with some InputStream, and=20 goodness knows where that stream might have come from. You would have to = use=20 InputSource.setSystemId() in order for the InputSource to resolve relativ= e=20 URIs correctly. So without that invocation of setSystemId(), the SAX pars= er=20 isn't even able to parse the document if the !DOCTYPE declaration does no= t=20 contain an absolute URI for the DTD (which is the case for core.xtm as=20 mentioned above). It gets worse. AKAIK there is no way to determine for sure whether the=20 InputStream was obtained from a URLConnection: if, in contrast, a stream = was=20 opened on a file, then fine, it's instanceof FileInputStream. Yet there i= s no=20 such thing as a URLConnectionInputStream; URLConnection.getInputStream()=20 returns just a generic java.io.InputStream. It is (again, to the best of = my=20 knowledge) impossible to determine what URL that InputStream was created=20 from, so even if TopicMapProviderBase did invoke InputSource.setSystemId(= ),=20 it would't know what system ID to use! Am I getting something wrong or are we looking at a, um, feature here? -- Florian --=20 Florian G. Haas <fg...@bk...> GnuPG public key: http://www.fgh.bkf.at/gpgkey.asc Key fingerprint: 3C24 E021 33B1 9E98 B94B 2F21 860A B693 1B33 BB3C |