For some reason, I am always getting an odd result from my select()
calls to the jSoup object.
Here is my code (I am trying to get simple title and meta tag values and insert them into my object called 'request'):
<cfset jsoupObject = createObject("component","lib.javaloader.JavaLoader").init([ expandPath('/lib/jsoup-1.7.2.jar') ]) />
<cfset jsoupCreate = jsoupObject.create("org.jsoup.Jsoup") />
<cfset parsed = jsoupCreate.parse(document.filecontent) />
<cfset variables.request = {} />
<cfset variables.request.title = parsed.select("title").first() />
<cfset variables.request.description = parsed.select("meta[name=description]").first() />
Because I have this in a CFC, I am using a Java Loader, which works fine. document.filecontent
is a block of HTML code, which works fine.
When I output my request object I get the following results:
What could be going wrong here?
You can ignore the other keys in the request object, the only ones to note here are description and title, which both give me weird results!
I am loading my HTML via CFHTTP
in some code prior to this (all works fine).
I'd really appreciate your help.
Many thanks,
Michael.
UPDATE:
Dumping 'parsed' I get the following:
Dumping parsed.select("title")
I get: