[opencms-dev] Need Help in writing Java Applet WYSIWYG editor

Anil Patel toanilpatel at hotmail.com
Fri Jan 24 07:55:39 CET 2003


Alexander Lucas/ OpenCMS core Team,

I am working on Providing Java Applet WYSIWYG editor. In the Process I 
encountered problem in Usage of String.indexOf and lastIndexof method.
I am referring to

OpenCMS version: 5 RC1
Class: com.opencms.template.CmsXmlTemplateFile
Method: setEditedTemplateContent

In the following Block of Code

int startIndex = content.indexOf("<BODY");
      startIndex = content.indexOf(">", startIndex + 1) + 1;
int endIndex = content.lastIndexOf("</BODY>");

If the "Body" tag in Content does not match case to case, return index value 
is -1

I tried to fix, with following changes.

int startIndex = content.toUpperCase().indexOf("<BODY");
startIndex = content.indexOf(">", startIndex + 1) + 1;
int endIndex = content.toUpperCase().lastIndexOf("</BODY>");

To me this looks to be the fix.

Do you think What I am doing is Right, Or there is some other reason for the 
way it is in original code.

Please Do respond to this mail, My work on Editor depends of this code.

Hope to Get Mail from you ASAP.

Regards
Anil K Patel
Aditisoft Inc
www.aditisoft.com











>From: "Anil Patel" <toanilpatel at hotmail.com>
>Reply-To: opencms-dev at www.opencms.org
>To: opencms-dev at www.opencms.org
>Subject: Re: [opencms-dev] Need Help in writing Java Applet WYSIWYG editor
>Date: Thu, 23 Jan 2003 00:09:15 -0500
>
>Never mind,
>I just saw CmsXmlTemplateEditor class, it looks like I can move forward..
>
>Regards
>Anil K Patel
>Aditisoft Inc
>www.aditisoft.com
>
>
>
>
>
>
>
>>From: "Anil Patel" <toanilpatel at hotmail.com>
>>Reply-To: opencms-dev at www.opencms.org
>>To: opencms-dev at www.opencms.org
>>Subject: [opencms-dev] Need Help in writing Java Applet WYSIWYG editor
>>Date: Wed, 22 Jan 2003 21:26:28 -0500
>>
>>I am working on Java Applet WYSIWYG. I am using JTextPane along with 
>>HTMLToolKit as editor.
>>It is Good for Plain HTML.
>>In context of OpenCMS a Page type resource has, OpenCMS specific XML tags.
>>It will be lot of help If some the auther of existing WYSIWYG can give me 
>>hints on Handling these XML tags.
>>Like how does it manage to turn XML tag based tamplate into HTML for 
>>editor and then turn it back into XML tags while saving them back.
>>
>>All your help will help me in Getting this Editor rolled out fast.
>>
>>Regards
>>
>>Anil K Patel
>>Aditisoft Inc
>>www.aditisoft.com
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>_________________________________________________________________
>
>
>_________________________________________________________________
>MSN 8 helps eliminate e-mail viruses. Get 2 months FREE*.  
>http://join.msn.com/?page=features/virus


_________________________________________________________________
Protect your PC - get McAfee.com VirusScan Online  
http://clinic.mcafee.com/clinic/ibuy/campaign.asp?cid=3963




More information about the opencms-dev mailing list