Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Parsed XPATH value as variable of user function #1

Open
seirerman opened this issue Dec 18, 2017 · 0 comments
Open

Parsed XPATH value as variable of user function #1

seirerman opened this issue Dec 18, 2017 · 0 comments

Comments

@seirerman
Copy link

Not sure if this is a bug, works-as-designed:

I'm trying to parse an xml file which includes, among other things, a string containing a ISO 8601 datetime string ("2017-12-07T07:30:00+01:00").

I can parse that with cobj_xpath just fine. But since this isn't the format I want on the website, I need to transform it into epoch format so that stdWrap can use strftime.

So I wrote a small user function that does exactly that.
But attaching the XPATH object as a variable to the user function returns only "0".
It works if I send a static date string to the user function.

I did some var_dumping in the user function ("var_dump($conf);") and saw that $conf had all the config of the xpath object, but not the parsed string.

lib.xpath {
	source = https://lawine.tirol.gv.at/rest/bulletin/latest/xml/de
	return = string
	expression = caaml:metaDataProperty//caaml:MetaData//caaml:dateTimeReport
	resultObj {
		cObjNum = 1
		1.current = 1
	}
}

lib.datetime= USER
lib.datetime{
	userFunc = user_functions->iso8601toUnixTimestamp
# Static value works
#	iso8601 = 2017-12-07T07:30:00+01:00
# XPATH doesn't work
	iso8601 < lib.xpath 
}

Any idea if this is possible, or what's wrong with my code?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant