FWIW, This is not the right place. You should try the DOM mailing list/newsgroup.

Laurent Mimoun wrote:
nsILocalFile* xmlFile;
rv = nsComponentManager::CreateInstance(NS_LOCAL_FILE_CONTRACTID,
                                       nsnull,
                                       NS_GET_IID(nsILocalFile),
                                        (void**)&xmlFile);
rv = xmlFile->InitWithPath(xmFilePath);

(Might want to use NS_NewLocalFile, which is a bit simpler, but makes no other difference)

nsCOMPtr<nsIDOMParser> domParser;
domParser = do_CreateInstance( "@mozilla.org/xmlextras/domparser;1", &rv );
rv = domParser->ParseFromStream(fin, "UTF-8", uiContentLength,
"text/xml", xmlDOM);

What's xmlDOM? This does not look like it does what you want (I assume it's an |nsIDOMDocument** xmlDOM| variable). You want:
  nsIDOMDocument* doc;
  rv = domParser->ParseFromStream(fin, "UTF-8", uiContentLength,
                                  "text/xml", &doc;

Also note that some versions of Firefox don't support a file stream here directly (have to wrap a buffered stream around it).

char * xmlString = new char[uiContentLength];
fin->Read(xmlString, uiContentLength, &rv);

But while displaying the string, instead of <a><b>sd</b></a>
here is the string displayed : <a><b>sd</b></a>ýýýýÝÝÝÝÝÝÝÝÝÝÝÝÝÝÝÝÝÝÝÝ

Yeah. Read doesn't nullterminate (it follows fread in this respect). If you want nulltermination, have to do that yourself, and allocate another character.


-biesi
_______________________________________________
Mozilla-xpcom mailing list
[email protected]
http://mail.mozilla.org/listinfo/mozilla-xpcom

Reply via email to