Display XML

Hi,
I have XML file in a string and i need to display it in a text box, how to do it Positioning all tags?
Thanks,
Priscila Pereira.

Hi,
Try this way.
data xml type string.
data xml_document type ref to cl_xml_document.
data subrc type sysubrc.
  xml = '<?xml version="1.0" encoding="utf-16"?><a>123</a>'.
  "Instatiate the cl_xml_document object
  create object xml_document.
  "Send XML to method parse_string from class cl_xml_document
  subrc = xml_document->parse_string( xml ).
  "Finally display all XML with Tag using method display that organize Tags itself
  xml_document->display( ).
Regards,
Marcelo Ramos

Similar Messages

  • Displaying XML Document in new browser window

    Hi,
    I have a hyperlink on my page. When I click on it, it will open a new IE window and display xml document.
    The new window is displaying some of the xml and at the end displaying the following:
    The XML page cannot be displayed
    Cannot view XML input using XSL style sheet. Please correct the error and then click the Refresh button, or try again later.
    End element was missing the character '>'. Error processing resource 'http://localhost:28080/benchmark/faces/displayXMLDocu...
    However, I cut and paste the xml String where I write it to the HTTPServletResponse to XMLSPY and it displays correctly.
    Please let me know.
    Rgrds

    Here are the steps:
    1. I created page1 that has a hyperlink.
    2. Hyperlink property are set to display page2 in a new window. (popup).
    3. page2.prerender() method, I set the response to the following:
    public void prerender() {
    javax.faces.context.ExternalContext ec = this.getExternalContext();
    HttpServletResponse response = (HttpServletResponse)ec.getResponse();
    response.setHeader("Cache-Control","no-cache");
    response.setHeader("Cache-Control","no-store");
    response.setHeader("Cache-Control","must-revalidate");
    response.setHeader("Cache-Control","max-age=0");
    response.setHeader("Pragma","no-cache");
    response.setHeader("Expires","0");
    response.setContentType("text/xml");
    response.setBufferSize(5000);
    String xmlString = getRequestBean1().getBookingPnrDetailsXML();
    try{
    xmlString="<?xml version=\"1.0\" encoding=\"UTF-8\"?><root><test1>this is a test</test1><victor>Hello Victor</victor></root>";
    PrintWriter out = new PrintWriter(response.getOutputStream());
    log(xmlString);
    out.print(xmlString);
    }catch(IOException io){
    System.out.println("" + io.getMessage());
    io.printStackTrace();
    4.page2.jsp code is the following:
    <?xml version="1.0" encoding="UTF-8"?>
    <jsp:root version="1.2" xmlns:f="http://java.sun.com/jsf/core" xmlns:h="http://java.sun.com/jsf/html" xmlns:jsp="http://java.sun.com/JSP/Page" xmlns:ui="http://www.sun.com/web/ui">
    <jsp:directive.page contentType="text/xml;charset=UTF-8" pageEncoding="UTF-8"/>
    <f:view/>
    <ui:page binding="#{displayXMLDocument.page1}" id="page1"/>
    <ui:html binding="#{displayXMLDocument.html1}" id="html1"/>
    <ui:head binding="#{displayXMLDocument.head1}" id="head1"/>
    <ui:link binding="#{displayXMLDocument.link1}" id="link1"/>
    <ui:body binding="#{displayXMLDocument.body1}" id="body1"/>
    <ui:form binding="#{displayXMLDocument.form1}" id="form1"/>
    </jsp:root>
    please let me know.
    Rgrds.

  • IE + SVG = "Cannot display XML page" ?

    Dear friends,
       I am from Taiwan.  I have a question about SVG display on IE. 
       I have a very simply SVG file as the following code.  I installed Ferdora R12 with apache web server (192.168.0.8) inside my company.
    I installed Tomcat 6.0 on my PC(192.168.0.100, window 7 with IE8.0).  I put this SVG file on Fedora, and I can see the vector graphs through
    Chrome and Firefox, but not IE(already installed SVG viewer, with the error message as following).  I put this SVG file on my PC, I can see the vector graphs by IE, Chrome and Firefox through Tomcat or opening file directly. I even put this SVG file on the web server of my company, and vector graphs can be displayed well through all of IE, Chrome and Firefox.
      The problem seems only happen in the situation "Fedora R12 + IE".  Do you have any idea of this problem?  I really need your help.
      Thank you.
    ======= Code =============
    <?xml version="1.0" encoding="UTF-8" standalone="no"?>
    <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.//EN"
    "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
    <svg id="svg00" version="1.1" xmlns="http://www.w3.org/2000/svg" >
    <svg id="svg01" x="0" y="0" width="654.1" height="654.1" version="1.1" xmlns="http://www.w3.org/2000/svg"
    xmlns:xlink="http://www.w3.org/1999/xlink">
        <a xlink:href="http://www.w3.org//Graphics//SVG//Overview.htm8">
            <rect x="10" y="10" width="100" height="30" rx="10" ry="10"
                  style="fill:lightgrey"/>
            <text x="30" y="30" font-size="12">Click here</text>
        </a>
        <a xlink:href="http://www.ibm.com//developerworks/">
            <circle cx="100" cy="100" r="50" style="fill:grey"/>
            <text x="80" y="100" font-size="12">Or here</text>
        </a>
        <a xlink:href="http://www.ibm.com/" target="new">
            <polygon
                  points="60 160,165 172,180 60,290 290,272 280,172 285,250 255"
                  style="fill:dimgrey"/>
            <text x="160" y="200" font-size="12">Or even here</text>
        </a>
    </svg>
    </svg>
    ==========================
    The error message is in Chinese, but I translate it as possible as I can.
    ====== Error message ==========
    Cannot display XML page
    Cannot use style table (or form) to view XML input. Please correct this problem and reload this page, or try again later.
    Unidentified error with processing resourse
    There is something wrong with 'http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd'
    =============================

    Hi,
    The string is not correctly formed ( a quote and a concatenation ) :
    Your url :
    v_url:=nvl(v_rep_port,'http://'||v_rep_HOST ||':'||v_rep_port||')||'/reports/rwservlet/getjobid'||substr(v_rep,instr(v_rep,'_',-1)+1)||'?'||'server='||v_rep_svr;
    The Correction :
    v_url:=nvl(v_rep_port,'http://'||v_rep_HOST ||':'||v_rep_port)||'/reports/rwservlet/getjobid'||substr(v_rep,instr(v_rep,'_',-1)+1)||'?'||'server='||v_rep_svr;
    Hope it helps
    Mohamed Dadi

  • How to display XML file that XI sent to my j2ee appl?

    Hi,
    In my scenario File->XI->J2EE appl.
    I got XML page cannot be displayed.
    XML document must have a top level element. Error processing resource 'http://localhost:7001/Invoke/DisplayRes'.
    I deployed my .ear file on BEA Weblogic application server9.0
    I found no error when i tested in SXI_MONI and RWB->Message monitor as well.
    This is my servlet code:
    public class DisplayRes extends HttpServlet {
         public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
         doPost(request,response);
         public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
         BufferedReader brin =new BufferedReader(new InputStreamReader(request.getInputStream()));
         String inputLine;
         StringBuffer sBuf = new StringBuffer();
         PrintWriter out = response.getWriter();
         response.setContentType("text/xml");
         while ((inputLine = brin.readLine()) != null)
             sBuf.append(inputLine);       
             //out.setContentType("text/xml");
             //out.println(sBuf.toString());
             out.write(sBuf.toString());
              brin.close();
             out.flush();
    What went wrong.All helpful answers are highly rewarded.
    Thanks

    Hi
    Can anyone tell me how XI sends messages to applications like J2EE. In REceiver comm channel, I think we specify about the target system like J2EE appl.
    Aadapter Type: HTTP
                   Receiver
    Transport Protocol:  HTTP1.0
    Message Protocol:    XI payload in HTTP body
    Adapter Engine:      Integration Server
    Addressing Type:     URL address
    Target host:         localhost
    Service Number:      7001(Port number of Weblogic appl server--where my J2EE appl is deployed).
    Path     :  /Invoke/DisplayRes/
    Authentication Type:Use Logon Data for SAP System
    Content Type: text/xml
    Username:   xiappluser
    password:   xx
    XML code:   UTF-8
    I suppose XI sends msgs to http://localhost:7001/Invoke/DisplayRes/........
    in this example if am correct?
    Then I have given all tyhe necessary setting but my servlet is not able to display XML msg in browser?
    This is my servlet code:
    public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
         PrintWriter out = response.getWriter();
         BufferedReader brin =new BufferedReader(new InputStreamReader(request.getInputStream()));
         String inputLine;
         StringBuffer sBuf = new StringBuffer();
            response.setContentType("text/xml");
         while ((inputLine = brin.readLine()) != null)
             sBuf.append(inputLine);
             out.println("hi");            
                out.println(sBuf.toString());
             brin.close();
             out.flush();
    What went wrong?
    Help me, all helpful answers are highly rewarded.
    Thanks

  • Not able to display XML file

    I'm running Safari 6.0.2. And previous to a recent update I was able to drag a XML file into the browser and it would display the contents. Now it does nothing. I'm guessing with the last update it removed an extension that used to allow this to happen. Can anyone suggest a good XML display extention they've had good luck with.
    Thanks!

    The only browser I am aware of that currently knows how to
    display XML is IE5. Otherwise, you will need to convert the XML
    into well-formed HTML or xHTML through and XSLT stylesheet.
    Oracle XML Team
    http://technet.oracle.com
    Oracle Technology Network
    Ravinder Kamal (guest) wrote:
    : I not able to display the XML file in my browser even after
    using
    : using an XSL Stylesheet. I am not using IE5 browser.
    : The output of command :
    : C\>java XSLSample iden.xsl empl.xml
    : <root>
    : <ROWSET>
    : <ROW num="1">
    : <EMP_ID>PMA42628M</EMP_ID>
    : <FNAME>Paolo</FNAME>
    : <MINIT>M</MINIT>
    : <LNAME>Accorti</LNAME>
    : <JOB_ID>13</JOB_ID>
    : <JOB_LVL>35</JOB_LVL>
    : <PUB_ID>0877</PUB_ID>
    : <HIRE_DATE>1992-08-27 00:00:00.0</HIRE_DATE>
    : </ROW>
    : </root>
    : where iden.xsl is :-
    : <?xml version="1.0"?>
    : <!-- Identity transformation -->
    : <xsl:stylesheet
    xmlns:xsl="http://www.w3.org/XSL/Transform/1.0">
    : <xsl:template match="*|@*|comment()|pi()|text()">
    : <xsl:copy>
    : <xsl:apply-templates
    : select="*|@*|comment()|pi()|text()"/>
    : </xsl:copy>
    : </xsl:template>
    : </xsl:stylesheet>
    : -R.S.Kamal
    null

  • Problem with displaying XML Content well formatted.

    Hi all,
    I am developing a website which have one functionality to display XML content which is received from some other party.
    I am using TextArea for displaying this XML content on my webpage. As this XML content is not at all formatted it looks very ugly for a human to read.
    I want this XML content to be displayed well formatted, As Mozilla Firefox display it hierarchically and well formatted.
    Kindly give some suggestion for displaying XML well formatted on a webpage.
    Any comments from you people will help me.
    Thanks
    typurohit.

    The following link is a XML-based document. An XSL stylesheet transforms the XML document to HTML in the web browser. Feel free to grab a copy of the stylesheet to use as a guide.
    http://www.masonicartbook.com/production.htm
    Good luck!

  • How to fix iframe issue that displays XML values instead of formatted XML in IE11

    The following sub.jsp file shows the formatted XML properly as expected when is opened directly:
    <% response.setContentType("text/xml"); %>
    <book>
    <chapter1>chapter 1</chapter1>
    <chapter2>chapter 2</chapter2>
    </book>
    IE11 shows the result as below which are colored and can be collapsed or un-collapsed:
    <book><chapter1>chapter 1</chapter1><chapter2>chapter 2</chapter2></book>
    But if the sub.jsp is opened in an iframe from the below main.html, it only shows the values of the XML in the iframe:
    <!DOCTYPE html>
    <html>
    <head>
    <meta charset="ISO-8859-1">
    <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
    <title>Insert title here</title>
    </head>
    <body>
    <iframe src="sub.jsp"></iframe>
    </body>
    </html>
    The iframe shows only the XML values, i.e., chapter 1 chapter 2 in IE11. This issue does not happen in IE8.
    I appreciate to your if you know how to address this issue.
    Regards, Amir

    The following sub.jsp file shows the formatted XML properly as expected when is opened directly:
    <% response.setContentType("text/xml"); %>
    <book>
    <chapter1>chapter 1</chapter1>
    <chapter2>chapter 2</chapter2>
    </book>
    IE11 shows the result as below which are colored and can be collapsed or un-collapsed:
    <book><chapter1>chapter 1</chapter1><chapter2>chapter 2</chapter2></book>
    But if the sub.jsp is opened in an iframe from the below main.html, it only shows the values of the XML in the iframe:
    <!DOCTYPE html>
    <html>
    <head>
    <meta charset="ISO-8859-1">
    <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
    <title>Insert title here</title>
    </head>
    <body>
    <iframe src="sub.jsp"></iframe>
    </body>
    </html>
    The iframe shows only the XML values, i.e., chapter 1 chapter 2 in IE11. This issue does not happen in IE8.
    I appreciate to your if you know how to address this issue.
    This issue is also posted at below link:
    https://social.msdn.microsoft.com/Forums/en-US/5b0692b4-d312-4797-9089-42c1029ac059/how-to-fix-iframe-issue-that-displays-xml-values-instead-of-formatted-xml-in-ie11?forum=iewebdevelopment
    Regards, Amir

  • Displaying XML with JDeveloper

    Using JDev 10.1.3 for an ADF + Struts application,
    What is the smartest way of displaying XML documents, with different XML formats/structure, stored in a CLOB field of a database.
    I have already .xslt stylesheets for each different type of XML file; I plan to have this .xslt files as other column in the database.
    I would like to know how to incorporate this xslt on my project and specially how to use it when displaying the information XML/CLOB to the user?
    Any samples, ideas, url, etcx will be welcome.
    Thanks,
    OM

    i don't know if oracle has a product for this but they would have to plan one to embed in JDeveloper.
    i'm using authentic from altova that permit you to define entry helpers based on a xml schema to edit a document and to render it in html, rtf or pdf. I think it is possible to embed it in a java or web application. The best way is to ask altova support. For sure other similar solutions exists also.

  • How to display XML content in a JSP

    Hi,
    can anyone help me in displaying xml content in a JSP?

    I think you want to display value from XML page to the
    JSP.If thats the case you can try out this
    xml...
    <component-profile>
            <property name="parm" value="Hi"/>
    </component-profile>
    jsp...
    <% var=profile.getProperty("parm");%>
    Hope this helps
    gEorgE

  • Displaying XML documents in WebDynpro ABAP

    Hi
    I want to display XML documents in Web Dynpro. My requirement is that, in a Web Dynpro application(ABAP), On the click of a button, I generate an XML file, which I need to display.
    I know that XML document can be created as a MIME object. But can this object be created on the fly? OR can the contents of this document be changed dynamically. If so, any pointers on how to create such a MIME object and proceed further?
    OR
    Can the browser be launched on the fly with the dynamically created XML content?
    Thanks and Regards
    Wenonah

    Hi Wenonah,
    see this little example which creates a xml file to download and open in the browser. Put it in an action handler method.
    DATA lr_conv   TYPE REF TO cl_abap_conv_out_ce.
      DATA lv_data   TYPE        string.
      DATA lv_xfile  TYPE        xstring.
      lv_data = '<?xml version=1.0" encoding="utf-8"?> put your xml here'.
      cl_abap_conv_out_ce=>create( RECEIVING conv = lr_conv ).
      lr_conv->convert( EXPORTING data   = lv_data
            IMPORTING buffer = lv_xfile ).
      cl_wd_runtime_services=>attach_file_to_response(
                     EXPORTING
                         i_filename  = 'test.xml'
                         i_content   = lv_xfile
                         i_mime_type = 'application/xml' ).
    Hope it helps.
    regards, Ulli

  • How to display xml to html using xsl?

    hi all...may i know how to display xml to html page?
    i ve included <xsl:output method="html" indent="yes" /> inside my xsl file. i clicked on output.xml file and everything is displayed correctly but the format is xml instead of html. is there anyway to transform it to html?
    below are my xsl and xml codes:
    // xsl file
    <?xml version='1.0'?>
    <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
    <xsl:output method="html" indent="yes" />
    <xsl:template match="/">
    <html>
    <body>
    <h2>Document Contents</h2>
    <table border="1">
    <tr bgcolor="#9acd32">
         <th align="center">Document Name</th>     
         <th align="center">Document ID</th>          
         <th align="center">Owner</th>               
    </tr>
    <xsl:for-each select="Document/Contents">
    <tr>
    <td><xsl:value-of select="DocumentName"/></td>
    <td><xsl:value-of select="DocumentID"/></td>
    <td><xsl:value-of select="Originator"/></td>
    </tr>
    </xsl:for-each>
    </table>
    </body>
    </html>
    // xml file
    <?xml version="1.0"?>
    <?xml-stylesheet type="text/xsl" href="xsltStyleSheet.xsl"?>
    <Document>
         <Contents>
              <DocumentName>register</DocumentName>
              <DocumentID>1</DocumentID>
              <Originator>hhh</Originator>
         </Contents>
    </Document>
    </xsl:template></xsl:stylesheet>

    your XSL transforms to HTML (in fact XHTML): what more do you expect? did you expected anything different from the following output? if yes: what and why?
    <html>
         <body>
              <h2>Document Contents</h2>
              <table border="1">
                   <tr bgcolor="#9acd32">
                        <th align="center">Document Name</th>
                        <th align="center">Document ID</th>
                        <th align="center">Owner</th>
                   </tr>
                   <tr>
                        <td>register</td>
                        <td>1</td>
                        <td>hhh</td>
                   </tr>
              </table>
         </body>
    </html>

  • How to Display XML in a UIWebView?

    Hi everybody. I like how Safari displays XML files and I would like to emulate that functionality in an iPhone UIWebView. However, I just can't get it to look the same when passing a URL to the UIWebView.
    For example, take a simple XML file like http://molottery.com/rss-num.xml. Viewing that in Safari looks okay, but passing that same URL into a UIWebView just shows a blank page.
    I changed the web protocol from http to feed (feed://molottery.com/rss-num.xml) and it launches the page in Safari instead of my UIWebView. Looks good, but it quit my app... :- (
    I noticed that XML files on the iPhone get re-routed through reader.mac.com so I tried appending that to my URL (http://reader.mac.com/mobile/v1/http://molottery.com/rss-num.xml) but that did not work either.
    When I tried URLEncoding the string like Safari does (http://reader.mac.com/mobile/v1/http%3A%2F%2Fmolottery.com%2Frss-num.xml) I get a UIWebView saying that "This Application Is Viewable Only On iPhone".
    So how can I emulate the regular Safari XML functionality inside my UIWebView? I will post my code upon request, if that will help. Any assistance from the Developer Community would be greatly appreciated.
    Thanks!

    You may have better luck in the iPhone dev forums...
    https://devforums.apple.com/community/iphone/web

  • How to display Xml in a JEditorPane(in an applet)

    Hi All,
    I have an applet and i want to display xml in a JEditorPane in an applet. This xml document has a xsl attached to it for transformation. How can i do the transformation??
    Help or sample code or link to a sample code is highly appreciated!!!!
    Thanks
    Ragu

    Look this servlet which does a transformation. JEditorPane could call this servlet (with the method setPage) to do the transformation:
    public class SampleXSLTServlet extends javax.servlet.http.HttpServlet {
    public final static String FS = System.getProperty("file.separator");
    // Respond to HTTP GET requests from browsers.
    public void doGet (javax.servlet.http.HttpServletRequest request,
    javax.servlet.http.HttpServletResponse response)
    throws javax.servlet.ServletException, java.io.IOException
    // Set content type for HTML.
    response.setContentType("text/html; charset=UTF-8");
    // Output goes to the response PrintWriter.
    java.io.PrintWriter out = response.getWriter());
    try
    javax.xml.transform.TransformerFactory tFactory =
    javax.xml.transform.TransformerFactory.newInstance();
    //get the real path for xml and xsl files.
    String ctx = getServletContext().getRealPath("") + FS;
    // Get the XML input document and the stylesheet, both in the servlet
    // engine document directory.
    javax.xml.transform.Source xmlSource =
    new javax.xml.transform.stream.StreamSource
    (new java.net.URL("file", "", ctx+"foo.xml").openStream());
    javax.xml.transform.Source xslSource =
    new javax.xml.transform.stream.StreamSource
    (new java.net.URL("file", "", ctx+"foo.xsl").openStream());
    // Generate the transformer.
    javax.xml.transform.Transformer transformer =
    tFactory.newTransformer(xslSource);
    // Perform the transformation, sending the output to the response.
    transformer.transform(xmlSource,
    new javax.xml.transform.stream.StreamResult(out));
    // If an Exception occurs, return the error to the client.
    catch (Exception e)
    out.write(e.getMessage());
    e.printStackTrace(out);
    // Close the PrintWriter.
    out.close();

  • How to display XML file in java swing

    hi all
    now i do my M.Sc., project on data maining.this time i have one problem,thats i can't display XML file in swing frame.so any one know this plz give me that idea or code.
    Thanks to all.
    RSK

    One way of doing that is to use JDOM...
    u create an xml tree, and then output using XMLOutputter class...it will be displayed in text...im not sure if thats what u want...however, if u do want to represent it visually then u may need to draw a tree...u may use the Graphics2D for that...there are alot of ways to do such thing, and the 2 possibilities arent the best...depends on what u want...elaborate more pls.

  • What is this display XML format

    If we go to ID..
    in communication channel--> go to menu-> communication channel---> Display XML format
    what is that used for..

    Hi Amit...
    if you open a Communication channel....go to the menu of the communication channel...not the main menu.....
    probably u can see CHECK(F7) option in the menu...just below that it is mentioned...

  • Displaying XML w/ XSLT styling in Flash

    Hello -
    I have a file that is displaying .xml info in Flash. I styled the .xml document outside of flash w/ .xslt. It works fine outside of Flash but doesn't work when displayed inside of Flash- Is there a way to make this work ???
    Thanks

    No, there is no way to make it work natively. Also, Flash has very limited support for HTML tags and only for CSS.

Maybe you are looking for

  • IMessage no longer working on my mac desktop

    I have always used Messages on my desktop, iPad, and iPhone. Since my last upgrade to 10.10.2 I can no longer use Messages on my DESKTOP. All of my other devices are working fine. 1. Via my phone settings my DESKTOP does not show display as an option

  • External Hard Drive not in finder, but in Disk Utility, info gone? recover?

    My external hard drive shows up in disk utility, but not in finder. Usually, in disk utility, there will be visible the model/make of the hard drive (such as 232.8 GB MDT MD25...etc), and then below that, there be the actual name of the hard drive th

  • Saving and not able to view

    Hey looking for any sort of help or info someone has to help me out. I saved a bunch of jpg's png's gif's pdf's and html's all those files with those endings won't let me open or view them I saved them on a flash drive. If it helps at all there a lit

  • Plug ins not indicating presets/number

    Wondering if anyone may know what may be causing the preset selection on plug-ins not to show anymore. I'm getting this (_ _ _), instead of what used to be preset 01, 02, or 03 etc..... .I'm thinking maybe I need more ram, or the battery on my mac is

  • HT1926 Error when trying to install iTunes 'iTunesSetup.exe was reported as unsafe.'

    Get an error when trying to install iTunes 'iTunesSetup.exe was reported as unsafe.' Any suggestions for how to fix this? I am using Windows Vista and IE9.