Search results in XML format

Search results in XML format

How nice would it be when we could obtain the results of a Domino free text search in an XML format so that we then can use xsl stylesheets to present and manipulate the results the way we like it. The problem face however is that Domino today does not allow us to use the 'treat document content as HTML' property for a $$SearchForm and thus makes it impossible for us to present the search results as clean xml-sources. This tip describes a way to use XML data islands to get around this problem (I tested with ie 5.5).


I use a view with the 'treat body as HTML' turned on to display the documents in the wanted xml format (no headers, no categorized columns). In the corresponding $$SearchForm I place the following pass-through HTML code:

<xml id="xmlSource">
<?xml version="1.0"?>
<Entries>
-- here the $$ViewBody field displaying the records in XML --
</Entries>

<div id="DisplayArea"></div>

The clue is that the xml dataisland functions as an XMLDOM object and can be adressed as such. In the JS header section of the $$SeachForm, I place some code that applies an xsl styleheet to display the XML. For example:

var style ;
function showXML() {
// create dom object to hold xsl stylesheet and load it
  style = new ActiveXObject("Microsoft.XMLDOM");
  style.async = false;
  style.load("./MyStyle.xsl");
// apply stylesheet to XML and display it in the <div> section at the end of the page

    Requires Free Membership to View

    Register today to access targeted resources from our editorial writers and independent industry experts focused on Lotus Domino, Notes, Workplace and other related technologies.

    By submitting your registration information to SearchDomino.com you agree to receive email communications from TechTarget and TechTarget partners. We encourage you to read our Privacy Policy which contains important disclosures about how we collect and use your registration and other information. If you reside outside of the United States, by submitting this registration information you consent to having your personal data transferred to and processed in the United States. Your use of SearchDomino.com is governed by our Terms of Use. You may contact us at webmaster@TechTarget.com.

document.all.item("DisplayArea").innerHTML = xmlSource.transformNode(style) ; }

Finally, in the onload event, I call the function to display the XML:

showXML()

This was first published in August 2001

Disclaimer: Our Tips Exchange is a forum for you to share technical advice and expertise with your peers and to learn from other enterprise IT professionals. TechTarget provides the infrastructure to facilitate this sharing of information. However, we cannot guarantee the accuracy or validity of the material submitted. You agree that your use of the Ask The Expert services and your reliance on any questions, answers, information or other materials received through this Web site is at your own risk.