[Axl] Compare the value of a node or node contents with a known value.

Steve Starr steven.l.starr at gmail.com
Fri Jun 13 04:23:38 CEST 2008


Thanks to all who posted i later on realized my error i guess i was trying
to code
lua in a c program.

As for anyone else who finds them selfs asking this same question you can do
this two ways.

1. if (axl_cmp(value, "Hello")) {
        prinf("True \n");
    }


2. cmp = "Hello";
    if(strcmp(val,cmp) == 0) {
        printf("True \n\n");
    }
    else {
        printf("False \n\n");
    }


On Wed, Jun 11, 2008 at 6:39 PM, Steve Starr <steven.l.starr at gmail.com>
wrote:

> I was wondering how do you compare the value of a node or node contents
> with a known value.
>
> Xml Doc
> -------------------------------------------------------------
> <?xml version="1.0" encoding="ISO-8859-1"?>
>
> <root>
>     <child1>Hello</child1>
>     <child2>World</child2>
> </root>
>
>
> Code Snippet
> -------------------------------------------------------------
> // get the first child node and its contents
> node = axl_node_get_first_child (node);
> value = axl_node_get_content_trim (node, NULL);
> printf("Useing the axl_node_get_first_child function. \n");
> printf("%s \n\n", value);
>
> /* Does value == Hello? */
> if (value == "Hello") {
>     printf("True \n");
> }
> else {
>     printf("False \n");
> }
>
>
> Terminal Output
> -------------------------------------------------------------
> Useing the axl_node_get_first_child function.
> Hello
>
> False
>
>
> The result always seems to be false.
>
> Thanks Steven :)
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.aspl.es/pipermail/axl/attachments/20080613/895f524f/attachment.htm 


More information about the Axl mailing list