N00b question on xml and lotusscript

Hi all,

I have a basic javascript setup that posts some XML to an agent.

The agent picks up the post via the Request_Content CGI variable.

Now I just want to read the value of one of the elements from the xml that was posted.

My XML is very simple.

Blah Db Title

CA256E6R020E49FB

development\blah\BlahTestDB.nsf

Declares…

Set db = session.CurrentDatabase	

Set webdoc = session.DocumentContext



Set domParser = session.CreateDOMParser(webdoc.Request_Content(0))

domParser.Parse

Set docNode = domParser.Document

I got this far then have procceded to confuse myself on whats the easiest way to do this.

Say I just wish to get the value of replicaid,

I’m not sure if I have to loop through the elements etc etc, I would like to be able to do this using the R6 class’s instead of just a “string find”.

Cheers

Ad

Subject: n00b question on xml and lotusscript

Well you might want to use SAXParser instead considering you’re not trying to navigate the whole document but just extract a single value. SAX can be more confusing for some to deal with than DOM because we’re all used to heirarchical trees but it’s not that bad, especially for what you want to do.

If you look up the help doc and examples in the designer help for saxparser you should be able to figure out a simple way to just set up an event to listen for the tag you want and when it’s found return the next data you get. Basically the SAX_StartElement event handler is going to check to see if the Elementname is the tag you want and set a boolean to true if it is. This is going to tell your SAX_Characters event handler to go ahead and extract the Characters value. Viola! You’re done. :slight_smile: