No, your question is a common one. Many people are having problems with
this and we had hoped to provide a sample for this in the 3.0.1 (1.0.1
Xerces-C) drop, but other things ended up pushing this off the radar
screen. I will try to get Andy H to respond to this since he's the
DOMMeister, and I personally don't know the answer either. Just as a wild
guess though, does 'setValue' have any real meaning for an element node?
Shouldn't you really be creating a text node and inserting that as a child
of the element node?

----------------------------------------
Dean Roddey
Software Weenie
IBM Center for Java Technology - Silicon Valley
[EMAIL PROTECTED]



"Jean Georges PERRIN" <[EMAIL PROTECTED]> on 01/07/2000 05:18:43 AM

Please respond to [EMAIL PROTECTED]

To:   "Xerces" <[EMAIL PROTECTED]>
cc:
Subject:  [C++] Starting a DOM tree from scratch...



[C++|Xerces 1.0.1|Win32]

Hi,

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).

I hope I am not annoying with my questions as I am a real beginner in DOM /
Xerces... If there is anoth mailing list, more appropriate to such
questions, please tell me about it.

------------------

int PictureStore::init (void) {
  int       status = 0;

  m_dpPicture.startDocument();

  return status;
}

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
PICTURE\n");
  dePictureElement.appendChild(deFileElement);

  // Saving new PICTURE & Childs
  lDebug::printf(D_PICTURESTORE_ADDPICTURE, "****  Saving new PICTURE &
Childs\n");
  dnPictureRoot = ddPictureDocument.getDocumentElement();
  dnPictureRoot.appendChild(dePictureElement);

  // Debugging XML Tree
  lDebug::printf(D_PICTURESTORE_ADDPICTURE, "****  Debugging XML Tree\n");
  debug ();

  lDebug::printf(D_PICTURESTORE_ADDPICTURE, "***** ->
PictureStore::addPicture()\n");

  return status;
}

It hangs on :
deFileElement.setNodeValue(strFile);
dnPictureRoot.appendChild(dePictureElement);

TIA

Jean Georges PERRIN
--
Four J's Development Tools (www.4js.com)
[EMAIL PROTECTED] - Tel +33 (0)3 88 18 61 20 - Fax +33 (0)3 88 18 61 21
--
CAUTION: import com.fourjs.StandardDisclaimer;




Reply via email to