Error in my CODE- replace data in html tags in APPLET

MY REQUIREMENT:
I'm trying to send html format of output to an excel file....As you can see my data in the td tag had data as: 
BRANCHOFFICE<125 & BRANCHOFFICE>176 where < is interpreted as an html tag....So I want to replace
< -> <
< -> >
& -> &
<HTML>
<table border="1">
<tr>
<td>BRANCHOFFICE<125 & BRANCHOFFICE>176</td>
</tr>
</table>
</HTML>
MY ERROR IN CODE:
So I'm testing my replace method in a small snippet.........
So the steps my code works is:
1)BRANCHOFFICE<125 & BRANCHOFFICE>176 gets converted to
BRANCHOFFICE<125 & BRANCHOFFICE>176
2)BRANCHOFFICE<125 & BRANCHOFFICE>176 gets converted to
BRANCHOFFICE<125 & BRANCHOFFICE>176
3)when it comes to the third & conversion it goes to a infinte loop....
CAN U PLS HELP ME TO SOLVE THIS BUG........
import java.applet.Applet;
import java.io.*;
public class escape
public static void main(String arg[])
String s1 = "BRANCHOFFICE<125 & BRANCHOFFICE>176";
System.out.println("s1 = " + escape(s1));
private static String escape(String s)
while( true )
int index = s.indexOf('<');
if ( index != -1 )
String before = s.substring( 0, index );
String after = s.substring( index+1, s.length() );
s = before + "<" + after;
continue;
index = s.indexOf('>');
if ( index != -1 )
String before = s.substring( 0, index );
String after = s.substring( index+1, s.length() );
s = before + ">" + after;
continue;
index = s.indexOf('&');
if ( index != -1 )
String before = s.substring( 0, index );
String after = s.substring( index+1, s.length() );
s = before + "&" + after;
continue;
break;
return s;
}

Jdk 1.4:import java.applet.Applet;
import java.io.*;
public class escape
     public static void main(String arg[])
          String s1 = "BRANCHOFFICE<125 & BRANCHOFFICE>176";
          System.out.println("s1 = " + escape(s1));
     private static String escape(String s)
          s = s.replaceAll ("&", "&");
          s = s.replaceAll ("<", "<");
          s = s.replaceAll (">", ">");
          return s;
}<= Jdk 1.3:import java.applet.Applet;
import java.io.*;
public class escape
     public static void main(String arg[])
          String s1 = "BRANCHOFFICE<125 & BRANCHOFFICE>176";
          System.out.println("s1 = " + escape(s1));
     private static String escape(String s)
          s = replace (s, "&", "&");
          s = replace (s, "<", "<");
          s = replace (s, ">", ">");
          return s;
     private static String replace(String original, String find, String replacement) {
          int i=0;
          if ((i=original.indexOf(find)) > -1) return original.substring(0, i) + replacement
               + replace(original.substring(i+find.length()), find, replacement);
          else return original;
}

Similar Messages

  • Pulling Data Containing HTML TAGS

    We have a DB application that allows users to freely enter data. Our problem is that if a users enters HTML tags as their data and submits it to our DB, we are able to encode the response and store the data in it's original context (a requirement).
    Now, here is the problem. When the data is pulled out from the DB and displayed on the HTML page, if the user had submitted HTML tags, our page doesn't display the HTML tags but rather their browser interprets the tag.
    We do not want the browser to interpret the tag, just want the actual characters displayed.
    so if a user enteres <B> HELLO WORLD</B>
    we want the less than and greater than signs to be displayed..not the phrase HELLO WORLD to be displayed in bold.
    Any help is appreicated.

    Darn,
    When you pull the string from the DB, you would be able to pass it through a simple 'filter' method that converts important HTML characters to the display element equivelents.
    For example, you would want to change all < tags to &lt; all & to &amp; and quotes to &quot; This might just about do everything you would need.
    It might be as easy as doing a few
    dbString = dbString.replaceAll("<", "&lt;");
    etc...

  • Replace function for HTML tags

    Hie Guys,
    I would like to get rid of the HTML tags from a column/object in my report using the "Replace" function. Basically, I want to replace whatever the content is between "<" & ">" i.e. the opening and closing tags. I know I can use the "Pos" function to identify the position of "<" & ">", but I am not sure exactly how to achieve this in Webi. FYI -  "Read content as HTML" & "Read content as Hyperlink" did not resolve the issue. Can anyone please help? Thanks.

    Hi Jeewan,
    It will be very tedious to do this at Webi level.
    I have tried below example. It might help you to work around your issue; however, not completely:
    1. Created an Excel and inserted single value in first column as:
    <html><b>this is yuvraj</b></html>
    2. Used it as source and created a Webi report in Rich client.
    3. Applied SubStr recursively using Pos function and created below variables:
    test : =Substr([column_1]; Pos([column_1];">")+1;Length([column_1]))
    test1: =Substr([test]; Pos([test];">")+1;Length([test]))
    test2 : =Substr([test1]; 0;Pos([test1];"<")-1)
    The output has been attached.

  • Replace everything except in html tags

    I have this little piece of code hilighting words in search
    results, however, it obviously replaces text in html tags as well
    and I want it to omit all html. I've also noticed that
    replacenocase replaces the case of my words...while it does search
    for words no matter the case, I sure wish it wouldn't replace the
    case of the original text. Any tips would be greatly appreciated.
    <cfset variables.hiliteSummary =
    ReplaceNoCase(siteSearch.summary,url.criteria,"<span
    class=searchHilite>#url.criteria#</span>","ALL")>

    to fix your issue with case, use a rereplace and
    backreferences:
    rereplaceNoCase(siteSearch.summary, '(#url.criteria#)',
    '<span class="searchHilite">\1</span>', 'all')

  • Reports does not show data which contains HTML tags

    Dear Gurus
    Im trying to resolve this problem but im really stuck in it. I have the requirment to customize PO reports in R12 and at the end of every report we have to show its Terms and Conditions.I have the following query wich brings me the data i need.
    SELECT
    otu.document_number po_segment1,
    otu.document_id,
    otta.template_id,
    otta.template_name,
    otta.description,
    otta.intent,
    otta.status_code,
    otta.start_date,
    otta.end_date,
    otta.instruction_text,
    otu.document_type,
    otu.document_number po_segment1,
    otu.document_id po_header_id,
    osb.HEADING titulo_seccion,
    oav.display_name,
    oav.article_text article_text
    FROM
    apps.okc_terms_templates_all otta,
    apps.okc_template_usages otu,
    apps.okc_k_articles_b okab,
    apps.okc_sections_b osb,
    apps.okc_articles_all oaa,
    apps.okc_article_versions oav
    WHERE otta.template_id = otu.template_id
    AND otu.document_id = okab.document_id
    AND osb.scn_id(+) = okab.scn_id
    AND okab.article_version_id = oav.article_version_id
    AND oaa.article_id = oav.article_id
    AND otu.document_number='21000000111' -- Purchase Document
    AND otu.DOCUMENT_TYPE NOT IN ('RFQ_RESPONSE', 'RFQ','RFI_RESPONSE','RFI','AUCTION_RESPONSE','AUCTION')
    The problem is the field okc_article_versions.article_text storage data with HTML tags as an example : ''<P>COMPANY will make it’s best effort to provide an accurate forecast to CONTRACTOR, <B><I>at the end of every quarter,</I></B> however, a forecast in any form, shall not represent a firm commitment by COMPANY.,</P>"
    So when i tried to show the information my .rtf template nothing comes out. Does anybody knows whats happenig and how to resolve it??
    Please, resolve this issue is more than urgent an i guess somebody have the answe Thanks a lot
    Mily

    Hi ,
    Currently image url have value http://serverip:port/reports/rwservlet
    I don't know is this correct? Suggest What value it should have?
    Thanks
    Vinod

  • HTML tags in RTF--- Urgent pls help

    i have a field in answers with the name comments which returns the data in html tags like <~a>abcd <~/a>, it has to dispaly as a link but it is displying as <~a>abcd</~a>
    the same with html tags in it... how can i parse the HTML tags in BI publisher, can any one help me here pls
    pls remove the ~ code as it is not displaying those HTML tags in forum
    Edited by: user10744081 on Feb 5, 2010 9:48 PM
    Edited by: user10744081 on Feb 5, 2010 9:49 PM

    Hi Experts,
    to be precise, i have a column in my oracle DB has XHTML tags as a data in it, when i use this column in BIP report i am getting tha XHTML tags as my data in my output.how can i parse those and get only the required data to be displayed in RTF ?
    Any update on this? i am out of ideas on this.. can any one help me on this

  • Html tags in .properties files.

    Hi all,
    I want a small clarification regarding the .properties file in JSF.
    I want to execute html tags in the properties file. my resource file is...
    code = Section Code
    I want to make the Section Code as bold. If i give like this
    code = < b > Section Code < /b >
    all the html tags are displayed as it is on UI. In struts this works fine. means "Section Code" is displayed in Bold.
    In JSF, is there any way to do this?
    Thanks.

    Use escape attribute of outputText tag.
    <h:outputText value="#{employee.dataText}" escape="false"/>

  • When Exported in PDF reports displays HTML Tags

    Hi All,
    Business Object XI R2
    WebI Report
    I am Reporting on Oracle CLOBs. This CLOB contains Data with HTML Tags, Clearly this CLOB is the combination of DATA formatted in HTML tags.
    When I create a WebI Reports on this (CLOB) WebI displays correctly in the sence data only.
    When I export this report to PDF; The PDF display contains both data with HTML tags as well.
    Is there any solution/workaround or any setting in the BO Server to overcome/solve this issue.
    Appreciated you prompt help.
    Thanks,
    Ashok

    Christine,
    My question is wether Adobe support CLOBs or not.
    I was reported on oracle CLOBs (This CLOBs contains data wrapped in HTML tags), by using Business Object Web Intelligence. This WebI displaying the reports as I desire, there is no problem, in WebI. WebI displaying data with no HTML Tags.
    My problem is that when I export this WebI report, this Adobe is getting HTML tags, why? Since this WebI is not displaying the HTML tags, since adobe does not know wether there is a HTML tags or not.
    Apprecited your prompt reply.
    Thanks,
    Ash

  • Dreamweaver CS6 glitch - HTML tag pop up pops up and stays

    I'm in code view typing code. Sometimes the HTML tag pop up will pop up and instead of being helpful, it just stays there and the auto-complete HTML tag functions stop working. It is quite annoying on two levels. I cannot consistently recreate the issue but it happens every other day. I "fix" the problem by restarting Dreamweaver every time.
    Can you guys patch this issue? I'm using Dreamweaver CS6 on Mac OS X. Here is a screenshot of what it looks like. Notice how this pop up just stays there even as I scroll through the code.
    Thanks.

    What happens if you hit Shift+Spacebar?
    Nancy O.

  • Can i have html code for date select options (SEARCH HELP)

    Hi frinds,
    I have a BSP Page with input as date.
    Can i have html code for date select options (SEARCH HELP)
    Moosa

    Hi
    Please find the sample code below.
    FROM DATE
          <htmlb:inputField id        = "dd"
                            width     = "45%"
                            type      = "DATE"
                            showHelp  = "X" <- Search help
                            alignment = "CENTER"
                            maxlength = "10"
                            disabled  = "TRUE"
                            value     = "<%= w_FROMDATE %>" />
    TO DATE
          <htmlb:inputField id        = "dd"
                            width     = "45%"
                            type      = "DATE"
                            showHelp  = "X"
                            alignment = "CENTER"
                            maxlength = "10"
                            disabled  = "TRUE"                      
    value     = "<%= w_TODATE %>" />
    Thanks
    kalyan

  • ORA-01403: no data found Error in PLSQL code raised during plug-in processing.

    Hello OTN community,
    We are having the access to APEX problem. a New user was setup to access the APEX application. When I test to login as a new user, I get the message "ORA-01403: no data found Error in PLSQL code raised during plug-in processing.". When click OK to the disply message, the application will take me out of the sstem. I need help to even understand what is happening. I didn't develop the application, there is no documentation for this application, I am just supporting the application whenever there is a problem and I am new to APEX. As you can see I need help to figure this thing out. Your help is dearly appreciated.
    Thank you OTN

    Try to check the query that is executed and check if there is data or not

  • Error in Abap code when combining data from two tables

    Hi,
    I got error in my code when  i try to select data based on two tables
    error message Unknown column name "(" field list. field list. field list. field list.
    select ( WLK1~ARTNR )
              into ZOXE1D0041-ZZPROMO
              from WLK1 INNER JOIN T001W
              ON WLK1FILIA = T001WKUNNR.
              where WLK1-PFLKN NE 'P' AND
              WLK1-QUELL NE '2'.
    Table 1 WLK1
    ARTNR   FILIA       PFLKN                  QUELL
    001         C001        P                           2
    002         C001        A                          1
    Table 2  T001W
    KUNNR                WERKS
    C001                    P001
    My requirement is to extract from article number from table WLK1 where the customer number (FILIA) matches with Customer number from (T001W) and plant (WERKS).
    In conclusion I like to have this only this row
    ARTNR   FILIA       PFLKN                  QUELL
    002         C001        A                          1

    Hi
    You need to append every article number after each select is performed
    is this an intermal table ZOXE1D0041 with header line ? if yes
    then do this way
    select WLK1~ARTNR
    into ZZARTICLE
    from WLK1 INNER JOIN T001W
    ON WLK1FILIA = T001WKUNNR
    where WLK1~PFLKN NE 'P' AND
    WLK1~PFLKN NE 'S' AND
    WLK1~QUELL NE '2'.
    ZOXE1D0041-ZZLISTARTICLE = ZZARTICLE.
    Append ZOXE1D0041.  " <edited>
    endselect.
    then ZOXE1D0041 will have all article numbers.
    Edited by: Sonal Patel on Sep 5, 2009 10:27 AM

  • Code to translate xml data into html using jaxp ?

    Hi all !!
    Could you please send me code to translate xml data into html using jaxp
    i am sending my xml file and xsl file
    its urgent
    my xml file is :
    <?xml version="1.0" encoding="UTF-8"?>
    <?xml-stylesheet type="text/xsl" href="scenario.xsl"?>
    <scenarioReport>
    <node name="node1">
    <netObjId>124 </netObjId>
    <result>undefined</result>
    <report>The cell is 124.</report>
    <action>qsdsqdqsd </action>
    </node>
    <node name="node 3">
    <netObjId>124 </netObjId>
    <result>undefined</result>
    <report>Result is unresolved because ...</report>
    <action>No action</action>
    </node>
    <node name="node 2">
    <netObjId>124 </netObjId>
    <result>undefined</result>
    <report>qsdqsdqs </report>
    <action>qsdsqd</action>
    </node>
    <node name="node 5">
    <netObjId>124 </netObjId>
    <result></result>
    <report> </report>
    <action> </action>
    </node>
    <node name="node 4">
    <netObjId>124 </netObjId>
    <result></result>
    <report> </report>
    <action></action>
    </node>
    </scenarioReport>
    my xsl file is::
    <?xml version="1.0" encoding="UTF-8" ?>
    <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
    <xsl:output method="html"/>
    <xsl:template match="/">
    <html>
    <body>
    <h2> Scenario Report</h2>
    <table border="1">
    <tr bgcolor="#9acd32">
    <th align="left">Nodename</th>
    <th align="left">netObjId</th>
    <th align="left">Result</th>
    <th align="left">Report</th>
    <th align="left">Action</th>
    </tr>
    <xsl:for-each select="scenarioReport/node">
    <tr>
    <td><xsl:value-of select="@name"/></td>
    <td><xsl:value-of select="netObjId"/></td>
    <td bgcolor="#ffffff "><xsl:value-of select="result"/></td>
    <td><xsl:value-of select="report"/></td>
    <td><xsl:value-of select="action"/></td>
    </tr>
    </xsl:for-each>
    </table>
    </body>
    </html>
    </xsl:template>
    </xsl:stylesheet>

    Must be something wrong with your XSL.
    However apparently it was so urgent that you didn't have the time to look at what you posted. They just "fixed" the forum software and apparently it doesn't escape HTML that you type in any more. Or stuff that looks like HTML, either. So your post was unreadable.
    If your deadline hasn't passed, try reposting that code surrounded by [pre] and [/pre].

  • APEX 3.1 replaces HTML tags in error message automatically

    Hello!
    I have a problem: we use sometimes HTML links or even JavaScript in error messages. In older versions of APEX it works, but now we upgraded to 3.1 and in all those messages HTML tags are replaced so instead of link we get a plain HTML in a message.
    Are there any possibilities to turn this option off or what can we do to solve this problem?
    Regards,
    Maksim

    In a page process we use raise_application_error(-20547, 'Go to GOOGLE') and in a Process Error Message
    we use constuction Error: #SQLERRM#. Then on an standard error page we see instead of Error: Go to Google html source. Thats it. In template in Error Page Template Control section we use substitution #MESSAGE#

  • Error while entering address details in company code master data.

    Hi Experts,
    I am getting error while i am entering address details in company code master data that is while i am creating new company code.
    ERROR: message No. AM216
                  Incomplete Address : Enter Country.
    Here eventhough i am entering country as "IN" then still i am getting error.
    Thanx,

    Yes that is right what is mentioned above, first you give the company code and name then give the currency then select address (Shift+F5) and in that if you select country as IN then it will automatically come to master data.
    Edited by: venkata986 on Aug 31, 2010 12:31 PM

Maybe you are looking for

  • Printing the same page multiple times on one sheet

    So last year I wanted to print out minature versions of my card design and I was able to do that by printing out multiple copies of the same thing on one sheet of paper. Of course that was a while ago and now today I can't do the same thing. I rememb

  • Schema Level Problem !

    {color:#000080}Hi,{color} {color:#000080}I have successfully configured the schema level replication, but some issues are front of me to struck me. So, I am going to explain my scenario as following.{color} {color:#000080}1: Site1 having oracle 10g D

  • HT1420 how can I authorise more than 5 computers in home sharing?

    How can I authorise more than 5 computers on home sharing?

  • Ipad off button not working what to do

    How to fix or what to do my ipad2 off on button is not working what to do

  • Can't open and edit project

    A simple problem as a new LiveType user. I completed one project in LiveType (which is now saved as a .mov file), and wouldn't you know I spelled something wrong. When I open LiveType and select "open recent" it opens the project I did in a new windo