public RelativeLocationPath insertStep(Step step, RelativeLocationPath rlp) {
        if (rlp instanceof Step) {
            return new ParentLocationPath(step, (Step) rlp);
        }
        else if (rlp instanceof ParentLocationPath) {
            final ParentLocationPath plp = (ParentLocationPath) rlp;
            final RelativeLocationPath newrlp = insertStep(step, plp.getPath());
            return new ParentLocationPath(newrlp, plp.getStep());
        }
        else {
            addError(new ErrorMsg(ErrorMsg.INTERNAL_ERR, "XPathParser.insertStep"));
            return rlp;
        }
    }