public XRI3Reference(XRIReference xriReference, string xriPart) { StringBuilder buffer = new StringBuilder(); buffer.Append(xriReference.ToString()); buffer.Append(xriPart); this.rule = XRI3Util.getParser().parse("xri-reference", buffer.ToString()); this.read(); }
bool doScan(ParseStream oStream) { if (oStream.empty()) { return false; } if (oStream.getData()[0] != '(') { return false; } ParseStream oTempStream = oStream.begin(); oTempStream.consume(1); String sIRI = null; // make sure we have a valid XRI reference XRIReference oRef = scanXRIReference(oTempStream); if (oRef == null || oTempStream.empty() || (oTempStream.getData()[0] != ')')) { // if we got a reference, but the resulting temp stream is empty or does not begin with ')' // it got parsed wrongly (happens if the XRef is an IRI). Retry parsing with an IRI if (oRef != null) { oTempStream = oStream.begin(); oTempStream.consume(1); } // if there is no XRI Reference, see if it is an IRI sIRI = scanIRI(oTempStream); if (sIRI == null) { return false; } } // make sure we have the trailing ')' if (oTempStream.empty() || (oTempStream.getData()[0] != ')')) { return false; } // at this point, complete consumption and return true oTempStream.consume(1); oStream.end(oTempStream); moXRIRef = oRef; msIRI = sIRI; return true; }