Jean Georges PERRIN <[EMAIL PROTECTED]> asks > > I'd like to create a DOM tree from scratch. I have written those lines of > code (init is called by the constructor). but it hanges (see below). > > ------------------ >
> > int PictureStore::addPicture (char *strId, char *strFile) { > int status = 0; > > DOM_Node dnPictureRoot; > DOM_Document ddPictureDocument; > DOM_Element dePictureElement; > DOM_Element deFileElement; > > lDebug::printf(D_PICTURESTORE_ADDPICTURE, "***** -> > PictureStore::addPicture()\n"); > > // Get the working document > ddPictureDocument = m_dpPicture.getDocument(); > > // Creating new PICTURE > lDebug::printf(D_PICTURESTORE_ADDPICTURE, "**** Creating new element > PICTURE\n"); > dePictureElement = ddPictureDocument.createElement("PICTURE"); > dePictureElement.setAttribute("Id", strId); > > lDebug::printf(D_PICTURESTORE_ADDPICTURE, "**** Creating new element > FILE\n"); > deFileElement = ddPictureDocument.createElement("FILE"); > deFileElement.setNodeValue(strFile); > > lDebug::printf(D_PICTURESTORE_ADDPICTURE, "**** Appending FILE to [Additional code deleted] > > It hangs on : > deFileElement.setNodeValue(strFile); > dnPictureRoot.appendChild(dePictureElement); > The problem is that the text content of an element is not stored in the NodeValue of the element, but in child nodes of type Text or CDataSection. So the code will look something like DOM_Text textNode = ddPictureDocument.createTextNode(DOMString(strFile)); deFileElement.appendChild(textNode); -- Andy