I want to provide a subset of documents in the database as XML web page. The documents displayed on the web page should be controlled by a URL parameter. Has anybody an idea how this can be done?
Here a list of failed approaches:
- I implemented a page with an embedded view. The view renders documents in xml format. This works fine!
Problem: If I enter a formula for the ‘Show single category’ option of the view it is not executed correctly. Formula:
@UrlQueryString(“product”);
- Instead of a page I used form to embedd the xml view. In the form I also embedded a field with the formula:
@UrlQueryString(“product”);
In the ‘Show single category’ field of the embedded view I refer to this field.
Problem:
If I set the form type to html and use the URL …?OpenForm I get the error:
Documents treated as HTML cannot be edited
If I request the form with …?ReadForm the field to extract the URL parameter is not evaluated.
-
If the form type is Notes no XML is returned, because Domino renders a complete HTML page (…
-
Using a $$ViewTemplate has the same result → rendering a complete HTML page.
Happy easter
Subject: You should be able to use an agent to do this
Using print statements you could output the xml exactly as you want.
Subject: How to implement a XML web page with a subset of documents
Make the form a $$NavigatorTemplate. Create a blank navigator with the name you want to use (comment should state it’s intentionally blank), and name the Form $$NavigatorTemplate for . Your URL becomes:
http://server.domain.tld/path/db.nsf/NavNameHere?Open&Product=ProdNameHere
Subject: RE: How to implement a XML web page with a subset of documents
You don’t like ?ReadViewEntries for this?
Subject: How to implement a XML web page with a subset of documents
Hello Frank,
Here is an example of a simple agent that is called via a URL and returns an XML document. Please note that the initial print statements are key.
Hope this helps.
Avi
======================================
'call syntax …/myDB.nsf/$usercheck.xml?openagent&user=
Dim qs As String
Dim theuser As String
Dim user
Set s = New NotesSession
Set db = s.CurrentDatabase
Set doc = s.DocumentContext
qs = Lcase(doc.Query_String(0) & "&")
theuser = Strleft(Strright( qs, "&user="), "&")
user = Evaluate( |@URLDecode( "Domino" ; "| & theuser &|" )|)
Set usersView = db.GetView("($Users)")
Set docPerson = usersview.GetDocumentByKey( user(0), True )
Print {Content-type:text/xml}
Print {Mime-type:text/xml}
Print {<?xml version="1.0" encoding="utf-8" standalone="yes"?>}
Print {<xml user="} + theuser + {">}
If Not docPerson Is Nothing Then 'Username already exists
Print "<result>ERR</result>"
Else
Print "<result>OK</result>"
End If
Print {</xml>}