* @return an ElementPointerPart representing the parsed schemaData.
* @throws IllegalArgumentException if the schemeData has invalid scheme syntax.
*/
public static ElementPointerPart parseFromString(final String schemeData) throws InvalidXPointerException {
List childSequence = null;
NCName elementID = null;
int startChar;
int endChar;
//Find an NCName if it exists?
startChar = schemeData.indexOf("/");
// -1 Only an NCName. 0 No NCName. > 1 An NCName.
switch (startChar) {
case -1: //Only an NCName.
try {
elementID = new NCName(schemeData);
}
catch (IllegalArgumentException e) {
throw new InvalidXPointerException("Invalid NCName in the XPointer", schemeData);
}
return new ElementPointerPart(elementID);
case 0: //No NCName.
break;
default: //An NCName.
try {
elementID = new NCName(schemeData.substring(0, startChar));
} catch (IllegalArgumentException e) {
throw new InvalidXPointerException("Invalid NCName in the XPointer", schemeData, 0, startChar);
}
break;
}