Path: csiph.com!usenet.pasdenom.info!dedibox.gegeweb.org!gegeweb.eu!nntpfeed.proxad.net!proxad.net!feeder1-2.proxad.net!fdn.fr!feeder.erje.net!eu.feeder.erje.net!news.swapon.de!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail From: Rainer Weikusat Newsgroups: comp.os.linux.development.apps Subject: Re: Failure to extract information using mini-XML v2.8 Date: Thu, 24 Apr 2014 19:04:41 +0100 Lines: 42 Message-ID: <87lhuu8uyu.fsf@sable.mobileactivedefense.com> References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: individual.net IrVqR6/k6QFPqZQ4B9bEvgDiNOJns8/yWlTKvGqXvKlBBl274= Cancel-Lock: sha1:loxZhTx13reMLi6O7+X1xRnh9A0= sha1:SOzXoTJ4aI3LiV23Ht9mevLaCK0= User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.2 (gnu/linux) Xref: csiph.com comp.os.linux.development.apps:716 Lew Pitcher writes: > While using miniXML v2.8 (http://www.msweet.org/projects.php?Z3) to read and > process an XML document in a small C program, I came across a problem that > I cannot surmount. [...] > For my demo, I have a dead simple XML document: > Hello, World [...] > #include > #include > > #include > > int main(void) > { > int rc = EXIT_FAILURE; > > mxml_node_t *xml, *doc; > const char *text; > > xml = mxmlLoadFile(NULL,stdin,MXML_TEXT_CALLBACK); > doc = mxmlFindElement(xml,xml,"document",NULL,NULL,MXML_DESCEND_FIRST); > text = mxmlGetText(doc,NULL); > > if (text) > { > printf("Success: \"%s\"\n",text); > rc = EXIT_SUCCESS; > } > else puts("Fail"); > > return rc; > } As determined by examining the mini-XML (2.8) code and testing, mxmlLoadFile (or, more correctly, the corresponding backend routine) will only create 'interior value nodes' when the first argument to mxmlLoadFile is not null.