Storing HTML TAG content in StringBuffer Problem..

respected sir...
currently i am working with one project in that i want to put whole table content in StringBuffer that goes for image creation .....and finally image is created for whole table
how can i put the HTML tags in imageBuffer.... i have tried with this...
StringBuffer ImageContent=new StringBuffer();
ImageContent.append(out.print("<table>"));
ImageContent.append(out.print("</table>"));
ImageContent.append(out.print("<tr>"));
ImageContent.append(out.print("</tr>"));
but not working is there any way to build table using StringBuffer that has whole Table Content With Data....
thanks in advance......regards.....

Hi.
Some remarks (no offence though...):
1) StringBuffer is synchronized. In case your object instance will not be used by other threads concurrently, you should use StringBuilder class instead (which offers the same methods)
2) when posting code samples, formatting them as code makes them easier for others to read
3) variable names are written with a lower case first letter by convention
4) shouldn't the "tr"s be between the opening and the closing "table"-tags?
5) it would be helpful to have an indication on what type "out" is and why you are using it...
For your problem: why do you pass your Strings to "out.print()"? StringBuffer directly takes Strings as arguments (among others).
Without having tried your sample, I would suggest you try somthing like the following:
StringBuffer imageContent=new StringBuffer();
imageContent.append("<table>");
imageContent.append("<tr>");
imageContent.append("</tr>");
imageContent.append("</table>");Bye.

Similar Messages

  • How to display html tags content in flex

    hi all,
    It would be great if any one can lead me to a tutorial of
    integrating html tags content in flex. Actulay i have to insert and
    series to table in flex
    thanks

    The Flash Player has a very limited number of HTML tags it
    can handle - table is not one of them. Since Flex is just a way to
    build Flash Player content you are limited by what the Flash Player
    can do.
    We don't supply a full browser/HTML rendering engine in the
    Flash Player because it would make the Flash Player a
    multi-megabyte download (eg, 11-12 MBytes); right now the Player
    has a small footprint which enables it to be downloaded by
    virtually everyone.
    The Adobe AIR player (see labs.adobe.com) does have a full
    HTML component and can run Flex programs. The caveat is that the
    apps are not run in the browser, but on the local machine. The
    end-user has to download the AIR player in order to use it.
    You can also check out Alex's blog (
    http://blogs.adobe.com/aharui/)
    and scroll down to "HTML and Flex"

  • Problem using XSLT & HTML Tags

    Hi all,
    I'm newbie using XML and XSL and i'm facing a problem that i would need some help.
    I wrote a XML using servlet that use a XSL and transform it in a HTML output. So everything seems to work fine but when i try to use HTML tags inside my XSL it is not executed. it looks like below viewing by the browser IE6.0.
    - <html>
    - <body>
    <b>Sun Sep 14 12:27:09 BRT 2003</b>
    <i>Hello World</i>
    </body>
    </html>
    The fact is that i want my HTML tags to be executed by the XSl file and do not simple show the tags. Can someone help me? I would appreciate any help since i've been spending long time with that without any answer.
    Thanks and Regards
    Fabio

    following below the code that generate the XML. I still need help.
    I hope someone can help me in this issue
    The servlet that generate the XML.
    response.setContentType("text/xml");
    String Xml = "";
    Xml = Xml + "<?xml version=\"1.0\"?>";
    Xml = Xml + "<?xml-stylesheet href=\"/XslGravaCrit.xsl\" type=\"text/xsl\"?>";
    Xml = Xml + "<!-- Here is a sample XML file -->";
    Xml = Xml + "<page>";
    Xml = Xml + "<title>Test Page</title>";
    Xml = Xml + "<content>";
    Xml = Xml + "<paragraph>What you see is what you get!</paragraph>";
    Xml = Xml + "</content>";
    Xml = Xml + "</page>";
    try{
    TransformerFactory tFactory = TransformerFactory.newInstance();
    byte[] arr=Xml.getBytes();
    ByteArrayInputStream bytes=new ByteArrayInputStream(arr);
    Source xsl=new StreamSource("../XslGravaCrit.xsl");
    Templates template=tFactory.newTemplates(xsl);
    Transformer transformer = template.newTransformer();
    transformer.transform(new StreamSource(bytes), new StreamResult(response.getWriter()));
    }catch(Exception e){
    System.out.println("Excecao 100: " + e.getMessage() + e.getLocalizedMessage());
    The XSL XslGravaCrit.xsl
    <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    xmlns:java="http://xml.apache.org/xslt/java" exclude-result-prefixes="java"
    version="1.0">
    <xsl:strip-space elements="*"/>
    <xsl:output method="html" indent="yes" version="4.0"/>
    <xsl:template match="page">
    <html>
    <body><b>
    <xsl:value-of select="java:java.util.Date.new()"/>
         </b>
    <xsl:for-each select="/page">
    <xsl:sort select="paragraph"/>
    <xsl:value-of select="paragraph"/>
    </xsl:for-each>
    <i>Hello World</i>
    </body>
    </html>
    </xsl:template>
    </xsl:stylesheet>

  • Displaying content in JSP page, want BR but not other Html tags

    I have a page and am reading files and displaying the contents of the files onto the page in a <div> Oneissue is that in the file the end of line are \n or \r\n whichever operation system. I replaced those with <BR> no problem. Now my issue is that I display that in the JSP page:
    <c:out value="${filecontents}" escapeXml="false" />I use escapeXml so that <BR> will add the line breaks. Now my issue is that the file might contains other HTML tags that I want to display simply as text - I don't want the browser to render the other HTML tags.
    Is there a way to do that? Would I have to replace HTML tags with something special?

    Hmm... your file contains HTML tags, but you don't want the browser to interpret them as HTML tags, right? So the way to do that is to use escapeXml="true" in your c:out element.
    But then that also escapes the <BR> tags that you carefully put in there. And you don't want that. You want the browser to interpret those as HTML tags.
    I guess you can't have it both ways. Can you do something like outputting one line of the file at a time with <c:out ... escapeXml="true"> followed by <br>?

  • How to change inner content of HTML tag using HTMLDocument?

    I want to change the inner content of an HTML tag from a HTMLDocument. The tag is like
    <span id ="id1">Replace me</span>.
    So I want to change the text "Replace me" inside the span tag and replace it with an other text.
    I can get the span element using
    HTMLDocument.getElement("id1")
    I have tried many things with the Element instance i got from getElement. But I find no way to change the inner content of the HTML element. Any ideas?

    If I use JDK 1.5 the SPAN tag works, so I checked the core of the problem which is inserting HTML code in an HTML tag.
    setInnerHTML works fine for block tags like DIV but not if the tag is a leaf element like the SPAN tag. I have tried to use the following code for leaf elements:
    Element elem = m_htmlDocument.getElement(id);
    int nStartOffest = elem.getStartOffset();
    int nEndOffset = elem.getEndOffset();
    int nLength = nEndOffset - nStartOffest;
    m_htmlDocument.replace(nStartOffest, nLength, html, elem.getAttributes());
    This works, but only if the new HTML string does not contain HTML tags like a link <href..... >. If the string contains HTML tags the replace method masks all characters like < or >. So the link is not shown as link in the HTML page but as HTML text.
    The next thing I have tried is using
    m_htmlDocument.setOuterHTML(elem, html);
    This works too but it replaces the whole original HTML element like the SPAN tag.
    So there is still the question how to insert HTML text into a leaf Element in a HTMLDocument.

  • HTML Export Content Ordering Problem

    I've inherited a collection of InDesign files and PDF files that have been exported from them.  I'd like to convert everything to HTML.  The InDesign export process is working fine for most files, but for a few, I am getting my content's order re-arranged.  One problem file is a large file that contains a series of letters.  The output file contains 3 DIVs within the BODY tag.  The first one contains the (Correct) first page, then the second two DIVs each contains a seemingly arbitrary collection of these letters with "jumps" in the ordering (10 letters might be in the correct order, then we "jump" to a previous set of letters or a much latter set of letters).  The PDF export doesn't have this problem.  I'm a newbie to InDesign. Thanks for any ideas for where I should look for the source of this problem.

    Hi Devin,
    For HTML export there are three modes for ordering content. This option is avilable in Content order section in General Tab of HTML export:
    1. Based on Page Layout : This is the default one and the one you are using right now. The objects appear from the top left and the appearance may not match ID in this case.
    2. Based on Articles Panel: Here you put your content in articles and then depending on the order the objects appear in Articles, the same order applies to HTML export.
    Please refer this link to get a better idea about how Articles Panel works:
    http://help.adobe.com/en_US/indesign/cs/using/WS8c5bc4f64c7a4a3d78b7a8b312dbccaf5b2-8000.h tml
    (this is the one you should be using )
    3. Based on XML structure: This applies in case you have tagged content and wish to make xml structure as the reading order.
    Thanks,
    Pooja

  • Problem in parsing HTML tag

    Hello,
    I want to parse the text in div ..like :<div id="title">Action Result</div>
    My code is :
    public void handleSimpleTag(HTML.Tag t, MutableAttributeSet a, int pos){
    if (t == HTML.Tag.DIV){
      String page_title = (String)a.getAttribute(HTML.Attribute.ID);
      if (page_title != null){
         System.out.println("Title : " + page_title);
      public static void main(String argv[]) {
        try {
          Reader r = new FileReader("C://test1.html");
          ParserDelegator parser = new ParserDelegator();
          HTMLEditorKit.ParserCallback callback = new ParseTest();
          parser.parse(r, callback, false);
        } catch (IOException e) {
          e.printStackTrace();
      }But it does not work. Please advise how to do this.
    Thanks in advance.

    I also want to extract the html text from the tag like-
    <div id="title">Action Result</div>
    I want to take the "Action Result" as my programs output.
    Please help me to solve this problem.

  • Problem removing html tags from the text retrived

    Hi there,
    I am using jdbc to connect the database and retriving the data. In one of the columns along with the description there are some html tags in few of the recors of that column. is there a way to retrive the text only ignoring the html tags in between. Or can i retrive and then strip off the html code in the text to display only normal text.
    example of the data retrived which are pipe seperated and one of the columns has html tags in it:
    209|The euphoria |187945-2|http://www.abc/lst.jsp?mktgChannel=I86023&sku=18791-2&siteID=qpF0HYnRugA|http://www.abc.com/assets/images/product/medium/18793-2_198.jpg|Rooftop Singers: Walk Right In | abc Music proudly presents THE FOLK YEARS, an unforgettable era in music history!<BR><BR><B>Featuring:</B><BR>
    <LI>The most complete collection of folk and folk-rock songs ever put together -- 132 classics!
    <LI>Original hits by the original artists!
    Now i need to remove the tags before displaying this on the output. Is there a simple way to do this.
    Thanks...

    Did you read the documentation of the trim() method,
    where it describes which whitespace it removes?I believe his problem is that
    "Some text here  
    <blah> 
    More text"becomes
    "Some text here  
    More text"... and he wants ...
    "Some text here
    More text"So, your problem is that your regex isn't matching whitespace as well.
    See the "Trimming Whitespace" section:
    http://www.regular-expressions.info/examples.html

  • 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.

  • Parse out the contents of meta tag using HTML.Tag

    I need help with using the HTML.Tag class. I don't even know where to start...
    I want to make a method that allows me to pass in a very long string and the NAME of the meta tag.. and will return the contents of the meta tag.. any help will be super..
    sorry i do not have much of a code base to start with.. I am just guessing on how to get this to work..
    private String getMetatag(String content,String Metaname)
    String Metacontents;
    Object HTML.Tag.META;
    Object HTML.Attribute.NAME.Metaname;
         Object HTML.Attribute.CONTENT;
    return Metacontents;
    }

    One of the way to get started is to check out how to overide (extend) the class
    HTMLEditorKit.ParserCallback.. Lets say the class is called class A
    Overide the methods for
    HandleSImpleTags( HTML.Tag t, AttributeSet attribute, int pos) { }
    roughly, the implemenation in that method is like this:
    HandleSImpleTags( HTML.Tag t, AttributeSet attribute, int pos) {
    if(t.equals(HTML.Tag.META) {
    /// your procedure, what to do when encounter META tag
    // String str = (String) attribute.getAttribute(HTML.Attribute.NAME);
    // System.out.println(str);
    You would still need to find some detail examples on how to use class A .
    Roughly it is,
    parser.parse(inputstream, an_instance of_class_A, true); // method in a outer class like a main class
    parser is a instatiation of from the method getParser. This method need to be overidden as well.

  • Struts portlet Instance Label problem: Appending the html tags in jsp

    I have created a struts portlet and given it a Instance Label. I have used struts-adapter-html.tld tld in my jsp which is referenced by my struts portlet. But the problem with using this taglib is that the portlet Instance Label is appended to all the html tags on the JSP as a result of which when the page is submitted, formbean will not pick any of the values as the name will not match. Has anyone has faced this kind of problem? How can I prevent the appending of the HTML tags with the portlet Instance Label?
    Please help me overcome this problem..
    Thanks in Advance ...

    1. To begin with, I would not recommend NOT to append portlet instance label to html tags. This is very much required. Take atleast 2 scenarios. If you dropped 2 instances for Same Portlet like News/Articles portlet etc on same page, you need to identify the html fields uniquely for each portlet so that backend java code works properly. Also if you have 2 different portlets assuming you did not give any name to form tag, and if you have html tags with same name, you need to identify them. Remember when portal or desktop is rendered, it is one big html file with html fragmetns from all .portlets files. So I am not sure if there is any option at all, to avoid the appending of instance label value to html tags.
    2. Coming to your usecase, I did had this problem once in 8.1 SPxx long back. All we did was, in the back end code, using BackingFile we could get the intance label value of the portlet. We can get this in pageflow also. Then pass this value and manually append this value to the html field of interest. In your case looks like you have Struts and tld tags. See somehow if you can get portlet instance label in jsp file and pass around to your tag lib code in request parameters etc. This is just one idea. I am not fully aware of your code, so try something along these lines.
    HTH
    Ravi Jegga

  • Embed HTML tag inside XSLT to generate email content

    I want to Embed HTML tag inside XSLT to generate email content .
    XSLT is not working in Jdeveloper , when i use the syntax <xsl:output method="html" indent="yes" version="1.0"/> in transformation activity .
    Can anyone help to resolve the issue .

    in the <xsl:template match=""/> element you can just start with creating your html document
    so for example
         <xsl:template match="/">
              <html>
    the graphical mapper itself won't i think but when you test the xsl it will still procedure a html document, we use it too to generate the email body contents

  • Struts bean/html tag problem

    i am writing this url_element on screen
    <bean:write name="url_element"/>
    then i got a link
    <html:link action="urlDetail.do?url=???">aaa</html:link>
    how can i transfer the url_element into ??? do i need to write something like <%...%>?

    just found the solution:
    You can't use a <bean:write> tag inside an <html:link> tag. Struts doesn't support it.
    The easiest way to fix this is to abandon use of <html:link> and just use the plain old html tags <a></a>. Then you will have no problem substituting parameters with <bean:write> tags.
    The only advantage <html:link> has over the plain html tag is that it automatically does URL rewriting (Adding of the jsessionid to the URL so that sessions may be tracked even if the user has turned cookies off). If you're not using this function anyway, as most modern websites don't, you may as well use the html tag.
    If you still want to use <html:link>, use the struts-el version of the html tags and use EL expressions instead of <bean:write> tags.

  • Help~ Get Tag content from input HTML file

    I would like to build an index with the Tag content of the input HTML file.
    Is there any convenient way to retrieve such Tag information?
    Thanks

    http://onesearch.sun.com/search/onesearch/index.jsp?qt=html+parser&subCat=&site=dev&dftab=&chooseCat=javaall&col=developer-forums

  • Html Tag Problem

    Hello, I have a web page.
    <body  class="mediawiki ns-0 ltr page-Hacker">
         <div id="globalWrapper">
              <div id="column-content">
         <div id="content">
              <a name="top" id="top"></a>
                        <h1 class="firstHeading">Hacker</h1>
              <div id="bodyContent">
         ...I want to replace the lines with new lines which are added id
    <body  id="1" class="mediawiki ns-0 ltr page-Hacker">
         <div id="globalWrapper">
              <div id="column-content">
         <div id="content">
              <a id="2"name="top" id="top"></a>
                        <h1 id="3" class="firstHeading">Hacker</h1>
              <div id="bodyContent">
         Every line must have an id in the tag, I am not familar with html.tag or parser.
    Could you please provide some hint?
    Regards!

    public class AddIds  extends HTMLEditorKit.ParserCallback{
      public void handleStartTag(HTML.Tag t, MutableAttributeSet a, int pos){
        ... // write the edited line out
    }

Maybe you are looking for

  • How to check a checkbox field value in fw9 PDF form

    Hi, I got a PDF given form IRS (http://www.irs.gov/pub/irs-pdf/fw9.pdf). While creating a widget to this pdf form to sign it, I merged the custum data to those PDF form fields using API setMergeFields. All the data fields are merged fine except the c

  • Calling Java from Delphi

    Can ActiveX bridge used for calling Java from Delphi?

  • Command line printing - PDF to Postscript

    I wish to convert a PDF file to postscript using the windows command line suppressing all messages. Example: Acrord32.exe samplepdf.pdf c:\output\samplepdf.ps Are there any command line options to perform this conversion? Many thanks.

  • Grid control with combo cell

    Does Anybody have some information about grid control/oracleSpreadTable with combo list instead of text cell. Please help!! null

  • Abap url not found returncode

    Hey, i need a Function or Method to open an url from ABAP with a returncode not found. At time i use  CL_GUI_FRONTEND_SERVICES=>EXECUTE This function also has the Exception 'File_not_fond', but even if the File is not found, i get the sy-subrc 0. Has