How to generate xhtml from xml

Hi All
I've an application that will generate an xml file in this way:
FileWriter salidaxml = new FileWriter(new File("reporteHP.xml"));
DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
DocumentBuilder docBuilder = dbf.newDocumentBuilder();
Document doc = docBuilder.newDocument();
// Some nodes and elements added here
TransformerFactory transFact = TransformerFactory.newInstance();
Transformer trans = transFact.newTransformer();
trans.setOutputProperty(OutputKeys.INDENT, "yes");
trans.setOutputProperty(OutputKeys.METHOD, "xml");
trans.setOutputProperty(OutputKeys.ENCODING, "ISO-8859-1");
trans.setOutputProperty("{http://xml.apache.org/xslt}indent-amount", "4");
Result result = new StreamResult(salidaxml);     
try {               
    trans.transform(new DOMSource(doc), result);               
    transformer.transform(source, rslt);           
} catch (TransformerException te) {               
    System.out.println(te.getMessageAndLocation());               
throw te;           
salidaxml.flush();           
salidaxml.close();Code run ok but I want to know how could I add code to generate a xhtml file using a dtd and a xsl I've or at least how to add the following at the begin of the xml generated file:
<?xml-stylesheet type="text/xsl" href="reporte.xsl"?>Thanks in advance
<xl>

Hi
Thanks for your help but I really didn;t found what I'm lookin for in this page.
This page explains how xslt transform xml in xhtml. I know this point, I want to know HOW could I make it from my application. I guess there are a transform class that could generate html from a xsl template, but I couldn't find the way to do it and couldn't find examples too.
<xl>

Similar Messages

  • How To Generate Objects From XML and DTD?

    Are there tools to generate objects from dtd's and xml files?
    If this is not possible for some reason: is there a tool to generate classes from a dtd?
    I can not find the "XML Java Class Generator" (from oracle) anymore.

    XMLBeans
    There are other solutions, but I know this one is pretty good.

  • How to generate PDF from XML output without XML publisher

    Hi,
    I am facing a problem while splitting the rdf generated XML output.
    Problem Description:
    I have a oracle invoice report which runs once every day (scheduled program). This report fetches me the invoices generated on that day and needs to be Mailed / Faxed to the customers.
    So i developed the report in such a way that it generates the output order by customers...since the output generated will be as one .out file in APPLCSF/out directory...the .out file needs to be splitted by customers, for which i have written a cursor which takes the data of the main query and submits that many requests as many as customers are there.....There is a possibility of having 1000 customers per day also. If that is the case then my main program will fire that many requests.
    Is there a different approach......any inputs are highly appreciated.
    Also, i am generating the output in XML format. Is there a way from which i can directly generate a PDF from that XML output rather using any other tool.
    Thanks & Regards,
    Lakshmi Kalyan Vara Prasad.

    Hi,
    with Reports Bursting and the defined "distributions" it's possible to have one report splittet to several parts with different receipients. Have a look at http://download-uk.oracle.com/docs/cd/B14504_01/dl/bi/B13673_01/pbr_dist.htm.
    With xsl-fo it's possible to create pdf out of xml ... that's what xml publisher is doing.
    Regards
    Rainer

  • How to generate WSDL from XML Schema?

    What are reasonable strategies, both direct and indirect, to generate a WSDL from
    an XML Schema describing our messages? I'd prefer a more direct route, but I'd
    like to understand the various choices. We're currently using WLP8.1SP2.

    Hi David,
    There is a "start from schema" example that Manoj built [1] that could
    be a good choice for determining your development path.
    HTH,
    Bruce
    [1]
    http://manojc.com/?sample43
    David Karr wrote:
    >
    What are reasonable strategies, both direct and indirect, to generate a WSDL from
    an XML Schema describing our messages? I'd prefer a more direct route, but I'd
    like to understand the various choices. We're currently using WLP8.1SP2.

  • How to generate HTML from XML and XSL?

    Hi all,
    I am new to XML.
    Can I somehow see the HTML-Output of the XML-File, when I have the XSL-File too, but don't use any XML-Editor (XMLSpy) and FOP? I do not want use any additional tools - only the database tools.
    What I need for this?
    Do I need the XSLT-File too?
    I am waiting for your answers, when possible with examples please.
    Regards
    Leonid Pavlov

    Please post on the General XML forum.

  • How to retrieve value from xml file

    hi all,
    can somebody pls tell me how to retrieve value from xml file using SAXParser.
    I want to retrieve value of only one tag and have to perform some validation with that value.
    it's urgent .
    pls help me out
    thnx in adv.
    ritu

    hi shanu,
    the pbm is solved, now i m able to access XXX no. in action class & i m able to validate it. The only thing which i want to know is it ok to declare static ArrayList as i have done in this code. i mean will it affect the performance or functionality of the system.
    pls have a look at the following code snippet.
    public class XMLValidator {
    static ArrayList strXXX = new ArrayList();
    public void validate(){
    factory.setValidating(true);
    parser = factory.newSAXParser();
    //all factory code is here only
    parser.parse(xmlURI, new XMLErrorHandler());     
    public void setXXX(String pstrXXX){          
    strUpn.add(pstrXXX);
    public ArrayList getXXX(){
    return strXXX;
    class XMLErrorHandler extends DefaultHandler {
    String tagName = "";
    String tagValue = "";
    String applicationRefNo = "";
    String XXXValue ="";
    String XXXNo = "";          
    XMLValidator objXmlValidator = new XMLValidator();
    public void startElement(String uri, String name, String qName, Attributes atts) {
    tagName = qName;
    public void characters(char ch[], int start, int length) {
    if ("Reference".equals(tagName)) {
    tagValue = new String(ch, start, length).trim();
    if (tagValue.length() > 0) {
    RefNo = new String(ch, start, length);
    if ("XXX".equals(tagName)) {
    XXXValue = new String(ch, start, length).trim();
    if (XXXValue.length() > 0) {
    XXXNo = new String(ch, start, length);
    public void endElement(String uri, String localName, String qName) throws SAXException {                    
    if(qName.equalsIgnoreCase("XXX")) {     
    objXmlValidator.setXXX(XXXNo);
    thnx & Regards,
    ritu

  • Hi How to generate vendor specific XML files

    Hi all!
    This is satish. I have  aquestion as:
    <b>How to generate vendor specific XML</b> files for deploying in Web Application server like weblogic9.0
    Please help me!
    Thanks in advance!!!

    Hi Satish
    AFAIK there are nwds plugins where you can convert Weblogic / jboss specific were you can convert it in to  SAP Web AS specific descriptor files .
    you can find these here http://media.sdn.sap.com/html/submitted_docs/sap_j2ee_migration_kit_webpages/external_docs/SAP_J2EE_Migration_Plugin.zip
    I am afraid there are no such plugins avaialble. You have to do the conversion of these vendor specific file manually or you will have to search for eclipse plugins which can do this
    Hope this helps. please do not forget to reward points
    regards
    rajesh kr

  • How to remove Unicode from XML file

    I get following error when unmarshal xml:
    [java] org.xml.sax.SAXParseException: An invalid XML character (Unicode: 0x15) was found in the element content of the document.
    Anyone know how to remove Unicode from xml file? Can I remove the unicode by rebuild the file?
    Thanks

    These sort of error usually occur when you're using a different character encoding to read the file than the one you wrote it with. Perhaps if you were to post the problem section of the file and/or the code that created it in the first place.

  • How to extract data from XML file with JavaScript

    HI All
    I am new to this group.
    Can anybody help me regarding XML.
    I want to know How to extract data from XML file with JavaScript.
    And also how to use API for XML
    regards
    Nagaraju

    This is a Java forum.
    JavaScript is something entirely different than Java, even though the names are similar.
    Try another website with forums about JavaScript.
    For example here: http://www.webdeveloper.com/forum/forumdisplay.php?s=&forumid=3

  • Is there any util or ant build to generate xmlbeans from xml

    hi all
    is there any utility tools or ant build process that can generate xmlbeans from xml schema? thanks.

    exactly,
    here are some libraries which are open sources;
    http://java-source.net/open-source/pdf-libraries hope it's useful. :D

  • How do I generate HTML from XML & XSL using XSL Processor ?

    I want to generate a HTML from XML & XSL using XDK for C on
    linux-8i.
    I run the XSLSample well.
    But it only generate a XML from a XML & a XSL.
    Can any one give me some advise or sample code?

    Just use HTML tags instead of xml tags in your stylesheet, and
    you'll generate HTML instead.
    <xsl:stylesheet version="1.0"
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
      <xsl:template match="/">
        <html>
          <body>
            <xsl:for-each select="ROWSET">
              <table border="1" cellspacing="0">
                <xsl:for-each select="ROW">
                  <tr>
                    <td><xsl:value-of select="EMPNO"/></td>
                    <td><xsl:value-of select="ENAME"/></td>
                  </tr>
                </xsl:for-each>
              </table>
            </xsl:for-each>
          </body>
        </html>
      </xsl:template>
    </xsl:stylesheet>

  • How to retrieve data from XML

    I have a scenario where I need to read data from database of xmltype (data type)
    Table Structure :
    Create table Ex_Tb (id number(30),emp_data XMLType );
    I can save xml content in database,
    Sample
    insert into Ex_Tb values( 1, xmltype ('<?xml version="1.0" encoding="UTF-8" ?><userdata><uniqueid>54321</uniqueid><name>moorthi</name><age>25</age><city>Chennai</city></userdata>'));
    Data inserted .
    When retrieved from DB I see the data in the generated BO as given below:
    <?xml version="1.0" encoding="UTF-8" ?>
    <ExteOutputCollection xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://xmlns.oracle.com/pcbpel/adapter/db/Exte file:/C:/JDeveloper/mywork/Application1/Project1/xsd/Exte.xsd" xmlns="http://xmlns.oracle.com/pcbpel/adapter/db/Exte">
    <ExteOutput>
    <SDD_XML_REQ_DATA_GETCLOBVAL__><?xml version="1.0" encoding="UTF-8" ?><userdata><uniqueid>54321</uniqueid><name>moorthi</name><age>25</age><city>Chennai</city></userdata></SDD_XML_REQ_DATA_GETCLOBVAL__>
    </ExteOutput>
    </ExteOutputCollection>
    My Question :
    1. How to retrive values of individual tags contained within the embedded XML so that it can be mapped to a BO?
    Basically I would like to map uniqueId, name,age,city from xml to a BO.
    Rgds,
    Krishna

    Hi Krishna,
    I'm not sure but are you selecting the data from the XMLType column as given in the section Using XMLType in an SQL Statement in the below doc?
    http://docs.oracle.com/cd/B10500_01/appdev.920/a96620/xdb04cre.htm#1030582
    Regards,
    Neeraj Sehgal

  • How to remove indents from XML?

    I have a xml like this:
    <?xml version="1.0" encoding="UTF-8"?>
    <view>
         <help>
              <block>No.1</block>
              <device>USB</device>
         </help>     
    </view>
    How could I output the xml to :
    <?xml version="1.0" encoding="UTF-8"?><view><help><block>No.1</block>          <device>USB</device></help></view>
    The reason to output like this is to make the xml comparison passed.
    I use org.custommonkey.xmlunit.XMLTestCase.compareXML to compare two xml string, one from Java code, the other from C# code. Now, since there are new lines and whitespaces embedded in the Java generated XML, the comparison always failed. Is there any way to output the indent xml to the one string only?

    Try running the strings through something like this before comparing:
    String <stringname> = <stringname>.replaceAll("\\n|\\t|\\s|\\r", "");
    that should normalize them both to no spaces, tabs, newlines, carrage returns.

  • How to generate the following XML-Output?

    Hi all,
    I would like to generate the following XML-Output without defining any types or tables:
    <?xml version = '1.0'?>
    <DEPARTMENTS_EMPLOYEES>
    <DEPARTMENT NAME="ACCOUNTING">
    <DEPTNO>10</DEPTNO>
    <LOC>NEW YORK</LOC>
    <EMPLOYEES_OF_DEPARTMENT>
    <EMPNO>...</EMPNO>
    <ENAME>...</ENAME>
    </EMPLOYEES_OF_DEPARTMENT>
    </DEPARTMENT>
    <DEPARTMENT NAME="RESEARCH">
    <DEPTNO>20</DEPTNO>
    <LOC>DALLAS</LOC>
    <EMPLOYEES_OF_DEPARTMENT>
    </EMPLOYEES_OF_DEPARTMENT>
    </DEPARTMENT>
    </DEPARTMENTS_EMPLOYEES>
    Unfortunately the following SQL-Statement does not working:
    select xmlElement("DEPARTMENTS_EMPLOYEES",
    xmlAttributes(d.deptno as "DEPTNO"),
    xmlElement("DNAME", d.dname),
    xmlElement("LOC", d.loc),
    xmlElement("EMPLOYEES_OF_DEPARTMENT",
    (select xmlAgg(xmlElement("EMPLOYEE", xmlAttributes(e.empno as "EMPNO"), xmlForest(e.ename as "ENAME", e.job as "JOB", e.hiredate as "HIREDATE", e.sal as "SAL", e.comm as "COMM", m.empno as "MGRNO", m.ename as "MGRNAME" ) )
    from emp e, emp m
    where e.deptno = d.deptno
    and m.empno = e.mgr
    ) as XML
    from dept d;
    1. When I provide this statement with SQL*Plus
    (unfortunately 9.0.1.3.0) then I get the
    following output:
    XML()
    XMLTYPE()
    XMLTYPE()
    XMLTYPE()
    XMLTYPE()
    2. When I provide this statement with SQL Navigator
    4.3.0.456 then I get the following error:
    [1]: (Error): OCI-21560: argument 3 is null, invalid,
    or out of range
    3. When I execute the following PL/SQL-Code then I get
    the XML-Error message:
    DECLARE
    x CLOB;
    xmlstr VARCHAR2(32767);
    line VARCHAR2(2000);
    BEGIN
    x := dbms_xmlquery.getxml('select xmlElement("DEPARTMENT",
    xmlAttributes(d.deptno as "DEPTNO"),
    xmlElement("DNAME", d.dname),
    xmlElement("LOC", d.loc),
    xmlElement("EMPLOYEELIST",
    (select xmlAgg(xmlElement("EMPLOYEE",
    xmlAttributes(e.empno as "EMPNO"),
    xmlForest(e.ename as "ENAME",
    e.job as "JOB",
    e.hiredate as "HIREDATE",
    e.sal as "SAL",
    e.comm as "COMM",
    m.empno as "MGRNO",
    m.ename as "MGRNAME"
    from emp e, emp m
    where e.deptno = d.deptno
    and m.empno = e.mgr
    ) as XML
    from dept d');
    xmlstr := dbms_lob.SUBSTR(x,32767);
    LOOP
    EXIT WHEN xmlstr IS NULL;
    line := SUBSTR(xmlstr,1,INSTR(xmlstr,CHR(10))-1);
    DBMS_OUTPUT.PUT_LINE(line);
    xmlstr := SUBSTR(xmlstr,INSTR(xmlstr,CHR(10))+1);
    END LOOP;
    END;
    <?xml version = '1.0'?>
    <ERROR>oracle.xml.sql.OracleXMLSQLException: Unimplemented Feature</ERROR>
    4. When I provide the following PL/SQL-Code then I get the same xml-error:
    DECLARE
    x CLOB;
    xmlstr VARCHAR2(32767);
    line VARCHAR2(2000);
    BEGIN
    x := dbms_xmlquery.getxml('select xmlElement("SYSDATE", xmlElement("Datum", to_char(sysdate,''DD.MM.YYYY'')),
    xmlElement("Zeit", to_char(sysdate,''HH24:MI:SS''))) as XML
    from dual');
    xmlstr := dbms_lob.SUBSTR(x,32767);
    LOOP
    EXIT WHEN xmlstr IS NULL;
    line := SUBSTR(xmlstr,1,INSTR(xmlstr,CHR(10))-1);
    DBMS_OUTPUT.PUT_LINE(line);
    xmlstr := SUBSTR(xmlstr,INSTR(xmlstr,CHR(10))+1);
    END LOOP;
    END;
    <?xml version = '1.0'?>
    <ERROR>oracle.xml.sql.OracleXMLSQLException: Unimplemented Feature</ERROR>
    Can I generate the needed XML-Output from Database with SQL or PL/SQL?
    Can anybody help me?
    Regards
    Leonid Pavlov

    I have this done with:
    DECLARE
    qryCtx DBMS_XMLGEN.ctxHandle;
    result CLOB;
    xmlstr VARCHAR2(32767);
    line VARCHAR2(2000);
    BEGIN
    qryCtx := dbms_xmlquery.newContext('select deptno, dname, loc, cursor(select e.empno, e.ename, e.job,
    to_char(e.hiredate,''DD.MM.YYYY'') hiredate, e.sal, e.comm,
    m.empno MGRNO, m.ename MGRNAME
    from emp e, emp m
    where e.deptno = dept.deptno
    and m.empno(+) = e.mgr) emp
    from dept');
    dbms_xmlquery.useNullAttributeIndicator(qryCtx, FALSE);
    dbms_xmlquery.setRowsetTag(qryCtx, 'DEPARTMENTS_EMPLOYEES');
    dbms_xmlquery.setrowtag(qryCtx, 'DEPARTMENT');
    DBMS_XMLQuery.setRowIdAttrName(qryCtx, 'ID');
    DBMS_XMLQuery.setRowIdAttrValue(qryCtx, 'DEPTNO');
    -- dbms_xmlquery.setrowidattrname(qryCtx, NULL);
    result := dbms_xmlquery.getXML(qryCtx);
    DBMS_XMLQuery.closeContext(qryCtx);
    xmlstr := dbms_lob.SUBSTR(result,32767);
    LOOP
    EXIT WHEN xmlstr IS NULL;
    line := SUBSTR(xmlstr,1,INSTR(xmlstr,CHR(10))-1);
    DBMS_OUTPUT.PUT_LINE(line);
    xmlstr := SUBSTR(xmlstr,INSTR(xmlstr,CHR(10))+1);
    END LOOP;
    END;
    But how can I rename the <EMP>-Element to Employees?

  • Generate HTML from XML and XSLT

    Hi,
    I have asked in different forum but did not get my answer so asking here again
    i want to generate a HTML file from XML and XSLT in a temp folder and then read it into a java.lang.String, so can email it or write to a database file.
    how can i do it, is there any engine which will merger XML and XSLT and give a HTML file or a String as output
    Ashish

    Hi,
    Follow the simple steps.
    1) Create XML Document (I hope u have it)
    2) Create XSL Stylesheet for your XML document
    3) Put both files in one directory some where in your local system or web server upto u
    4) Invoke the XML document from webbrowser and you are done.
    http://localhost/test/Catalog.xml OR C:\XXXXDIR\test\Catalog.xml
    For Ex: XML File Content, Catalog.xml
    <?xml version="1.0" encoding="ISO-8859-1"?>
    <?xml-stylesheet type="text/xsl" href="Catalog.xsl"?>
    <catalog>
    <cd>
    <title>Empire Burlesque</title>
    <artist>Bob Dylan</artist>
    <country>USA</country>
    <company>Columbia</company>
    <price>10.90</price>
    <year>1985</year>
    </cd>
    </catalog>
    XSL File Content: Catalog.xsl
    <?xml version="1.0" encoding="ISO-8859-1"?><xsl:stylesheet version="1.0"
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"><xsl:template match="/">
    <html>
    <body>
    <h2>My CD Collection</h2>
    <table border="1">
    <tr bgcolor="#9acd32">
    <th align="left">Title</th>
    <th align="left">Artist</th>
    </tr>
    <xsl:for-each select="catalog/cd">
    <tr>
    <td><xsl:value-of select="title"/></td>
    <td><xsl:value-of select="artist"/></td>
    </tr>
    </xsl:for-each>
    </table>
    </body>
    </html>
    </xsl:template></xsl:stylesheet>

Maybe you are looking for

  • Delta buffer query in RSRT for BI-IP (" infoprovider /!!1 infoprovider )

    Hello People, I have an input ready query over an aggregation level of a real time cube. Whenever the yellow request is closed and a new request is opened, the input ready query does not show the old data. And sometimes it shows incorrect data. We fo

  • APSE 10 START PROBLEM

    HI I HAVE PROBLEM WITH MY APSE 10,AFTER CLICKING ADOBE ICON ON MY PULPIT DONT RESPOND,ONCE COMPUTER IS RESTARTED WORKING WITHOUT PROBLEM TILL NEXT TIME WHAT CAN I DOO PLEASE FOR HELP PS MY LAPTOP IS HP PAVILION DV6 WITH WIN7 OS

  • WCS 6.0 Upgrade Problem

    I've downloaded WCS-STANDARD-K9-6.0.132.0.exe (205,164 KB). Each time I try to write this to a CD it errors out and the CD is not readable. Is anyobe else have similar problem? Is there a work around?

  • ITunes still won't open after latest updated to fix it.

    April 19 update was supposed to be a fix for apps that wouldn't open, but it didn't work. I still have to open iTunes with the terminal.

  • Formula Structure involving the IF statement

    How would I structure a formula for the following problem: The wages for YoYo Joe's will increase if the number of items sold each month exceed 25500. The calculation  of wages includes a fixed base amount of $175000 plus an increase of Excess_Produc