container->SetDocument(myDoc, PR_FALSE);
container->SetDocument(myDoc, PR_FALSE, PR_TRUE);
int main(int argc, char** argv){  /* Create Byte2Unicode converter? Not anymore. The converters are not tested  here, they have their own test code. And if you just want to use them, you   need a properly intialized xpcom system. This simple test program doesn't do  that. */  // Create a unicode string  static const char* srcStr = "This is some meaningless text about nothing at all";  nsresult rv;  PRUint32 origSrcLen = nsCRT::strlen((char *)srcStr);  const int BUFFER_LENGTH = 100;  PRUnichar destStr[BUFFER_LENGTH];  PRUint32 srcLen = origSrcLen;  PRUint32 destLen = BUFFER_LENGTH;  // hacky Ascii conversion to unicode, because we don't have a real Converter.  for (PRUint32 i=0; i<srcLen; i++) destStr[i] = ((PRUint8)srcStr[i]);  // Create test document.  MyDocument *myDoc = new MyDocument();  if (myDoc) {    testStrings(myDoc);  } else {    printf("Out of memory trying to create document\n");    return -1;  }  // Create a new text content object.  nsIContent *text;  rv = NS_NewTextNode(&text);  if (NS_OK != rv) {    printf("Could not create text content.\n");    return -1;  }  nsIDOMText* txt = nsnull;  static NS_DEFINE_IID(kIDOMTextIID, NS_IDOMTEXT_IID);  text->QueryInterface(kIDOMTextIID, (void**) &txt);  nsAutoString tmp(destStr);  txt->AppendData(tmp);  NS_RELEASE(txt);  PRBool canHaveKids;  text->CanContainChildren(canHaveKids);  NS_ASSERTION(!canHaveKids,"");  text->SetDocument(myDoc, PR_FALSE);#if 0  // Query ITextContent interface  static NS_DEFINE_IID(kITextContentIID, NS_ITEXTCONTENT_IID);  nsITextContent* textContent;  rv = text->QueryInterface(kITextContentIID,(void **)&textContent);  if (NS_OK != rv) {    printf("Created text content does not have the ITextContent interface.\n");    return -1;  }  // Print the contents.  nsAutoString stringBuf;  textContent->GetText(stringBuf,0,textContent->GetLength());  if (!stringBuf.Equals(nsString(destStr,destLen))) {    printf("something wrong with the text in a text content\n");  }#endif  // Create a simple container.  nsIHTMLContent* container;  nsIAtom* li = NS_NewAtom("li");  nsCOMPtr<nsINodeInfoManager> nimgr;  nsCOMPtr<nsINodeInfo> ni;  myDoc->GetNodeInfoManager(*getter_AddRefs(nimgr));  nimgr->GetNodeInfo(li, nsnull, kNameSpaceID_None, *getter_AddRefs(ni));  rv = NS_NewHTMLLIElement(&container,ni);  if (NS_OK != rv) {    printf("Could not create container.\n");    return -1;  }  container->CanContainChildren(canHaveKids);  NS_ASSERTION(canHaveKids,"");  container->SetDocument(myDoc, PR_FALSE);  container->AppendChildTo(text, PR_FALSE);  PRInt32 nk;  container->ChildCount(nk);  if (nk != 1) {    printf("Container has wrong number of children.");  }  printf("begin attribute tests\n");  testAttributes(container);  printf("attribute tests complete\n");  // Clean up memory.  text->Release(); // The textContent interface.  delete container;  delete text;  myDoc->Release();  return 0;}