ozzieisaacs Posted April 16, 2010 Share Posted April 16, 2010 Hi All,I have a requirement to embed a static image from Google maps (now legally allowed under the changed licence). This would come from a url composed by my application.However I am having difficulty with the parser dismissing the url string as being in error.....surely it shouldn'r parse the url string at all?What am I missing here?as far as I can currently tell the xml should be something like:<image scaleImage="Clip" isLazy="true" onErrorType="Icon" evaluationTime="Report"> <reportElement x="53" y="43" width="458" height="157"/> <imageExpression class="java.lang.String"><![CDATA["http://maps.google.co.uk/maps?f=q&source=embed&hl=en&geocode=&q=ng23&sll=53.370221,-2.548828&sspn=10.315411,15.622559&ie=UTF8&hq=&hnear=Newark,+Nottinghamshire+NG23,+United+Kingdom&ll=53.107975,-0.801738&spn=0.040499,0.061026&t=h&z=14"]></imageExpression></image> Which should (according to the static maps instructions, give me an image......Anyone got any comments or hints? Ozzie. Link to comment Share on other sites More sharing options...
thangalin Posted April 16, 2010 Share Posted April 16, 2010 Try changing the expression class to URL: <imageExpression class="java.lang.String"> to <imageExpression class="java.net.URL"> See if that helps. Link to comment Share on other sites More sharing options...
ozzieisaacs Posted April 16, 2010 Author Share Posted April 16, 2010 Curiouser and curiouser.....Well, when I do that I get THIS very dense error : Error loading the report template: org.xml.sax.SAXParseException: cvc-enumeration-valid: Value 'java.net.url' is not facet-valid with respect to enumeration '[java.lang.String, java.io.File, java.net.URL, java.io.InputStream, java.awt.Image, net.sf.jasperreports.engine.JRRenderable]'. It must be a value from the enumeration. Which doesn't mean much to me...... any one any clues? Link to comment Share on other sites More sharing options...
mdahlman Posted April 16, 2010 Share Posted April 16, 2010 I think it means you wrote "java.net.url" instead of "java.net.URL".Regards,Matt Link to comment Share on other sites More sharing options...
ozzieisaacs Posted April 18, 2010 Author Share Posted April 18, 2010 Hmm <pink cheeks> so it does.....but I still seem to be evaluating the URL and the parser suggests a missing "(" ....Which is odd Clearly I'm missing something here :( Link to comment Share on other sites More sharing options...
ozzieisaacs Posted April 19, 2010 Author Share Posted April 19, 2010 OK Problem solved, after a little head scratching : it should indeed have been a String but I'd made a number of minor errors including some within the string itself. Going back to the google static maps API resulted in some minor tweaks and so on.....Here is the (tested) XML using their "Brooklyn Bridge" example.Code below is functional but currently completely static. Clearly for a working report you would need to evaluate a suitable string expression, however that is a trivial excercise ..... <image scaleImage="RealSize" hAlign="Center" isUsingCache="false" isLazy="true" onErrorType="Icon" evaluationTime="Report"> <reportElement x="30" y="53" width="370" height="264"/> <imageExpression class="java.lang.String"><![CDATA["http://maps.google.com/maps/api/staticmap?center=Brooklyn+Bridge,New+York,NY&zoom=14&size=512x512&maptype=roadmap&markers=color:blue|label:S|40.702147,-74.015794&markers=color:green|label:G|40.711614,-74.012318&markers=color:red|color:red|label:C|40.718217,-73.998284&sensor=false"]]></imageExpression> </image> Post Edited by ozzieisaacs at 04/19/2010 08:36 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now