Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

getElementsByTagName in PowerPrompt

Status
Not open for further replies.

Firecat1970

IS-IT--Management
May 25, 2003
68
HK
Dear,

I am trying to pass an XML string to the PowerPrompt Script.

The following works perfect, and I get a new column Blue in the report.

var xx;
xx = Server.CreateObject("Microsoft.XMLDOM");
xx.loadXML(&quot;<RR><AA>Red</AA><AA>Blue</AA></RR>&quot;);
ss = xx.getElementsByTagName(&quot;AA&quot;).item(1).text;
GetReport().AddDataItem(ss, &quot;[......]&quot;);

The following gives an Application error.
In an earlier HTML page, I have
<INPUT name=&quot;AnXMLString&quot; value=&quot;<RR><AA>Red</AA><AA>Blue</AA></RR>&quot;)> inside a form.

var s, ss;
s = App.Variables(&quot;AnXMLString&quot;);

var xx;
xx = Server.CreateObject(&quot;Microsoft.XMLDOM&quot;);
xx.loadXML(s);
ss = xx.getElementsByTagName(&quot;AA&quot;).item(1).text;
GetReport().AddDataItem(ss, &quot;[......]&quot;);

I also trying s = new String(App.Variables(&quot;AnXMLString&quot;)); and no luck.

Please help me. It will be a whole lot easier if I can pass in an XML string.
 
Good, I found a solution.

The following works.
In an earlier HTML page, I have
<INPUT name=&quot;AnXMLString&quot; value=&quot;<RR><AA>Red</AA><AA>Blue</AA></RR>&quot;)> inside a form.

In the PowerPrompt SCRIPT I have the following

var s, ss;
s = new String(App.Variables(&quot;AnXMLString&quot;));

var xx;
xx = Server.CreateObject(&quot;Microsoft.XMLDOM&quot;);
xx.loadXML(s.valueOf());
ss = xx.getElementsByTagName(&quot;AA&quot;).item(1).text;
GetReport().AddDataItem(ss, &quot;[......]&quot;);

-------------------------------------------

So the trick is the New String method, and the .valueOf

With these 2 in place, the loadXML and getElementsByTagName will work perfectly.

The ability to pass an XML string to PowerPrompt will give more possibility with ease. At least in my case, it is YES.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top