Showing posts with label xml. Show all posts
Showing posts with label xml. Show all posts

Wednesday, April 1, 2009

Question: Can XPages only be used for HTML?

The reason I'm asking is that the html/js/css code generated by your average XPage is too bloated for my taste.



I love the server side scripting/speed/pseudo-relational lookups part of the technology though.

My question: Is it possible to use XPages to generate other content than HTML, like (valid) XML and JSON, and how?

I've tried my friend Google, but he found nothing for me.

Thursday, July 19, 2007

Simple LotusScript-library to fetch html/transform xml

I rewrote some of the code so that there only will be created one object per task. In my first version, I created an object per URL-call. In this version, only one object is created per task.

Text-file with code
Put code under '(declarations) in the file, into the declarations part of the scriptlib, and 'Terminate into the terminate part. The functions place themselves when you paste them.

'(declarations)
Dim httpobj As Variant
Dim source As Variant, style As Variant

'Terminate
Set httpobj = Nothing
Set source = Nothing
Set style = Nothing


If you want to get several XML-/XSL-files from the same source, you only need to login once per agent. If you're going to use the same XSL template for each xml-source, you only need to load this the first time.

'..
login = "https://server.com/names.nsf?login&"+_
"username=foo&password=bar"

xmlurl = "https://server.com/db.nsf/first.xml"
xslurl = "https://server.com/db.nsf/first.xsl"

'first call
Print transformXML( login, xmlurl, xslurl )
'..
'second call, same xsl-template
xmlurl = "https://server.com/db.nsf/second.xml"
Print transformXML( "", xmlurl, "" )
'..
'third call, different xsl-template
xmlurl = "https://server.com/db.nsf/view?ReadViewEntries"
xslurl = "https://server.com/db.nsf/view.xsl"
Print transformXML( "", xmlurl, xslurl )
'..