[erlang-question] Number value via XPath

Maxim Treskin <>
Wed Jun 17 12:26:51 CEST 2009


Hello

How I can get number value of XML node? For example, my node:

<profile>
 <id>1</id>
 <name>Some profile name</name>
 <config></config>
</profile>

I don't know how retrieve id as number. The most I can is to do something
like this:

xmerl_xpath:string("string(/profile/id/text())", P)

which returns {xmlObj,string,"1"} and convert value of this record to
integer with list_to_integer/1

Is there any right way to get {xmlObject, number, 1} from this node?

Thank you

-- 
Maxim Treskin


More information about the erlang-questions mailing list