diff options
| author | MST 2002 John Fleck <jfleck@inkstain.net> | 2002-12-16 04:34:57 +0000 |
|---|---|---|
| committer | John Fleck <jfleck@src.gnome.org> | 2002-12-16 04:34:57 +0000 |
| commit | 44aacb34043e6f18afb45fe5d0126808aa194d9a (patch) | |
| tree | 3d9a1ffbb70c1d68c01dfe387c12be66819ab298 /doc/tutorial/ar01s07.html | |
| parent | da46d2d31e49503b087874cc987045dd09169d26 (diff) | |
| download | android_external_libxml2-44aacb34043e6f18afb45fe5d0126808aa194d9a.tar.gz android_external_libxml2-44aacb34043e6f18afb45fe5d0126808aa194d9a.tar.bz2 android_external_libxml2-44aacb34043e6f18afb45fe5d0126808aa194d9a.zip | |
doc/tutorial/xmltutorial.xml doc/tutorial/includekeyword.c
Sun Dec 15 21:27:30 MST 2002 John Fleck <jfleck@inkstain.net>
* doc/tutorial/xmltutorial.xml
* doc/tutorial/includekeyword.c
* doc/tutorial/includegetattribute.c
plus generated html and pdf
Adding fix from Niraj Tolia to tutorial to properly free memory.
Diffstat (limited to 'doc/tutorial/ar01s07.html')
| -rw-r--r-- | doc/tutorial/ar01s07.html | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/doc/tutorial/ar01s07.html b/doc/tutorial/ar01s07.html index 9335237f..fe0bd7cd 100644 --- a/doc/tutorial/ar01s07.html +++ b/doc/tutorial/ar01s07.html @@ -11,14 +11,17 @@ void getReference (xmlDocPtr doc, xmlNodePtr cur) { + xmlChar *uri; cur = cur->xmlChildrenNode; while (cur != NULL) { if ((!xmlStrcmp(cur->name, (const xmlChar *)"reference"))) { - <a name="getattributevalue"></a><img src="images/callouts/1.png" alt="1" border="0"> printf("uri: %s\n", xmlGetProp(cur, "uri")); - } + <a name="getattributevalue"></a><img src="images/callouts/1.png" alt="1" border="0"> uri = xmlGetProp(cur, "uri"); + printf("uri: %s\n", uri); + xmlFree(uri); + } cur = cur->next; } - return; + return; } </pre><p> @@ -26,10 +29,10 @@ getReference (xmlDocPtr doc, xmlNodePtr cur) { The key function is <tt><a href="http://xmlsoft.org/html/libxml-tree.html#XMLGETPROP" target="_top">xmlGetProp</a></tt>, which returns an <tt>xmlChar</tt> containing the attribute's value. In this case, we just print it out. - </p><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><table border="0" summary="Note"><tr><td rowspan="2" align="center" valign="top" width="25"><img alt="[Note]" src="images/note.png"></td><th>Note</th></tr><tr><td colspan="2" align="left" valign="top"><p> + </p><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p> If you are using a DTD that declares a fixed or default value for the attribute, this function will retrieve it. - </p></td></tr></table></div><p> + </p></div><p> </p></td></tr></table></div><p> </p></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="ar01s06.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="index.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="ar01s08.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">Writing Attribute </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> Encoding Conversion</td></tr></table></div></body></html> |
