How to put String with html tags as it is into xml

I am using apache dom API to create xml from java.
I have a string with html tags in it .when I add the string to xml, its replacing all the "<"; with &lt and ">" with > I would like the html tags to look as it is instead of the > and & lt;. How can I acheive that
this is the code snippet of what I am doing
In java class
String titleString = "<font color=red>This Is an Example of a Red Subject</font>"
Document doc = new DocumentImpl();
Element root = doc.createElement("bulletin");
Element item = doc.createElement("title");
item.appendChild(doc.createTextNode(titleString));
In Xml it looks like below
<title><font color=red>This Is an Example of a Red Subject</font></title>
but I would like to have the xml like below
<title><font color="red">This Is an Example of a Red Subject</font></title>
Can you please suggest me whats the best way to acheive this.
I appreciate all your help
Thank you
Suma

One problem is that you don't understand escaping. If you re-read what you posted you'll see that what you say you get, and what you say you want, are identical. That's because you didn't escape one of the two properly. So your first step should be to find the section about escaping in Chapter 1 of your XML book and read it carefully. Figure out what you should have done here (yes, the same rules apply).
However, to attempt to answer what I think your question is: if you have a String which contains markup, and you want to convert that String to XML elements, then you have to feed the String into an XML parser.

Similar Messages

  • Text in internal table with HTML tags.

    Hi ,
    I have Text in internal table with HTML tags.
    The text has to be shown in output of smartform as formatted text.
    That is the smartform should READ the HTML TAGS , convert the text accordingly and show in the output as formatted text.
    I dont want to make a webform . This is for NORMAL SPOOL output and NOT for WEB OUTPUT.
    IN SHORT
    :- the text in the internal table is like this ( please ignore the dot in the HTML TAG )--
    <html><.U>this is heading</.U>Line with no break<.br>some content text</.br>
    </html>
    OUTPUT
    <U>this is heading</U>Line with no break<br>some content text</br>
    1)  Can I can get the output and store it as text in a string variable and show in the smartform  ?
    In this case I want to know how to convert  and store in a variable  in sap .
    OR
    2) Can the text element convert the text with HTML TAGS to html formatted output and show it ?
    Regards,
    Jagat

    Hi,
    Use the FM SCP_REPLACE_STRANGE_CHARS and check
    See the
    Converting html special characters to plain characters (e.g. u00FC to u00FC)

  • XML with HTML Tags... (easy points) 11g question

    Dear Programming Gods,
    I have been researching this for about 2 weeks now, and I have hit the final road block.
    Using BI Publisher 11.1.1
    In APEX 4.0 I have a Rich Text Field. The data from the Rich Text Field is store in CLOB. The data has HTML formatting tags. I have a data model that selects the data. I create an xml which has the html tags. I export the xml and import it into MS Word using the BI Publisher add-in. I import my subtemplate which handles almost all of the formatting tags. I apply the template to the CLOB field so that the HTML formatting tags will be rendered when printed.
    The problem is this. The subtemplate is looking for this < and / > however BI publisher convters the tags stored in the CLOB from raw html tags to this &.lt; and &.gt; so the subtemplate can not match to it.
    Here is what I need to figure out and please explain it in very novice terms.
    When I generate and export the XML from BI Publisher how do I prevent it from converting my raw tags?
    Here is some further assistance when prepairing your answer.
    My subtemplate is based on the htmlmarkup.xsl from the following blog but has been modified heavily to include support for simple tables, more formatting such as subscripts and superscripts, ect...
    http://blogs.oracle.com/xmlpublisher/2007/01/formatting_html_with_templates.html
    I am also familliar with this blog but I do not understand how to implement it using BI 11g.
    http://blogs.oracle.com/xmlpublisher/2009/08/raw_data.html
    I have tried adding this to my layout but it doesnt seem to work.
    <xsl: element name="R_CLOB" dataType="xdo:xml" value="R_CLOB" / >
    Please, help me. I have to have this working in 4 days.
    Richard

    This did not work either. Here's more infor on what I have so far.
    My data template looks like this:
    <dataTemplate name="Data" description="Template">
         <parameters>
              <parameter name="p_person_id" dataType="character" defaultValue="1"/>
         </parameters>
         <dataQuery>
              <sqlStatement name="Q1">
                                  select TEMPORARY_TEMPLATE_DATA.line_id as LABEL_line_ID,
    TEMPORARY_TEMPLATE_DATA.column_id as LABEL_column_ID,
    TEMPORARY_TEMPLATE_DATA.person_id as LABEL_PERSON_ID,
    TEMPORARY_TEMPLATE_DATA.label as LABEL_DATA
    from MY_BIO.clm_TEMPORARY_TEMPLATE_DATA TEMPORARY_TEMPLATE_DATA
    Where person_id = :p_person_id
    and style = 'L'
                             </sqlStatement>
              <sqlStatement name="Q2" parentQuery="Q1" parentColumn="LABEL_DATA">
                                  select TEMPORARY_TEMPLATE_DATA.LINE_ID as LINE_ID,
    TEMPORARY_TEMPLATE_DATA.COLUMN_ID as COLUMN_ID,
    TEMPORARY_TEMPLATE_DATA.label as COLUMN_LABEL,
    to_nclob(TEMPORARY_TEMPLATE_DATA.COLUMN_DATA) as  COLUMN_DATA,
    TEMPORARY_TEMPLATE_DATA.STYLE as STYLE,
    TEMPORARY_TEMPLATE_DATA.ATTRIBUTE as ATTRIBUTE,
    NVL(TEMPORARY_TEMPLATE_DATA.JUSTIFY,'L') as JUSTIFY
    from MY_BIO.clm_TEMPORARY_TEMPLATE_DATA TEMPORARY_TEMPLATE_DATA
    Where person_id =:p_person_id
    and label = :LABEL_DATA
    and style != 'L'
    Order by line_id, column_id
                             </sqlStatement>
         </dataQuery>
         <dataStructure>
              <group name="G_LABEL" source="Q1">
                   <element name="LColumnData" value="label_data"/>
                   <group name="G_DATA" parentGroup="G_Label" source="Q2">
                        <element name="LineID" value="line_id"/>
                        <element name="ColumnID" value="column_id"/>
                        <element name="ColumnData" value="column_data"/>
                        <element name="Style" value="style"/>
                        <element name="Attribute" value="attribute"/>
                        <element name="Justify" value="justify"/>
                   </group>
              </group>
         </dataStructure>
    </dataTemplate>
    After running this data_template there was no change in the xml file generated see partial :  Note:
    my test actually has the B with the html tags
    </G_DATA>
    - <G_DATA>
    <LINEID>20</LINEID>
    <COLUMNID>1</COLUMNID>
    <COLUMNDATA>test test <B>my test</B></COLUMNDATA>
    <STYLE>R</STYLE>
    <ATTRIBUTE />
    <JUSTIFY>C</JUSTIFY>
    </G_DATA>
    - <G_DATA>
    <LINEID>21</LINEID>
    I loaded in to MS Word but there was no change documnet still look the same. I left the commands import file command and xsl:apply-templates command in the word document template.
    I really appreciate you helpiing me.
    cheryl

  • Tablespace usage report generated with html tags instead of text

    Hi ,
    We have a unix shell script scheduled to find tablespace usage and sends the report to our mail id.
    For the past few weeks(no changes idone in the script) the report is coming with html tags instead of text as below.
    </head>
    <body>
    <p>
    <table border='1' width='90%' align='center' summary='Script output'>
    <tr>
    <th scope="col">
    TABLESPACE_NAME
    </th>
    <th scope="col">
    CUR_USE_MB
    </th>
    <th scope="col">
    CUR_SZ_MB
    </th>
    <th scope="col">
    CUR_PRCT_FULL
    </th>
    <th scope="col">
    FREE_SPACE_MB
    </th>
    <th scope="col">
    MAX_SZ_MB
    </th>
    <th scope="col">
    OVERALL_PRCT_FULL
    </th>
    </tr>
    <tr>
    <td>
    SYSTEM
    </td>
    <td align="right">
    268
    </td>
    <td align="right">
    500
    </td>
    <td align="right">
    54
    </td>
    Is this any settings issue or anything to be modified in the script.Could you please reply..
    Regards,
    Bharath.
    Edited by: 870384 on Jul 6, 2011 1:17 AM

    Hi Sven W,
    Please find the sql below that is generating the tablespace usage report. In the staring of the script markup is set to ON and at the end it is set to OFF.Do you suggest any changes to this..?
    SET ECHO OFF
    SET PAGES 999
    SET MARKUP HTML ON SPOOL ON
    col tablespace_name format a15 trunc
    col cur_use_mb for 999999999
    col cur_sz_mb for 999999999
    col free_space_mb for 999999999
    col max_sz_mb for 999999999
    compute sum of cur_use_mb on report
    compute sum of cur_sz_mb on report
    compute sum of free_space_mb on report
    compute sum of max_sz_mb on report
    break on report
    spool tablespace.html
    select tablespace_name,
    round(sum(total_mb)-sum(free_mb),2) cur_use_mb,
    round(sum(total_mb),2) cur_sz_mb,
    round((sum(total_mb)-sum(free_mb))/sum(total_mb)*100) cur_prct_full,
    round(sum(max_mb) - (sum(total_mb)-sum(free_mb)),2) free_space_mb,
    round(sum(max_mb),2) max_sz_mb,
    round((sum(total_mb)-sum(free_mb))/sum(max_mb)*100) overall_prct_full
    from (select tablespace_name,sum(bytes)/1024/1024 free_mb,0 total_mb,0 max_mb from DBA_FREE_SPACE group by tablespace_name
    union select tablespace_name,0 current_mb,sum(bytes)/1024/1024 total_mb,sum(decode(maxbytes, 0, bytes, maxbytes))/1024/1024 max_mb
    from DBA_DATA_FILES group by tablespace_name) a group by tablespace_name;
    select owner,segment_name,segment_type,bytes/(1024*1024) size_m
    from dba_segments
    where tablespace_name = 'SYSTEM' and segment_name='FGA_LOG$' order by size_m desc;
    spool off;
    SET MARKUP HTML OFF SPOOL OFF

  • How to display string with XML content in 4.6?

    Hi,
    I`d like to know how to display string with XML content in it for 4.6.
    4.6 has not method parse_string.
    And example like this is not helpful:
      DATA: lo_mxml    TYPE REF TO cl_xml_document.
      CREATE OBJECT lo_mxml.
      CALL METHOD lo_mxml->parse_string
        EXPORTING
          stream = gv_xml_string.
      CALL METHOD lo_mxml->display.
    Thank you.

    Hi,
    May be you can use fm SAP_CONVERT_TO_XML_FORMAT. But it have some issues with memory usage, the program consumed tons of memory during convert.

  • How to concatenate string with a numeric control ?

    Hi,
    How to concatenate string with a numeric control ?
    Thankyou.
    Solved!
    Go to Solution.

    Its simpler to just use the Format Into String.
    Attachments:
    Format Into String.png ‏11 KB

  • How to write strings with an underline on the TOP-OF-PAGE of ALV

    How to write strings with an underline on the TOP-OF-PAGE of ALV

    if u r using classes and methods it can be done
    but if u r using normal fms and then u have to use HTML_TOP_OF_PAGE but the drawback for this it cannot be printed when the report is printed .

  • How to use Microsoft Word's Find and Replace with HTML tags?

    Hello to all!
    I'm trying to figure out how to use the find and replace function in Word to replace html tags. I'd like to be able to change something like this:
    <span class="B01-K-ITAL">random text</span>
    To something like this:
    <em>random text</em>
    I want to replace the open and close tags without changing or interfering with the text between the tags. I'm pretty sure I should use wildcards, but I can't figure out how to use them properly.
    Anyone able to lend a hand?

    Here is my latest regular expression with Perl.   I think it matches the spirit of the request in the original post.
    Note, this isn't as easy as you think.  You need to code up the complete set of html rules in you implementation. You need to allow for a certain amount of mal-formed html.
    perl -0660pe 's^<[sS][pP][aA][nN]\s+class="B01-K-ITAL"\s*>(.*?)</[sS][pP][aA][nN]>^<em>$1</em>^gs' i.html >|o.html
    input text
     <html> <head>...</head> <body>I'd like to be able to change something like this: <span class="B01-K-ITAL">#1 one line</span> I want to replace the open and close tags without changing or interfering with the text between the tags. I'm pretty sure I should use wildcards, but I can't figure out how to use them properly. <p>note, this isn't as easy as you think.  You need to code up the complete set of html rules in you implementation. You need to allow for a certain amount of mal-formed html.</p> <span class="B01-K-ITAL">#2 don't be greedy</span> <span class="B01-K-ITAL">$3 multiline text</span> <span class="B01-K-ITAL">#4 multiline tag. I believe html allow a carriage return in white space of tags</span> <span class="B01-K-ITAL">#5 split after the class tag. optional white space</span> <sPan class="B01-K-ITAL">#6 mixed case tag</Span> <p>no text #7</p><span class="B01-K-ITAL"></span> <!-- Apparently, this is valid     http://www.positioniseverything.net/articles/cc-plus.html --> <!--[if IE]> <div id="IEroot"> <![endif]--> <p id="IE">This browser is IE.</p> <p id="notIE">This browser is not IE.</p><!--[if IE]> </div> <![endif]--></body> </html>
    output text
     <html> <head>...</head> <body>I'd like to be able to change something like this: <em>#1 one line</em> I want to replace the open and close tags without changing or interfering with the text between the tags. I'm pretty sure I should use wildcards, but I can't figure out how to use them properly. <p>note, this isn't as easy as you think.  You need to code up the complete set of html rules in you implementation. You need to allow for a certain amount of mal-formed html.</p> <em>#2 don't be greedy</em> <em>$3 multiline text</em> <em>#4 multiline tag. I believe html allow a carriage return in white space of tags</em> <em>#5 split after the class tag. optional white space</em> <em>#6 mixed case tag</em> <p>no text #7</p><em></em> <!-- Apparently, this is valid     http://www.positioniseverything.net/articles/cc-plus.html --> <!--[if IE]> <div id="IEroot"> <![endif]--> <p id="IE">This browser is IE.</p> <p id="notIE">This browser is not IE.</p><!--[if IE]> </div> <![endif]--></body> </html>

  • How to Read a program with  HTML tags from SO10

    Hi All,
    I have a html program in Standard text (SO10).But when I am trying read the program content using FM:  READ_TEXT, the html tags <b> </p> etc are creating problem. 
    They are retrieved as <(><<)>b>.
    What should we do to get same/original text as in SO10?  Is there any other FM for that? Any other way to achieve this?
    Thanks & Regards,
    Vimalan Ram

    here is the code sample.
    after reading the text using READ_TEXT you have to use CONVERT_ITF_TO_ASCII to convert the contents.
    DATA: itf_tab TYPE STANDARD TABLE OF   tline ,
    wa_itf TYPE tline .
    DATA: c_datatab TYPE tdtab_c132 .
    CALL FUNCTION 'READ_TEXT'
      EXPORTING
       client                        = sy-mandt
        id                            = 'ST'
        language                      = sy-langu
        name                          = 'Y_RAJA_HTML'
        object                        = 'TEXT'
    *   ARCHIVE_HANDLE                = 0
    *   LOCAL_CAT                     = ' '
    * IMPORTING
    *   HEADER                        = HEADER
      TABLES
        lines                         = itf_tab
    EXCEPTIONS
       id                            = 1
       language                      = 2
       name                          = 3
       not_found                     = 4
       object                        = 5
       reference_check               = 6
       wrong_access_to_archive       = 7
       OTHERS                        = 8
    IF sy-subrc <> 0.
    * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    CALL FUNCTION 'CONVERT_ITF_TO_ASCII'
    EXPORTING
    *   CODEPAGE                = '0000'
    *   FORMATWIDTH             = 72
       language                = sy-langu
       tabletype               = 'ASC'
    *   TAB_SUBSTITUTE          = ' '
    *   LF_SUBSTITUTE           = ' '
    *   REPLACE_SYMBOLS         = 'X'
    *   REPLACE_SAPCHARS        = 'X'
    IMPORTING
    *   FORMATWIDTH_E           = FORMATWIDTH_E
    *   X_DATATAB               = X_DATATAB
       c_datatab               = c_datatab
    *   X_SIZE                  = X_SIZE
      TABLES
        itf_lines               = itf_tab
    EXCEPTIONS
       invalid_tabletype       = 1
       OTHERS                  = 2
    IF sy-subrc <> 0.
    * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    Regards
    Raja
    Message was edited by: Durairaj Athavan Raja

  • Help with HTML tags and web page creating

    I have a project that is supposed to use an HTML class we make. He has given us the basics but we have to fill it in. My question is: How do you code a value that has been passed to a method into an html tag. For instance we have one that is called makeEmail and it is supposed to place an email address on a webpage. Here is the method, I just need to figure out how to code it correctly. Any suggestions on how to do this?
    public void makeEmail(String address)
    webPage += "" + address + "";
    }

    An email tag in html is very similar to a hyperlink. The string you want the makeEmail method to create is as follows:
    <a href="mailto:(email address")>(email address or description or whatevber you want displayed on screen)</a>So using for example my email address, you use the following line:
    <a href="mailto:[email protected]">Send an email to Mr_Silly</a>It is very much worth looking into an html tutorial, try searching for one on the web, cos there a thousands out there. It is a very simple language to learn.
    :-)

  • Recordset xml export WITH html tags

    Hi there,
    I am trying a rather simple thing (I hope) but cannot figure it out how to do it.
    I created a dynamic xml (.php) file using the export recordset as xml behaviour. The generated xml works fine when I use spry to display it. The downside is that html tags are converted to something like this (I understand that these are the greater then and lesser then signs used in html):
    <strong>fringilla</strong>
    In the html document where I use spry to display this xml, the < etc are converted back to <  and >, but the html is not rendered.
    I tried cdata, but somehow cannot get this to work. I also cannot get dsSpecials.setColumnType("quote_tekst", "html"); to render the xml as correct html.
    Can someone tell me how to do this? Database and xml are both utf-8.
    Kind regards and big thanks in advance if you can help (it is really appreciated ;-D),
    Ben

    Sorry about that, don't know what happened in that last post..formatting I guess, here's the whole reply - xml enclosed w/ a pre - thanks again.<br /><br />Hi Günter,<br /><br />Thanks so much for the info.  I have been diligently trying to use CDATA and read the generated XML, but still I'm not seeing the HTML text rendereed in my detail section.<br /><br />The XML is setup from my mySQL data as:<br /><pre> <br /><?xml version="1.0" encoding="UTF-8"?><br /><CurrentSpecials><br />     <special><br />          <name> Caribbean Sun </name><br />          <detail> <h1>special deal!!</h1><p style="color:#00f;"><strong>Join us</strong>!</h1> </detail><br />          <expire> 2007-08-31 00:00:00 </expire><br />          <rating> highest </rating><br />     </special><br />...<br /></pre><br />and I want the detail to render in my div (or I'll add a table/textarea...) as the html indicates.  I'm not having any luck w/ using CDATA for it - it's probably just me - I'm just starting out with this stuff.  Any pointers in the right direction? I'm getting the detail as {dsList:detail} and somehow need to say - this is html.  I've tried using javascript and php to render it.<br /><br />I could I guess just echo the detail on a mouseclick without a spry but didn't want to have to do all the implementation myself - I wanted to take advantage of dreamweaver's functionality! <br /><br />Thanks so much for looking at this - any help is so much appreciated!!

  • How do I modify a Html tag attribute?

    Hi.
    I tryed to modify the witdth and height attributes of <applet> tag but I have not obtained it. I run this:
    import java.io.*;
    import javax.swing.text.*;
    import javax.swing.text.html.*;
    import javax.swing.text.html.parser.*;
    class OtraPrueba{
         public static void main(String[] args){
              String infile = "c:\\Page1.htm";
              String outfile = "c:\\outPage1.htm";
              String applethtml = "<applet code=\"class1.class\" codebase=\"v_10\" width=\"100\" height=\"100\" archive=\"class1.zip\"";
              Reader r;
              Writer w;
              HTMLDocument htmldoc;
              HTMLEditorKit kit = new HTMLEditorKit();
              HTMLEditorKit.ParserCallback callback =          
                   new HTMLEditorKit.ParserCallback(){
                        public void handleText(char[] data, int pos){
                             for(int i=0;i<data.length;i++)
                                  System.out.println ("data[" + i + "]" + data);
                        public void handleStartTag(HTML.Tag t, MutableAttributeSet a, int pos){
         System.out.println ("handleStartTag " + t);
         if (t == HTML.Tag.APPLET){
              a.removeAttribute(HTML.Attribute.WIDTH);
              a.addAttribute(HTML.Attribute.WIDTH, "100");
              try{
                   r = new FileReader(infile);
                   w = new FileWriter(outfile);
                   System.out.println ("antes del parser");
                   new ParserDelegator().parse(r, callback, false);               
    Can you help me?
    Thanks.

    Hello uhilger.
    I do it what you tell me last week but I get a NullPointerException at write the document extends HTMLDocument. It seems tries to write a empty tag. this is the exception text:
    _______________________exception text_____________________________
    java.lang.NullPointerException
    at javax.swing.text.AbstractWriter.write(AbstractWriter.java:489)
    at javax.swing.text.html.HTMLWriter.emptyTag(HTMLWriter.java:315)
    at javax.swing.text.html.HTMLWriter.write(HTMLWriter.java:187)
    at javax.swing.text.html.HTMLEditorKit.write(HTMLEditorKit.java:289)
    at Editor.setAppletAttributes(Editor.java:1017)
    at Editor.saveMenuItemActionPerformed(Editor.java:535)
    at Editor.access$13(Editor.java:24)
    at Editor$14.actionPerformed(Editor.java:421)
    at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:17
    67)
    at javax.swing.AbstractButton$ForwardActionEvents.actionPerformed(Abstra
    ctButton.java:1820)
    at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel
    .java:419)
    at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:257
    at javax.swing.AbstractButton.doClick(AbstractButton.java:289)
    at javax.swing.plaf.basic.BasicMenuItemUI.doClick(BasicMenuItemUI.java:1
    092)
    at javax.swing.plaf.basic.BasicMenuItemUI$MouseInputHandler.mouseRelease
    d(BasicMenuItemUI.java:932)
    at java.awt.Component.processMouseEvent(Component.java:5021)
    at java.awt.Component.processEvent(Component.java:4818)
    at java.awt.Container.processEvent(Container.java:1380)
    at java.awt.Component.dispatchEventImpl(Component.java:3526)
    at java.awt.Container.dispatchEventImpl(Container.java:1437)
    at java.awt.Component.dispatchEvent(Component.java:3367)
    at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:3214
    at java.awt.LightweightDispatcher.processMouseEvent(Container.java:2929)
    at java.awt.LightweightDispatcher.dispatchEvent(Container.java:2859)
    at java.awt.Container.dispatchEventImpl(Container.java:1423)
    at java.awt.Window.dispatchEventImpl(Window.java:1566)
    at java.awt.Component.dispatchEvent(Component.java:3367)
    at java.awt.EventQueue.dispatchEvent(EventQueue.java:445)
    at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchTh
    read.java:190)
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThre
    ad.java:144)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:138)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:130)
    at java.awt.EventDispatchThread.run(EventDispatchThread.java:98)
    ___________________end_exception text_____________________________
    I make a subclass of HTMLDocument with name EditableHTMLDocument :
    import javax.swing.event.*;
    import javax.swing.text.*;
    import javax.swing.text.html.HTMLDocument;
    class EditableHTMLDocument extends HTMLDocument{
         public void addAttributes(Element e, AttributeSet a) {
              if ((e != null) && (a != null)) {
                   try {
                        writeLock();
                        System.out.println("SHTMLDocument addAttributes e=" + e);
                        System.out.println("SHTMLDocument addAttributes a=" + a);
                        int start = e.getStartOffset();
                        javax.swing.text.AbstractDocument.DefaultDocumentEvent changes =
                        new javax.swing.text.AbstractDocument.DefaultDocumentEvent(start, e.getEndOffset() - start,
                             DocumentEvent.EventType.CHANGE);
                        AttributeSet sCopy = a.copyAttributes();
                        MutableAttributeSet attr = (MutableAttributeSet) e.getAttributes();
                        changes.addEdit(new AttributeUndoableEdit(e, sCopy, false));
                        attr.addAttributes(a);
                        changes.end();
                        fireChangedUpdate(changes);
                        fireUndoableEditUpdate(new UndoableEditEvent(this, changes));
                   }finally {
                        writeUnlock();
    And this is the method of program main class than call you addAttributes method:
         private void setAppletAttributes(){
              BufferedReader br;
              BufferedWriter bw;
              HTMLDocument htmlDoc;
              EditableHTMLDocument editHtmlDoc;
              HTMLEditorKit kit = new HTMLEditorKit();
              try{          
                   br = new BufferedReader( new FileReader( jTxtHtmlFile.getText() ) );
                   //htmlDoc = (HTMLDocument)kit.createDefaultDocument ();
                   editHtmlDoc = new EditableHTMLDocument();
                   kit.read (br, editHtmlDoc, 0);
                   br.close ();
                   javax.swing.text.Element rootElem = editHtmlDoc.getDefaultRootElement ();
                   javax.swing.text.Element elem =
                        editHtmlDoc.getElement (rootElem, HTML.Attribute.CODEBASE, jTxtCodebase.getText ());
                   SimpleAttributeSet sas = new SimpleAttributeSet();
                   sas.addAttribute ( HTML.Attribute.CODE, jTxtCode.getText () );
                   sas.addAttribute ( HTML.Attribute.CODEBASE, jTxtCodebase.getText () );
                   sas.addAttribute ( HTML.Attribute.ARCHIVE, jTxtArchive.getText () );
                   sas.addAttribute ( HTML.Attribute.WIDTH, jTxtAnchoApplet.getText () );
                   sas.addAttribute ( HTML.Attribute.HEIGHT, jTxtAltoApplet.getText () );
                   editHtmlDoc.addAttributes (elem, sas);
                   editHtmlDoc.dump (System.out);
                   bw = new BufferedWriter( new FileWriter( jTxtHtmlFile.getText() ) );
                   System.out.println ("length " + editHtmlDoc.getLength ());
                   kit.write (bw, editHtmlDoc, 0, editHtmlDoc.getLength ());
                   bw.flush ();
                   bw.close ();
              }catch(BadLocationException ble){
                   System.out.println ("BadLocationException " + ble.getMessage());     
    }catch(FileNotFoundException fnfe){
                   System.out.println ("FileNotFoundException " + fnfe.getMessage());     
              }catch(IOException ioe){
                   System.out.println ("IOException " + ioe.getMessage());
    Which you think that it is the problem?
    Thank you.
    Sergio Mart�n
    I visited your great page and download your SimplyHTML. I'll probe later.

  • Sending an email with html tags in it using apex_mail.send

    Hello,
    I am using APEX_MAIL.SEND to send emails from my apex applications.
    now I need the email body to have html features: bold, underline, colors etc.
    If I use regular html tags, they show up in the email.
    How can this be done?
    Thanks
    Rani

    Hi, try
    p_body_html
    and it should display just fine :)

  • Issue with HTML tags visible in Outlook emails

    Hi everyone, I'm having an issue with a website I'm working on.
    On our site, we have a page that generates emails after certain events occur. These are sent to a forwarding address on our mail server, which is then sent to several users on our mail server. These users have their accounts set up in Outlook (one in 2007,
    one in Mac 2011).
    We're are having an issue where these emails are displaying in Outlook with all of the HTML tags in the email visible. One of the users spoke to Microsoft support, and they remoted in and went through their Outlook settings and were not able to find any issues
    there.
    This issue is not global exactly. When one of the users added their email to their iPhone, the email displayed correctly. We added a Gmail account and my work account (which I also access through Outlook) to the forwarding list, and it displayed correctly in
    both. When we view these emails in the server's webmail client, the emails display fine. The issue seems to be with some discrepancy between Outlook and our email server.
    I spoke to our webhost about the issue, and they swore up and down the issue had nothing to do with them, and that it had to be an Outlook issue. I've had several professional web developers analyze the code that creates these emails, and they found nothing
    wrong with it. Something that several of my colleagues and our webhost suggested is that the issue could be with the email headers. This is the header for the email, as viewed through Outlook:
    Return-Path: <[email protected]>
    X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on clubcrown.com
    X-Spam-Level: *
    X-Spam-Status: No, score=1.5 required=7.0 tests=HTML_MESSAGE,MIME_HTML_ONLY,
    NO_DNS_FOR_FROM,NO_RELAYS autolearn=no version=3.3.1
    X-Original-To: [email protected]
    Delivered-To: [email protected]
    Received: by x.com (Postfix, from userid 30)
    id 50F7123D9E; Tue, 11 Feb 2014 14:20:00 -0500 (EST)
    X-Original-To: [email protected]
    Delivered-To: [email protected]
    Received: by x.com (Postfix, from userid 10000)
    id EC28323DA2; Tue, 11 Feb 2014 14:19:58 -0500 (EST)
    To: [email protected]
    Subject: A wholesale order has been placed
    X-PHP-Originating-Script: 10000:thanks.php
    MIME-Version: 1.0
    Any help would be greatly appreciated. Let me know if more information is needed. Thank you.

    Glad to hear that you have found the solution. And thank you for sharing the solution here, it will be helpful to other community members who have same questions.
    Cheers,
    Steve Fan
    TechNet Community Support

  • TFS 2012 - WI Query in TFS Web Access - History field contents appear with html tags presented as text

    When History field is selected as a column to be displayed in a WI query result, its contents are displayed with the HTML tags as if they where text, e.g. <p> contents </p>... 
    This occurs when query is run in web access contents in IE and when result is sent via email from within TFS (there's a button for this purpose).
    However, in Visual Studio 2012 the same History Column contents are shown without the tags, as one would expect.
    Furthermore, when one clicks on Open In Microsoft Office, for this query results in VS, and selects result in Excel, the History column in the Excel appears empty.
    The only way we found to bypass this issue for now, it to mark all the query result lines in VS, and right click for "print selected list..." to a virtual PDF printer. This way the result looks reasonably ok when History field is included.
    Kindly advise, Thank u very much.

    Hi Moital,  
    Thanks for your post.
    As far as I know history content will display with the HTML tags if there’s multiple lines in content, and History content not support show in Excel, that’s by design in TFS Server.  
    As Clementino said, you can submit this scenario in connect site, Microsoft engineers will evaluate them seriously. 
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

Maybe you are looking for

  • How to do when re-install an instance of RAC

    Hi all, We have a RAC system with two nodes, using ASM, Oracle database 10gR2 (10.2.0.40), OS: RHEL 4U6. Now one node in this system down because of hardware problems. We shutdown this node, whole this system is currently running on another healthy n

  • SAP Solution Manager 4.0 Install on iSeries V5R4M0 fails on STEP 40 of 40

    During Step 40 of 40 of Solution Manager 4.0 install on iSeries running i5/OS V5R3M0 failed with the following error: ERROR 2006-08-18 10:00:57 [iaxxgenimp.cpp:728] showDialog() FCO-00011 The step fixTemplate400 with step key |NW_Onehost|ind|ind|ind|

  • Iphone 5 stuck on logo.

    Hello, This morning (about 8 hours ago) my phone went to the apple logo, unprovoked. I have not jail broken it, i have not recently updated (last few weeks, but i believe i am on current update). I have attempted to reset it, the attempt only succeed

  • Error in dd activation by sapkb70015, do i need need a great ocs-queue?

    hello friends, my compnents: sm51 n4shost_N4S_01     n4shost     Dialog Batch Update Spool Enqueue ICM VMC J2EE     aktiv SAP-Kernel :  700_REL Datenbank Client Library : SQLDBC 7.6.3.014 CL 170762 hergestellt auf  :  Linux GNU SLES-9 x86_64 cc3.3.3

  • How do I view what websites/messangers a phone on my acct uses?

    I have tried everything but wanted to ask since I can't find a solution.  I have 3 phones on my account.  I was wondering if there is a way to view what websites a phones has used/went to, or if that phone is using yahoo messanger or another form of