aString.Truncate();
aString.Truncate(origLen);
nsresult ConsumeQuotedString(PRUnichar aChar,                             nsString& aString,                             PRInt32& aNewlineCount,                             nsScanner& aScanner,                             PRInt32 aFlag){  NS_ASSERTION(aChar==kQuote || aChar==kApostrophe,"char is neither quote nor apostrophe");  static const PRUnichar theTerminalCharsQuote[] = {     PRUnichar(kQuote), PRUnichar('&'), PRUnichar(kCR),    PRUnichar(kNewLine), PRUnichar(0) };  static const PRUnichar theTerminalCharsApostrophe[] = {     PRUnichar(kApostrophe), PRUnichar('&'), PRUnichar(kCR),    PRUnichar(kNewLine), PRUnichar(0) };  static const nsReadEndCondition    theTerminateConditionQuote(theTerminalCharsQuote);  static const nsReadEndCondition    theTerminateConditionApostrophe(theTerminalCharsApostrophe);  // Assume Quote to init to something  const nsReadEndCondition *terminateCondition = &theTerminateConditionQuote;  if (aChar==kApostrophe)    terminateCondition = &theTerminateConditionApostrophe;    nsresult result=NS_OK;  nsScannerIterator theOffset;  aScanner.CurrentPosition(theOffset);  result=ConsumeAttributeValueText(aString,aNewlineCount,aScanner,                                   *terminateCondition,PR_TRUE,aFlag);  if(NS_SUCCEEDED(result)) {    result = aScanner.SkipOver(aChar); // aChar should be " or '  }  // Ref: Bug 35806  // A back up measure when disaster strikes...  // Ex <table> <tr d="><td>hello</td></tr></table>  if(!aString.IsEmpty() && aString.Last()!=aChar &&     !aScanner.IsIncremental() && result==kEOF) {    static const nsReadEndCondition      theAttributeTerminator(kAttributeTerminalChars);    aString.Truncate();    aScanner.SetPosition(theOffset, PR_FALSE, PR_TRUE);    result=ConsumeAttributeValueText(aString,aNewlineCount,aScanner,                                     theAttributeTerminator,PR_FALSE,aFlag);  }  return result;}