1 31 36 37 package com.hp.hpl.jena.rdf.arp; 38 39 44 class ARPQname extends Token { 45 final String nameSpace; 46 final String local; 47 final String qName; 48 49 ARPQname(int kind, Location where, String ns,String name,String q) { 50 super(kind,where); 51 qName = q; 52 nameSpace = ns; 53 local = name; 54 } 55 ARPQname(String ns,String name) { 56 super(E_OTHER,null); 57 nameSpace = ns; 58 local = name; 59 qName = null; 60 } 61 String prefix() { 62 int ix = qName.indexOf(':'); 63 return ix==-1?"":qName.substring(0,ix); 64 } 65 URIReference asURIReference(XMLHandler arp) throws ParseException { 66 URIReference uri; 67 try { 68 uri = new URIReference(nameSpace+local); 69 73 } 74 catch ( MalformedURIException mal ) { 75 try { 77 arp.documentContext.resolve(location, nameSpace+local); 78 if ( nameSpace.length() == 0 ) { 82 arp.parseWarning(ARPErrorNumbers.WARN_UNQUALIFIED_ELEMENT, 83 location, 84 "Element node must be qualified."); 85 86 } else { 87 arp.parseWarning(ARPErrorNumbers.WARN_RELATIVE_NAMESPACE_URI_DEPRECATED, 88 location, 89 "The use of relative URIs in namespaces has been deprecated by the World Wide Web Consortium."); 90 } 91 } 92 catch ( MalformedURIException mal2 ) { 93 arp.parseWarning(ARPErrorNumbers.WARN_MALFORMED_URI,location,"Bad URI <"+nameSpace+local+"> in qname: " + mal.getMessage()); 95 } 96 uri = new BadURIReference(nameSpace+local); 97 } 98 return uri; 99 } 100 101 } 102 | Popular Tags |