How to generate this output?URGENT

how to generate using DOM or SAX to get this output?
<project>
<process name = " Process1 " >
</project>
i am stuck here ... may i know how to continued coding from here.. must add in wat ? can any one tell me thank....
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.FactoryConfigurationError;
import javax.xml.parsers.ParserConfigurationException;
import org.w3c.dom.Document;
import org.w3c.dom.*;
import org.w3c.dom.DOMException;
import java.io.*;
import java.util.*;
public class TestVector
     private Vector m_vProcess;
     String strProjectName;
     public static void main(String[] args)
          TestVector pThis = new TestVector();
          pThis -> WriteToXML(m_vProcess);
     public void TestVector {
          strProjectName ="Project1";
          m_vProcess = new Vector();               
          m_vProcess.add("Process1");
          m_vProcess.add("Process2");
     public void WriteToXML(Vector vProcess)
          DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
          DocumentBuilder builder = facory.newDocumentBuilder();
          Document builder = builder.parse("Project.xml");
          Node rootNode = document.getDocumentElement();
          NodeList list = document.getElementsByTagName("Project");
// Loop through the list.
          for (int i=0; i < list.getLength(); i++) {
          thisProjectNode = list.item(i);
          Node thisName1Node = thisProjectNode.getFirstChild();
          if (thisName1Node == null) continue;
          if (thisName1Node.getFirstChild() == null) continue;
          if (! thisName1Node.getFirstChild() instanceof
org.w3c.dom.Text) continue;
          String data = thisName1Node.getFirstChild().getNodeValue();
          if (! data.equals("Process1")) continue;
//We're at the Mocha Java node. Create and insert the new
//element.
          Node newCoffeeNode = document.createElement("Project");
          Node newName1Node = document.createElement("Process");
          Text tnNode = document.createTextNode("Process1");
          newName1Node.appendChild(tnNode);
          Node newName2Node = document.createElement("Process");
          Text tpNode = document.createTextNode("Process2");
          newName2Node.appendChild(tpNode);
          newProjectNode.appendChild(newName1Node);
          newProjectNode.appendChild(newName2Node);
          rootNode.insertBefore(newProjectNode, thisProjectNode);
          break;

i am not good in programming..wat ever i read b4 ,i wlll forget easily ..and y the output nv come out after i type these...
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.FactoryConfigurationError;
import javax.xml.parsers.ParserConfigurationException;
import org.w3c.dom.Document;
import org.w3c.dom.*;
import org.w3c.dom.DOMException;
import java.io.*;
import java.util.*;
public class TestVector
     private Vector m_vProcess;
     String strProjectName;
     public static void main(String[] args)
          TestVector pThis = new TestVector();
          pThis -> WriteToXML(m_vProcess);
     public void TestVector {
          strProjectName ="Project1";
          m_vProcess = new Vector();               
          m_vProcess.add("Process1");
          m_vProcess.add("Process2");
     public void WriteToXML(Vector vProcess)
          DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
          DocumentBuilder builder = facory.newDocumentBuilder();
          Document builder = builder.parse("Project.xml");
          TransformerFactory tfac = TransformerFactory.newInstance();
          FileWriter fileWtr = new FileWriter("output.xml");
          StreamResult strResult = new StreamResult(fileWtr);
          Transformer trans = tfac.newTransformer();
          trans.transform(new DOMSource(document.getDocumentElement()),strResult);
          Node rootNode = document.getDocumentElement();
          NodeList list = document.getElementsByTagName("Project");
// Loop through the list.
          for (int i=0; i < list.getLength(); i++) {
          thisProjectNode = list.item(i);
          Node thisName1Node = thisProjectNode.getFirstChild();
          if (thisName1Node == null) continue;
          if (thisName1Node.getFirstChild() == null) continue;
          if (! thisName1Node.getFirstChild() instanceof
org.w3c.dom.Text) continue;
          String data = thisName1Node.getFirstChild().getNodeValue();
          if (! data.equals("Process1")) continue;
          Node newCoffeeNode = document.createElement("Project");
          Node newName1Node = document.createElement("Process");
          Text tnNode = document.createTextNode("Process1");
          newName1Node.appendChild(tnNode);
          Node newName2Node = document.createElement("Process");
          Text tpNode = document.createTextNode("Process2");
          newName2Node.appendChild(tpNode);
          newProjectNode.appendChild(newName1Node);
          newProjectNode.appendChild(newName2Node);
          rootNode.insertBefore(newProjectNode, thisProjectNode);
          break;

Similar Messages

  • How to generate multiple output pdf's from one oracle reports

    how to generate multiple output pdf's from one oracle reports.
    I have a report where I have to generate more than one output files from the same report based on a parameter.
    Each output file is for each parameter.
    Is this possible in oracle reports, is so how ?

    You can better post your question in the reports forum instead of this pl/sql forum.

  • Sql query to generate this output

    Hi,
    I have a table as follows;
    SET_MASTER
    ID set_id attribute_id attribute_value
    1 1 2 10
    2 1 3 20
    3 1 4 50
    4 1 5 60
    5 2 2 10
    6 2 3 30
    7 2 4 40
    8 2 5 50
    I want to generate an output as folllows;
    Attr_id Set1_attr_value Set2_attr_value min_attr_value max_attr_value
    2 10 10 10 10
    3 20 30 20 30
    4 50 40 40 50
    5 60 50 50 60
    Please provide the query to generate this output.
    Thanks.

    SQL> create table set_master (id,set_id,attribute_id,attribute_value)
      2  as
      3  select 1, 1, 2, 10 from dual union all
      4  select 2, 1, 3, 20 from dual union all
      5  select 3, 1, 4, 50 from dual union all
      6  select 4, 1, 5, 60 from dual union all
      7  select 5, 2, 2, 10 from dual union all
      8  select 6, 2, 3, 30 from dual union all
      9  select 7, 2, 4, 40 from dual union all
    10  select 8, 2, 5, 50 from dual
    11  /
    Tabel is aangemaakt.
    SQL> select attribute_id attr_id
      2       , max(decode(set_id,1,attribute_value)) set1_attr_value
      3       , max(decode(set_id,2,attribute_value)) set2_attr_value
      4       , least(max(decode(set_id,1,attribute_value)),max(decode(set_id,2,attribute_value))) min_attr_value
      5       , greatest(max(decode(set_id,1,attribute_value)),max(decode(set_id,2,attribute_value))) max_attr_value
      6    from set_master
      7   group by attribute_id
      8   order by attribute_id
      9  /
       ATTR_ID SET1_ATTR_VALUE SET2_ATTR_VALUE MIN_ATTR_VALUE MAX_ATTR_VALUE
             2              10              10             10             10
             3              20              30             20             30
             4              50              40             40             50
             5              60              50             50             60
    4 rijen zijn geselecteerd.Regards,
    Rob.

  • How to get this output using sql query?

    Hi,
      How to get this output using sql query?
    Sno Name Age ADD Result
    1 Anil 23 delhi Pass
    2 Shruti 25 bangalor Pass
    3 Arun 21 delhi fail
    4 Sonu 23 pune Pass
    5 Roji 26 hydrabad fail
    6 Anil 28 delhi pass
    Output
    Sno Name Age ADD Result
    1 Anil 23 delhi pass
    28 delhi pass

    Hi Vamshi,
    Your query is not pretty clear.
    write the select query using Name = 'ANIL' in where condition and display the ouput using Control-break statements.
    Regards,
    Kannan

  • How to print this output. (Array)

    Hi all. I have two String array:
    String[] a = { "a", "b", "c", "d", "e" };
    String[] b = { "b", "d" };
    I want to print this two array into this output:
    Output:
    a
    bb
    c
    dd
    e
    Anybody can help me how to get this output. I have try with a for loop, but it's not working.

    try this,
    boolean found=false;
    for(int i=0; i<a.length;i++)
             found=false;
             for(int j=0;j<b.length;j++)
                     if(a.equals(b[j])
    found=true;
    if(found==true)
    System.out.println(a[i]+a[i]);
    else
    System.out.println(a[i]);

  • How to acheive this output during the XML conversion ?.

    I am converting the data into XML. I am using Oracle8i.
    create table emp(empno number,
    ename varchar2(20),
    deptno number);
    insert into emp values(101,'Krish',10);
    insert into emp values(102,null, 10);
    insert into emp values(103,'Scott',20);
    commit;
    CREATE OR REPLACE PROCEDURE STP_TEST_XML AS
    v_context DBMS_XMLQUERY.CTXTYPE;
    v_document CLOB;
    v_error_code VARCHAR2(3) := 'OK';
    BEGIN
    v_context:= DBMS_XMLQUERY.NEWCONTEXT('SELECT * FROM EMP');
    DBMS_XMLQUERY.USENULLATTRIBUTEINDICATOR(v_context,TRUE);
    DBMS_XMLQUERY.SETROWSETTAG(v_context,'EMPIMPORT');
    DBMS_XMLQUERY.SETROWTAG(v_context,'EMP');
    v_document := DBMS_XMLQUERY.GETXML(v_context);
    DBMS_XMLQUERY.CLOSECONTEXT(V_context);
    PRINT_XML(v_document);
    END;
    CREATE OR REPLACE PROCEDURE print_xml(result IN OUT NOCOPY CLOB) is
    xmlstr varchar2(32767);
    line varchar2(2000);
    begin
    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;
    The output is showing as below.
    <?xml version = '1.0'?>
    <EMPIMPORT>
    <EMP num="1">
    <EMPNO>101</EMPNO>
    <ENAME>Krish</ENAME>
    <DEPTNO>10</DEPTNO>
    </EMP>
    <EMP num="2">
    <EMPNO>102</EMPNO>
    <ENAME NULL="YES"/>
    <DEPTNO>10</DEPTNO>
    </EMP>
    <EMP num="3">
    <EMPNO>103</EMPNO>
    <ENAME>Scott</ENAME>
    <DEPTNO>20</DEPTNO>
    </EMP>
    </EMPIMPORT>
    But my requirement needs my output should be as below. Please let me know how to achieve this output.
    <?xml version = '1.0'?>
    <EMPIMPORT>
    <EMP num="1">
    <EMPNO>101</EMPNO>
    <ENAME>Krish</ENAME>
    <DEPTNO>10</DEPTNO>
    </EMP>
    <EMP num="2">
    <EMPNO>102</EMPNO>
    <ENAME/>
    <DEPTNO>10</DEPTNO>
    </EMP>
    <EMP num="3">
    <EMPNO>103</EMPNO>
    <ENAME>Scott</ENAME>
    <DEPTNO>20</DEPTNO>
    </EMP>
    </EMPIMPORT>

    can you please tell me how to acheive 1,2,3  instead of the chars.
    Also if I use virtual characteristic can I able to access the query structure in the user exit like the restricted key figures etc or just the records how they appear in the cube.
    Thank you guys for the quick response.

  • How to generate the output of a BSP application in PDF format?

    Hi,
    I need to modify one BSP application, which generates its output in the form of PDF. I have checked all the methods in the bsp pages and its corresponding controller class's. I couldn't find any relevant method, which deals with generating the output in PDF.
    Could you please share your valuable thoughts on this?
    Again it would be helpful, If anyone of you share some knowledge on Interactive Adobe Forms.
    Thanks,
    John

    >
    I am using oracle version 11.2.0.1, I have set a cronjob which will run on every 15 minutes and give us a log file mentioning the execution time taken for that SQL query:-
    The above query will return the output as well as the time taken for execution of the query. I want to suppress the output of the query and only want the time taken to be printed. Is it possible by set commands. I have marked the output as bold and made it Italic.
    >
    How would that even be useful?
    A query from a tool such as sql*plus is STILL going to send the output to the client and the client. You can keep sql*plus from actually displaying the data by setting autotrace to trace only.
    But that TIME TAKEN is still going to include the network time it takes to send ALL rows that the query returns across the network.
    That time is NOT the same as the actual execution time of the query. So unless you are trying to determine how long it takes to send the data over the network your 'timing' method is rather flawed.
    Why don't you tell us WHAT PROBLEM you are trying to solve so we can help you solve it?

  • How to Generate XML Output file

    Hi,
    I want to print sample output XML file.
    I got this link 362496.1
    An output file can be generated via the Preview functionality available under the XML Publisher Administrator responsibility. Navigation path :
    1. Login to the application as SYSADMIN
    2. Responsibility: XML Publisher Administrator
    3. Function: Templates
    4. Select a Template for which a Preview Data file has been uploaded in the past.
    5. Click on the Preview icon
    6. Save the PDF to the client PC
    7. Determine the version either by the above instructions OR by provide the PDF file to Global Customer Support.But in #4 I can not populate any values to search, even if I put all %.
    How can I get a valid search?
    Thanks a lot,
    Ms K

    Hi;
    AFAIK if you prepare template in XML publisher than you can take output as pdf, by the way you can take xml output too
    Please check user guide:
    http://www.oracle.com/technology/products/xml-publisher/docs/XMLP5.6.1UserGuide.pdf
    Oracle XML Publisher and Oracle Reports
    Oracle XML Publisher and Oracle Reports
    Also Please check below thread:
    XML output for pdf concurrent program
    http://www.quovera.com/whitepapers/downloads/xml_oracle.pdf
    Generate XML output using DBMS_XMLGEN.getxmltype and not from rdf
    http://www.orafaq.com/forum/t/35204/2/
    Hope it helps
    Regard
    Helios

  • How to generate the output of BSP application in PDF format?

    Hi,
    I need to modify one BSP application, which generates its output in the form of PDF. I have checked all the methods in the bsp pages and its corresponding controller class's. I couldn't find any relevant method, which deals with generating the output in PDF.
    Could you please share your valuable thoughts on this?
    Again it would be helpful, If anyone of you share some knowledge on Interactive Adobe Forms.
    Thanks,
    John

    okay, awesome
    i'd use DOM or some high level API for this (don't write it by hand using plain File IO)
    okay, try this site, it goes through building a document, adding elements, writing to file, etc.
    http://www.roseindia.net/xml/dom/

  • How to Generate Report Output to Flat File

    Hi All,
    how to generate a report's output to a flat file(fixed length file).
    Thanks and appreciated.

    Hi
    In the object navigator u have a node called builtin packages. in that you can see text_io package.and in help you can have a detailed exaplination abt that. if your version is 9i then search in web for webutil program which also does the same work.
    Thank you
    Sasi

  • One for the Tekkies: How to get this output using REGULAR EXPRESSIONS?

    How to get the below output using REGULAR EXPRESSIONS??
    SQL> ed
    Wrote file afiedt.buf
      1* CREATE TABLE cus___addresses    (full_address                   VARCHAR2(200 BYTE))
    SQL> /
    Table created.
    SQL> PROMPT Address Format is: House #/Housename,  street,  City, Zip Code, COUNTRY
    House #/Housename,  street,  City, Zip Code, COUNTRY
    SQL> INSERT INTO cus___addresses VALUES('1, 3rd street, Lansing, MI 49001, USA');
    1 row created.
    SQL> INSERT INTO cus___addresses VALUES('3B, fifth street, Clinton, OK 74103, USA');
    1 row created.
    SQL> INSERT INTO cus___addresses VALUES('Rose Villa, Stanton Grove, Murray, TN 37183, USA');
    1 row created.
    SQL> SELECT * FROM cus___addresses;
    FULL_ADDRESS
    1, 3rd street, Lansing, MI 49001, USA
    3B, fifth street, Clinton, OK 74103, USA
    Rose Villa, Stanton Grove, Murray, TN 37183, USA
    SQL> The REG EXP query shouLd output the ZIP codes: i.e. 49001, 74103, 37183 in 3 rows.Edited by: user12240205 on Jun 18, 2012 3:19 AM

    Hi,
    user12240205 wrote:
    ... Frank, ʃʃp's method, I understand. But your method, although correct, I find it difficult to understand.
    Could you explain how you did this?? What does '.*(\d{5})\D*' and '\1' mean???
    Your method is better because it uses only ONE reg expression function. ʃʃp's uses 2.In Oracle 10.2 (I believe) and higher, '\d' is equivalent to '[[:digit:]]', and '\D' is equivalent to '[^[:digit:]]'. I find '\d' and '\D' easier to type, but there's nothing wrong with using '[[:digit:]]' and '[^[:digit:]]'.
    '.*' means "0 or more of any character".
    '\D*' means "0 or more non-digits".
    The whole expression, '.*(\d{5})\D*' means:
    a. 0 or more characters (any characters)
    b. 5 digits
    c. 0 or more non-digits.
    '\1' is a Backreference . It means the sub-string that matched the pattern after the 1st '(', up to (but not including) its matching ')'. In this case, that means the sub-string that matched '\d{5}', or b. using the explanation immediately above.
    So the entire REGEXP_REPLACE call means "When you see a sub-string consisting of a., follwed immediately by b., followed immedately by c., replace that sub-string with b. alone."

  • How to take this output from javacreator?

    i wanna take this output.
    123456
    12345
    1234
    123
    12
    1

    ... What? Can you word that into a somewhat sensible English sentence? Are you trying to create that output? I assume javacreator = JCreator? Anyways... I would suggest starting with a for loop nested within another for loop. That would be your best bet in terms of difficulty to implement.
    Hint: first for loop would be your max number, going down, nested loop should be for printing each line.
    Edited by: XTTX on Nov 25, 2007 5:52 AM

  • How to generate this xml file?

    Dear experts,
         Could you please tell me how to generate to below xml file? 
    <?xml version="1.0" encoding="utf-8" ?>
    - <faxmakerdata>
    - <RECIPIENTS>
    - <FAX>
    - <RECIPIENT>
      <FIRSTNAME>><![CDATA[]]></FIRSTNAME>
      <LASTNAME><![CDATA[]]></LASTNAME>
      <COMPANY><![CDATA[]]></COMPANY>
      <DEPARTMENT><![CDATA[]]></DEPARTMENT>
      <EMAILADDRESS><![CDATA[]]></EMAILADDRESS>
      <NUMBER><![CDATA[2937]]></NUMBER>
      <VOICENUMBER><![CDATA[]]></VOICENUMBER>
      </RECIPIENT>
      </FAX>
      </RECIPIENTS>
      </faxmakerdata>
    I have used  "SDIXML_DATA_TO_DOM  " but there will appear <Item>
    could you please tell me how to do?

    Hi,
        after SDIXML_DATA_TO_DOM  fm Use SDIXML_DOM_TO_XML to  convert DOM to XML
        then u can use any download file FM .
      DATA:
        TABLESTATS           LIKE MSSTABSIZEINFO,
        IVALUE               TYPE I,
        BEGIN OF VERSIONTAB OCCURS 0,
          VERSIONDAT         LIKE SY-DATUM,
        END OF VERSIONTAB,
        CMD(384)             TYPE C,
        XML_AS_STRING        TYPE     XSTRING,
        DOCUMENT             TYPE REF TO IF_IXML_DOCUMENT,
        DOM                  TYPE REF TO IF_IXML_ELEMENT,
        TABLENAME(128)       TYPE C,
        RC                   TYPE SY-SUBRC,
        L_EXISTS             LIKE DD02L-ACTFLAG.
    convert table to a DOM
      CALL FUNCTION 'SDIXML_DATA_TO_DOM'
        EXPORTING
          NAME        = 'spinfo'
          DATAOBJECT  = SPINFO[]
        IMPORTING
          DATA_AS_DOM = DOM
        CHANGING
          DOCUMENT    = DOCUMENT
        EXCEPTIONS
          OTHERS      = 01.
      IF SY-SUBRC = 0.
        CALL METHOD DOCUMENT->APPEND_CHILD
          EXPORTING
            NEW_CHILD = DOM
          RECEIVING
            RVAL      = RC.
        IF RC = 0.
        convert DOM to XML
          CALL FUNCTION 'SDIXML_DOM_TO_XML'
            EXPORTING
              DOCUMENT      = DOCUMENT
              PRETTY_PRINT  = 'X'
            IMPORTING
              XML_AS_STRING = XML_AS_STRING
              SIZE          = IVALUE
            TABLES
              XML_AS_TABLE  = XML_AS_TABLE
            EXCEPTIONS
              OTHERS        = 2.
          IF SY-SUBRC = 0.
            MOVE XML_AS_STRING TO XML_AS_STRING_OUT-XML_STRING.
            MOVE IVALUE TO XML_AS_STRING_OUT-LENGTH.
          ENDIF.
        ENDIF.
      ENDIF.
    Salil...

  • How to Generate CSV Output from JD Edwards BI Publisher

    Hi All,
    I have a report "Critical Date Report" - R15611 in JD Edwards 8.11. This report has to be generated as CSV output from BI Publisher which is embedded to JDE.
    The purpose we want use BI Publisher is to move some of the data displaying to different place in the page(ex: Move the company address from top left corner to Bottom right corner).
    In order to achieve this
    1.We created blank rtf template and upload to XML repository using P95600 application
    2.Create report definition using P95620 application
    3.Here I see the available output types as PDF,RTF,HTML,EXCEL,POWERPOINT and XML,ETEXT(GRAYED OUT)
    Which output type we can use for CSV ?
    4.Execute the report definition of the critical date report from P95620 to get the XML source
    5.This XML source will be loaded into the blank rtf template
    6.From this point no idea how to design the rtf template in order to get the CSV output.
    7.We did design and output type as excel - but the result data is not in good formatting and alignment*(Headers and footers are repeating).*
    If any one has worked on similar type of requirement,let us know how to do or send a sample XML source,rtf template and how the CSV output will be. Or any document link present in Oracle site will be helpful. Please let me know if you need more details.
    Thanks in Advance.
    Vijay

    Hi Vijay,
    For CSV output, you need an E-text template (not RTF) that's why its grayed out! You can use Excel as output type and have (No headers and footers) , then you can open the file in Excel and store it as CSV. Does not always display correctly though.
    Why are you compelled to use BI publisher? you can use the JDE standard csv output report, (as is used by most EDI systems) of course this may involve a bit of customization if you wants the fields arranged differently.
    -Domnic

  • How to generate two output tupe automatically in purchase order

    Hi,
    I am working on Idoc, the requirement is to generate an IDOc when an purchase order is created . At present i am using one output type NEU with the medium ALE Distribution.
    Later there was a new requirement when all the Items of the PO are deleted a new ouptut type ZNEU has to be used.
    At present  the output type NEU is automaticatally populating when the message tab is clicked. But the other output type ZNEU has to be populated automatically when all line items are deleted.  Can u tell me how to do this

    Dear Josephine,
    you can manage this using user-exit (or BADI). When you check that all positions are deleted, you can submit (using job schedule or other) the report RSNAST00 to execute the message output.
    In other situation you can create an output condition (customizing routine) to validare the output message only if all the position are deleted.
    Use NACE transaction to set all customizing data about output message.
    Regards,
    Gianluca Simeone

Maybe you are looking for