[xml] changing the contents of a node



hi,

I am trying to do the following processing :
<main>
  <i18n>
     unlocalized-text
  </i18n>
</main>
should change to
<main>
  localized text
</main>

To achive this I walk down the doc-tree. Whenever I find a text-node (cur) I get the parent (i18n) and the 
grandparent (main).
Now it tried dozen ways to add a text-child to main. Can someone point me on the proper way to do it

1.
xmlUnlinkNode(cur);xmlFreeNode(cur);
xmlUnlinkNode(i18n);xmlFreeNode(i18n);
if(post_i18n) {
  xmlAddChild(main,xmlNewText(post_i18n));
}


2.
xmlUnlinkNode(cur);xmlFreeNode(cur);
if(post_i18n) {
  i18n->type=XML_TEXT_NODE;
  xmlNodeSetContent(i18n,post_i18n);
}

Stefan
--
      \|/
     <@ @> Stefan Kost  private                   business
+-oOO-(_)-OOo------------------------------------------------------------- - - -  -   -
|        __    Address  Zwenkauer Str. 24         HTWK Leipzig, Fb IMN, Postfach 300066
|       ///             04277 Leipzig             04277 Leipzig
|  __  ///              Germany                   Germany
|  \\\///      Phone    +49341 3910483            +49341 3076101
|   \__/       EMail    st_kost gmx net           kost imn htwk-leipzig de
|              WWW      http://www.sonicpulse.de  http://www.imn.htwk-leipzig.de/~kost/about.html
===-=-=--=---=---------------------------------- - - -  -    -




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]