Hello,
How about an simple example using Xpath to do thing LIKE this.
<example>
xmlDocPtr doc = xmlParseFile(docname);
title = getKeyword(doc, "/mail/title");
setKeyword(doc, "/mail/title", "Simple xml example");
xmlSaveFormatFile (docname, doc, 1);
</example>
And same function for setAttribut, getAttribut.
François
<mail>
<from>Francois Chenais citb bull net</from>
<subject>libxml tutorial</subject>
<body>
bla bla bla
</body>
</mail>
On 02 Jun 2002 21:06:12 -0600
John Fleck <jfleck inkstain net> wrote:
| Folks -
|
| I've finished a big chunk of a draft of the libxml tutorial and would
| like feedback.
|
| It includes examples and explanations on:
|
| 1) parsing a doc
| 2) extracting text from an element
| 3) adding an element
| 4) extracting text from an attribute (well, it *will* have this, but
| doesn't yet)
| 5) adding an attribute.
|
| Remember that I am a writer, not a hacker, readers will be well served
| if others look over my examples and suggest improvements.
|
| Once this is done, I'm looking for suggestions for other fundamental
| tasks, that I might add future chapters. DTD handling is the next thing
| on my list, but I'm open to other ideas.
|
| I've put it up here for now:
| http://www.inkstain.net/fleck/libxmltutorial/index.html
|
| Cheers,
| John
| --
| John Fleck
| jfleck inkstain net (h) jfleck abqjournal com (w)
| http://www.inkstain.net http://www.abqjournal.com
|
| "You don't want to die with the music still in you."
| - John Gardner
|
| _______________________________________________
| xml mailing list, project page http://xmlsoft.org/
| xml gnome org
| http://mail.gnome.org/mailman/listinfo/xml
|
Attachment:
pgpE1anSlVozj.pgp
Description: PGP signature