MattAPI - Tuesday, February 3, 2009 9:31 PM:
I'm having a result string parsing issue with a server method that I am writing. First, the following code works as expected:string output = "<P>Some HTML</P>";
return myInnovator.newResult(output);
The result is displayed as properly formatted HTML in a new browser window. However, I want to be able to invoke another server method from within this method and display it's result the same way. For example (from within the first method):
string output = "<P>Some HTML</P>";
Item Method2 = myInnovator.applyMethod("ServerMethod2", "<id>" + this.getProperty("id") + "</id>" );
output += myInnovator.newResult(Method2.getResult());
return myInnovator.newResult(output);
The intent is for the second method "ServerMethod2" to return another HTML string. However, in this case all of the <, >, &, etc. symbols are escaped to <, >, etc. and don't display properly in the return browser window. In the API reference it states that newResult() will escape these symbols unless the text is put "inside a 'CDATA' block". I tried enclosing the text between <![CDATA[ and ]]> before passing it to newResult() in the second method but that didn't work. Does anyone know how to properly use the CDATA block?
PLMGuy - Wednesday, February 4, 2009 7:34 PM:
Not sure about using CDATA with newResult(), but you can access the XMLDocument dom property to get the result node unescaped:
output += Method2.dom.SelectSingleNode("//Result").InnerText;
Also, you wrote:
output += myInnovator.newResult(Method2.getResult());
Did you mean?:
output += Method2.getResult();
MattAPI - Wednesday, February 4, 2009 8:38 PM:
Thanks for your help. I figured their was a way to access the text through the dom but I wasn't sure how to do it.>> Did you mean?:
>> output += Method2.getResult();
Oops. Yes, that's what I meant. It looks like I got a little trigger happy with copy->paste :)
Thanks,
Matt