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

Jorge Cabello jorge at aspl.es
Thu Jun 12 09:11:16 CEST 2008


You can use the provided function 'axl_cmp' to compare the two strings.
In C two strings can't be compare directly. Instead:

        if (axl_cmp(value,"Hello")) {
             printf("True \n");
        }

More info about helpfull string functions provided inside Axl can be
found at:
http://www.aspl.es/axl/html/group__axl__string__module.html




El mié, 11-06-2008 a las 18:39 +0000, Steve Starr escribió:
> 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 :)
> _______________________________________________
> Axl mailing list
> Axl at lists.aspl.es
> http://lists.aspl.es/cgi-bin/mailman/listinfo/axl




More information about the Axl mailing list