private void read() { this.reset(); object obj = this.rule; // xri_reference // read xri or relative_xri_ref from xri_reference IList<Rule> list_xri_reference = ((Parser.Parser.xri_reference)obj).rules; if (list_xri_reference.Count < 1) return; obj = list_xri_reference[0]; // xri or relative_xri_ref // xri or relative_xri_ref ? if (obj is Parser.Parser.xri) { this.xri = new XRI3((Parser.Parser.xri)obj); } else if (obj is Parser.Parser.relative_xri_ref) { // read relative_xri_part from relative_xri_ref IList<Rule> list_relative_xri_ref = ((Parser.Parser.relative_xri_ref)obj).rules; if (list_relative_xri_ref.Count < 1) return; obj = list_relative_xri_ref[0]; // relative_xri_part // read xri_path_abs or xri_path_noscheme or ipath_empty from relative_xri_part IList<Rule> list_relative_xri_part = ((Parser.Parser.relative_xri_part)obj).rules; if (list_relative_xri_part.Count < 1) return; obj = list_relative_xri_part[0]; // xri_path_abs or xri_path_noscheme or ipath_empty // read xri_path_abs or xri_path_noscheme or ipath_emptry ? if (obj is Parser.Parser.xri_path_abs) { this.path = new XRI3Path((Parser.Parser.xri_path_abs)obj); } else if (obj is Parser.Parser.xri_path_noscheme) { this.path = new XRI3Path((Parser.Parser.xri_path_noscheme)obj); } else if (obj is Parser.Parser.ipath_empty) { this.path = new XRI3Path((Parser.Parser.ipath_empty)obj); } else { throw new InvalidCastException(obj.GetType().Name); } // read iquery from relative_xri_ref if (list_relative_xri_ref.Count < 3) return; obj = list_relative_xri_ref[2]; // iquery this.query = new XRI3Query((Parser.Parser.iquery)obj); // read ifragment from relative_xri_ref if (list_relative_xri_ref.Count < 5) return; obj = list_relative_xri_ref[4]; // ifragment this.fragment = new XRI3Fragment((Parser.Parser.ifragment)obj); } else { throw new InvalidCastException(obj.GetType().Name); } }
private void reset() { this.xri = null; this.path = null; this.query = null; this.fragment = null; }
public bool isValidXRI() { XRI xri; try { xri = this.toXRI(); } catch (Exception) { return (false); } return (xri != null); }