QNameProvider.java revision 2
/*
* Created on May 13, 2004
*/
/**
* A class to convert URI's to QNames. Borrowed from SWOOP code.
*
* @author Evren Sirin
*/
public class QNameProvider {
// stores a map of uri -> prefix
/**
*
*/
public QNameProvider() {
uriToPrefix = new Hashtable();
prefixToUri = new Hashtable();
// initialize it with standard stuff
}
public static boolean isNameStartChar(char ch) {
}
public static boolean isNameChar(char ch) {
}
int nameStartIndex = -1;
boolean foundNameChar = false;
if(isNameStartChar(letter)) {
foundNameChar = true;
}
break;
}
}
return nameStartIndex;
}
int nameIndex = -1;
if(isNameChar(letter)) {
}
else {
break;
}
}
return nameIndex;
}
int nameIndex = startIndex;
if(!isNameChar(letter)) {
break;
}
}
return nameIndex;
}
if(nameStart < 0) {
//System.out.println("Couldn't find name for "+uriString);
return null;
}
if(nameStart == 0) {
//System.out.println("Name starts at beginning");
base = "";
}
else {
//System.out.println("Uri: "+ uri + " Base: " +base);
if(prefixStart < 0) {
//System.out.println("Prefix < 0");
}
else {
}
}
return bpn;
}
}
}
}
if(currentUri == null) {
//System.out.println("Setting prefix "+prefix+": "+uri);
return true;
}
else if(currentUri == uri) {
return true;
}
else {
return false;
}
}
public Set getPrefixSet() {
return prefixToUri.keySet();
}
return uriToPrefix.keySet();
}
}
//System.out.println("Shortform for " + uri);
}
if(default_to_uri) {
return uri;
}
else {
return null;
}
}
.length() - 4);
// Check prefix for uniqueness
int mod = 0;
mod++;
}
}
return qname;
}
}
}