Manage Learn to apply best practices and optimize your operations.

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
  document.all.item("DisplayArea").innerHTML = xmlSource.transformNode(style) ;
  }

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

showXML()

Dig Deeper on Domino Resources - Part 4

Start the conversation

Send me notifications when other members comment.

Please create a username to comment.

-ADS BY GOOGLE

SearchWindowsServer

Search400

  • iSeries tutorials

    Search400.com's tutorials provide in-depth information on the iSeries. Our iSeries tutorials address areas you need to know about...

  • V6R1 upgrade planning checklist

    When upgrading to V6R1, make sure your software will be supported, your programs will function and the correct PTFs have been ...

  • Connecting multiple iSeries systems through DDM

    Working with databases over multiple iSeries systems can be simple when remotely connecting logical partitions with distributed ...

SearchDataCenter

SearchContentManagement

Close