1 6 package com.hp.hpl.jena.rdf.arp; 7 import java.util.Map ; 8 9 13 class XMLNullContext extends XMLContext implements ARPErrorNumbers { 14 final XMLHandler forErrors; 15 final int errno; 16 final String errmsg; 17 18 XMLNullContext(XMLHandler f, int eno) { 19 super(null,null); 20 forErrors = f; 21 errno = eno; 22 errmsg = eno==ERR_RESOLVING_URI_AGAINST_NULL_BASE? 23 "Base URI is null, but there are relative URIs to resolve.": 24 "Base URI is \"\", relative URIs left as relative."; 25 } 26 private XMLNullContext(XMLContext document,URI uri,String base,String lang,Map namespaces, 27 XMLNullContext parent) { 28 super(document,uri,base,lang,namespaces); 29 forErrors = parent.forErrors; 30 errno = parent.errno; 31 errmsg = parent.errmsg; 32 } 33 XMLContext clone(XMLContext document,URI uri,String base,String lang,Map namespaces) { 34 return new XMLNullContext(document,uri,base,lang,namespaces, this); 35 } 36 37 String resolve(Location l, String uri) throws MalformedURIException, ParseException { 38 try { 39 URI rslt = new URI(uri); 40 return rslt.getURIString(); 41 } catch (RelativeURIException e) { 42 44 forErrors.parseWarning(errno, 45 l, 46 errmsg); 47 return uri; 48 } 49 } 50 String resolveSameDocRef(Location l, String sameDoc) throws ParseException { 51 52 54 forErrors.parseWarning(errno, 55 l, 56 errmsg); 57 return sameDoc; 58 } 59 60 boolean isSameAsDocument() { 61 return this==document; 62 } 63 } 64 65 | Popular Tags |