01: /**********************************************************************************
02: * $URL: https://source.sakaiproject.org/svn/help/tags/sakai_2-4-1/help-tool/src/java/org/sakaiproject/tool/help/URIResolver.java $
03: * $Id: URIResolver.java 7653 2006-04-12 12:10:02Z marquard@ched.uct.ac.za $
04: ***********************************************************************************
05: *
06: * Copyright (c) 2003, 2004 The Sakai Foundation.
07: *
08: * Licensed under the Educational Community License, Version 1.0 (the "License");
09: * you may not use this file except in compliance with the License.
10: * You may obtain a copy of the License at
11: *
12: * http://www.opensource.org/licenses/ecl1.php
13: *
14: * Unless required by applicable law or agreed to in writing, software
15: * distributed under the License is distributed on an "AS IS" BASIS,
16: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17: * See the License for the specific language governing permissions and
18: * limitations under the License.
19: *
20: **********************************************************************************/package org.sakaiproject.tool.help;
21:
22: import java.net.URI;
23: import java.net.URISyntaxException;
24:
25: import javax.xml.transform.Source;
26: import javax.xml.transform.TransformerException;
27: import javax.xml.transform.stream.StreamSource;
28:
29: /**
30: * uri resolver
31: * @version $Id: URIResolver.java 7653 2006-04-12 12:10:02Z marquard@ched.uct.ac.za $
32: */
33: public class URIResolver implements javax.xml.transform.URIResolver {
34:
35: /**
36: * @see javax.xml.transform.URIResolver#resolve(java.lang.String, java.lang.String)
37: */
38: public Source resolve(String href, String base)
39: throws TransformerException {
40: Source source = null;
41: String path = null;
42: try {
43: URI uri = new URI(base);
44: path = uri.resolve(href).toString();
45: source = new StreamSource(path);
46: } catch (URISyntaxException e) {
47: }
48:
49: return source;
50: }
51:
52: }
|