display control values during xsl processing

O

olivier

How could it be possible to write debugging values to screen or file during
the processing of the form ? As my form doesn't do what I want, I'm
modifying xsl files but debugging would be easier if I was able to write
intermediate values. I tried xsl:message but it doesn't work.
Thanks
 
M

Mike Sharp

XDocument.UI.Alert("my debug message");

Actually, what I do is add a config.xml file to the infopath form that has
some basic configuration information; among other things there is a debug
flag. When I'm in debug mode, it spews the alerts, when I'm not, it's
clean. For example:

if (bDebug) XDocument.UI.Alert("url:" + strUrl + "\r\nHTTP response: " +
objXmlHttp.Status + " - " + objXmlHttp.StatusText + "\n" +
objXmlHttp.ResponseText);

My config.xml (added using the resource manager) looks like:

<config>
<!-- Lots of other config stuff here -->
<!-- [true | false] Setting Debug to true provides verbose error
messages -->
<Debug>false</Debug>
</config>

I set the bDebug flag with:

var bDebug = (GetConfigurationNode("Debug").text == "true")? true : false;

and my function to get the configuration looks like:

// Global variables
var gdomConfiguration = null; // Dom containing configuration data


/*--------------------------------------------------------------
function GetConfigurationNode

Retrieves the value of a node in the config file. If the node does not
exist, it
is created.

ARGUMENTS:
strKey The name of the node to get
RETURNS:
XmlElement node object
---------------------------------------------------------------*/
function GetConfigurationNode(strKey)
{
var objNode;

// If we haven't loaded the configuration DOM yet, do so.
if (!gdomConfiguration)
{
gdomConfiguration = new ActiveXObject("MSXML2.DomDocument.5.0");
gdomConfiguration.async = false;
gdomConfiguration.load("config.xml");
if (!gdomConfiguration.documentElement)
{
throw new Error(0, "The file config.xml does not exist in the
solution.");
}
}

// Find the node (and if found return it).
if(objNode = gdomConfiguration.documentElement.selectSingleNode(strKey))
return objNode;

// Build a node making sure we use only the last node name in the path.
strKey = strKey.replace(/.*\//g,"");
return gdomConfiguration.createElement(strKey);
}


Regards,
Mike Sharp
 
O

olivier

Thanks very much for this nice and deep answer. I'm sure that it will help
also others.

Mike Sharp said:
XDocument.UI.Alert("my debug message");

Actually, what I do is add a config.xml file to the infopath form that has
some basic configuration information; among other things there is a debug
flag. When I'm in debug mode, it spews the alerts, when I'm not, it's
clean. For example:

if (bDebug) XDocument.UI.Alert("url:" + strUrl + "\r\nHTTP response: " +
objXmlHttp.Status + " - " + objXmlHttp.StatusText + "\n" +
objXmlHttp.ResponseText);

My config.xml (added using the resource manager) looks like:

<config>
<!-- Lots of other config stuff here -->
<!-- [true | false] Setting Debug to true provides verbose error
messages -->
<Debug>false</Debug>
</config>

I set the bDebug flag with:

var bDebug = (GetConfigurationNode("Debug").text == "true")? true : false;

and my function to get the configuration looks like:

// Global variables
var gdomConfiguration = null; // Dom containing configuration data


/*--------------------------------------------------------------
function GetConfigurationNode

Retrieves the value of a node in the config file. If the node does not
exist, it
is created.

ARGUMENTS:
strKey The name of the node to get
RETURNS:
XmlElement node object
---------------------------------------------------------------*/
function GetConfigurationNode(strKey)
{
var objNode;

// If we haven't loaded the configuration DOM yet, do so.
if (!gdomConfiguration)
{
gdomConfiguration = new ActiveXObject("MSXML2.DomDocument.5.0");
gdomConfiguration.async = false;
gdomConfiguration.load("config.xml");
if (!gdomConfiguration.documentElement)
{
throw new Error(0, "The file config.xml does not exist in the
solution.");
}
}

// Find the node (and if found return it).
if(objNode = gdomConfiguration.documentElement.selectSingleNode(strKey))
return objNode;

// Build a node making sure we use only the last node name in the path.
strKey = strKey.replace(/.*\//g,"");
return gdomConfiguration.createElement(strKey);
}


Regards,
Mike Sharp

olivier said:
How could it be possible to write debugging values to screen or file during
the processing of the form ? As my form doesn't do what I want, I'm
modifying xsl files but debugging would be easier if I was able to write
intermediate values. I tried xsl:message but it doesn't work.
Thanks
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top