Article ID: 194899
Article Last Modified on 6/14/2006
<SPAN>X+Y<Z.A+B>C.</SPAN>This will incorrectly result in "X + Y C."
boolean noTranslation() {
String content="<B>&>";
DhText text=new DhText(content);
text.setVisible(false);
add(text);
com.ms.wfc.html.om.IHTMLElement peer;
peer=(com.ms.wfc.html.om.IHTMLElement)text.getPeer();
String inner=peer.getInnerHTML();
remove(text);
return content.equals(inner);
}
import com.ms.wfc.html.*;
import com.ms.wfc.core.*;
import com.ms.wfc.ui.*;
public class Class1 extends DhDocument
{
public Class1()
{
initForm();
}
private void initForm()
{
}
protected void onDocumentLoad(Object sender, Event e)
{
DhText text=new DhText();
String message="<B>BOLD</B><HR><U>UNDERLINE</U>&<TAG&>";
// Workaround: Uncomment the next two lines for one possible
// workaround.
// if (noTranslation())
// message=toHTMLViewable(message);
text.setText(message);
add(text);
}
boolean noTranslation() {
String content="<B>&<";
DhText text=new DhText(content);
text.setVisible(false);
add(text);
com.ms.wfc.html.om.IHTMLElement peer;
peer=(com.ms.wfc.html.om.IHTMLElement)text.getPeer();
String inner=peer.getInnerHTML();
remove(text);
return content.equals(inner);
}
static String toHTMLViewable(String text) {
// indexOf() returns -1 if not found:
if (text.indexOf('<')+text.indexOf('>')+text.indexOf('&')==-3)
return text;
StringBuffer buffer=new StringBuffer(text);
int index=0;
String amp="amp;";
String less="<";
String greater=">";
while (buffer.length()>index) {
if (buffer.charAt(index)=='&') {
buffer.insert(index+1,amp);
} else if (buffer.charAt(index)=='<') {
buffer.setCharAt(index,'&');
buffer.insert(index+1,less);
} else if (buffer.charAt(index)=='>') {
buffer.setCharAt(index,'&');
buffer.insert(index+1,greater);
}
index++;
}
return buffer.toString();
}
}
<HTML>
<BODY>
<hr>
<OBJECT classid="java:com.ms.wfc.html.DhModule"
height=0 width=0 ... VIEWASTEXT>
<PARAM NAME=__CODECLASS VALUE=Class1>
<PARAM NAME=CABBASE VALUE=Project1.CAB>
</OBJECT>
<!-- Insert HTML here -->
</BODY>
</HTML>
Bold text saying "BOLD"
A horizontal line
Underlined text saying "UNDERLINE"
Text saying "<TAG>"
Text saying "BOLD<HR><U>UNDERLINE</U><TAG>"
Keywords: kbbug kbjava kbcmnctrls kbpending kbwfc KB194899