Hi, David. When you iterate the DOM, you should see that your element named PMID has a child node: text. Use that text node's getNodeValue() method to obtain the text you desire.
This may look a bit harassing but is the DOM standard way to get the data. Hiran > -----Original Message----- > From: David --- [mailto:[EMAIL PROTECTED] > Sent: Monday, March 15, 2004 2:11 PM > To: [EMAIL PROTECTED] > Subject: RE: Dom parser problem with transcode > > > Thanks, > What would be then the best way to get the element > values of of the following XML document in the same > order they appear ??? For exemple to get the value > element for PMID,Year and Day ??? > > > <?xml version="1.0"?> > <!DOCTYPE PubmedArticleSet PUBLIC "-//NLM//DTD > PubMedArticle, 1st November 2003//EN" > "http://www.ncbi.nlm.nih. > gov/entrez/query/DTD/pubmed_031101.dtd"> > <PubmedArticleSet> > <PubmedArticle> > <MedlineCitation Owner="NLM" Status="Completed"> > <PMID>14979247</PMID> > <DateCreated> > <Year>2004</Year> > <Month>01</Month> > <Day>02</Day> > </DateCreated> > <DateCompleted> > <Year>2004</Year> > <Month>03</Month> > > > --- Jesse Pelton <[EMAIL PROTECTED]> a �crit : > This has > nothing to do with your current problem, > > but will save you trouble > > later: note that transcode() allocates memory, which > > you must release when > > you're done with it. > > > > > -----Original Message----- > > > From: David --- [mailto:[EMAIL PROTECTED] > > > Sent: Monday, March 15, 2004 7:00 AM > > > To: [EMAIL PROTECTED] > > > Subject: Dom parser problem with transcode > > > > > > > > > > > > Hi, > > > I'm having a problem building a Domparser. > > > The code below run properly qnd after debugging it > > > exits normally as well. > > > > > > It seems the problem comes from the transcode > > method. > > > If i remove the transcode it returns the > > corresponding > > > encoded value but like that it return nothing and > > it > > > dies after i call the transcode method. > > > > > > for( std::vector<std::string>::iterator tag = > > > tags.begin(); tag !=tags.end(); tag++) > > > { > > > char *query = strdup((*tag).c_str()); > > > XMLCh* tmpstr = XMLString::transcode(query); > > > > > > int len; > > > c_nodelist = > > c_doc->getElementsByTagName(tmpstr); > > > len = c_nodelist->getLength(); > > > std::cout << "LEN " << len << std::endl; > > > for (int i = 0 ; i < len ; i++) > > > { > > > c_node = c_nodelist->item(i); > > > const XMLCh* val = c_node->getNodeValue(); > > > char *test = XMLString::transcode(val); > > > std::cout <<"Val: " << > > > XMLString::transcode(val); > > > } > > > > > > > > > > > > } > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > Yahoo! Mail : votre e-mail personnel et gratuit > > qui vous suit > > > partout ! > > > Cr�ez votre Yahoo! Mail sur > > http://fr.benefits.yahoo.com/ > > > > > > Dialoguez en direct avec vos amis gr�ce � Yahoo! > > Messenger > > > !T�l�chargez Yahoo! Messenger sur > > http://fr.messenger.yahoo.com > > > > > > > > > --------------------------------------------------------------------- > > > To unsubscribe, e-mail: > > [EMAIL PROTECTED] > > > For additional commands, e-mail: > > [EMAIL PROTECTED] > > > > > > > > --------------------------------------------------------------------- > > To unsubscribe, e-mail: > > [EMAIL PROTECTED] > > For additional commands, e-mail: > > [EMAIL PROTECTED] > > > > > > > > > Yahoo! Mail : votre e-mail personnel et gratuit qui vous suit > partout ! > Cr�ez votre Yahoo! Mail sur http://fr.benefits.yahoo.com/ > > Dialoguez en direct avec vos amis gr�ce � Yahoo! Messenger > !T�l�chargez Yahoo! Messenger sur http://fr.messenger.yahoo.com > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
