Go to main content

xml_attr

Get attribute for current node.

XML_ATTR

NAME

xml_attr - Get attribute for current node.

SYNOPSIS

xml_attr(xml:string, [attr:string, error:variable, hash:bool]);

DESCRIPTION

This function get the attribute for current name. If paramater attibute is not specify, return all attributes.

PARAMETERS

xml
Specify xml to parse.
error
Capture error.
attr
Attribute to retreive.
hash
Return then attributes as an hash array if this parameter is true. Otherwise, it return an array.

RETURN

Return the value of an attributes of an array of all attributes or (hash is the parameter hash is true)

MODULES

To use this module, you must specify the following in /usr/local/website/site.conf:

Module xml {
        Library : "/usr/local/lib/libsnxml.so"
        Init : "snxml_init"
}

EXAMPLES

a = cur_node.xml_attr();

xml_attr(child, attr:"id");

SEE ALSO

{{ include("includes/modules.sn") }}

AUTHOR

Written by Pierre Laplante, <laplante@sednove.com>

MODIFICATIONS

1.0 2014-09-09 21:24:14 laplante@sednove.com

1.1 2015-09-15 laplante@sednove.com Add hah parameter

Edit

© 2024 extenso Inc. All rights reserved.