Need Help On DOM

i have learned SAX n DOM parsing in java but not sure about how to use in it my jsp n Servlet project , how it helps me to gain performance plz help

i have learned SAX n DOM parsing in java but not sure
about how to use in it my jsp n Servlet project , how
it helps me to gain performance plz helpWhy would you want to use it in your project? Do you have to process XML ? Why?

Similar Messages

  • Need help with DOM

    I got the following code from the Java DOM walkthrough. I am trying to enhance it. I want to build an XML file with my DOM. and then right the new XML to a file. I want to learn how to do it. It's not about being efficient.
    How do I add child elements to this with child tags and then give them values? If you look at the code, it creates a root, then appends a 'child', but I don't see how its giving the child an element name. it just looks like its giving it a value.
       public static void buildDom()
            DocumentBuilderFactory factory =
               DocumentBuilderFactory.newInstance();
            try {
              DocumentBuilder builder = factory.newDocumentBuilder();
              document = builder.newDocument();  // Create from whole cloth
              Element root =
                      (Element) document.createElement("rootElement");
              document.appendChild(root);
              root.appendChild( document.createTextNode("Some") );
              root.appendChild( document.createTextNode(" ")    );
              root.appendChild( document.createTextNode("text") );
            } catch (ParserConfigurationException pce) {
                // Parser with specified options can't be built
                pce.printStackTrace();
        } //

    If you're looking to build up simple documents, Dom4J might be your best choice: http://www.dom4j.org/
    Combining two examples from their Quick Start guide, here's the code to do what you want (note: it hasn't been compiled, just copied from the Dom4J website with some strings changed):
    import org.dom4j.Document;
    import org.dom4j.DocumentHelper;
    import org.dom4j.Element;
    import org.dom4j.io.OutputFormat;
    import org.dom4j.io.XMLWriter;
    public class Foo {
        public Document createDocument() {
            Document document = DocumentHelper.createDocument();
            Element root = document.addElement( "root" );
            Element value1 = root.addElement( "value1" )
                .addText( "myVal " );
            Element author2 = root.addElement( "value2" )
                .addText( "myVal2" );
            return document;
    public void write(Document document) throws IOException {
            // Pretty print the document to System.out
            OutputFormat format = OutputFormat.createPrettyPrint();
            writer = new XMLWriter( System.out, format );
            writer.write( document );
    }

  • Need help in getting 'RoleApprover' and 'Manager of RoleApprover'

    We are developing a Custom Role Approval Process using SOA composite.
    A manager or a delegated admin will be raising a Role Approval request for a beneficiary. We need to assign the Approval task to beneficiaries' manager or Role Approver.
    If the RoleApprover does not Approve the task in stipulated time, the task needs to get escalated to RoleApprover's manager.
    I'm new to OIM APIs, i was folllowing the tutorial "developing_oim_custom_approval_process_for_role_request.pdf". This needs an user defined field 'RoleApprover' created in the Role request form. We cannot create user defined field in the role request form.
    I need help in getting the 'RoleApprover' and the 'Manager of RoleApprover' programmatically.
    Payload from the OIM Approval request follows:
    <ns2:process>
    <RequestID>176</RequestID>
    <RequestModel>Assign Roles</RequestModel>
    <RequestTarget>Onhand Quantity</RequestTarget>
    <RequesterDetails>
    <FirstName>Steve</FirstName>
    <LastName>Waugh</LastName>
    <Login>STEVEWAUGH</Login>
    <DisplayName>Steve Waugh</DisplayName>
    <ManagerLogin>XELSYSADM</ManagerLogin>
    <OrganizationName>Test</OrganizationName>
    <Email>[email protected]</Email>
    <Status>Active</Status>
    <XellerateType>End-User</XellerateType>
    <UserType>Full-Time</UserType>
    <Role>ALL USERS</Role>
    <Role>Primavera P6 - Global</Role>
    <Role>iProcurement Catalog Administrator</Role>
    <Role>Onhand Quantity</Role>
    <Role>Test Purchasing Super User</Role>
    <Role>Test Delegated Administrator</Role>
    <Role>HELPDESK ADMINISTRATORS</Role>
    <Role>Test e-Commerce Gateway Super User</Role>
    <Role>eBusiness Finance</Role>
    <Role>Test Line Manager</Role>
    <Role>Test_ApplicationApprover</Role>
    </RequesterDetails>
    <BeneficiaryDetails>
    <FirstName>David</FirstName>
    <LastName>Boon</LastName>
    <Login>DAVIDBOON</Login>
    <DisplayName>David Boon</DisplayName>
    <ManagerLogin>STEVEWAUGH</ManagerLogin>
    <OrganizationName>TestCO</OrganizationName>
    <Email>[email protected]</Email>
    <Status>Active</Status>
    <XellerateType>End-User</XellerateType>
    <UserType>Full-Time</UserType>
    <Role>ALL USERS</Role>
    <Role>Hyperion</Role>
    <Role>Test Purchasing Administrator</Role>
    <Role>Test Internet Expenses Audit Manager</Role>
    <Role>Test Internet Expenses Auditor</Role>
    </BeneficiaryDetails>
    <ObjectDetails>
    <name>Test Onhand Quantity</name>
    <attributes/>
    </ObjectDetails>
    <url>
    http://host:port/workflowservice/CallbackService
    </url>
    <OtherDetails/>
    </ns2:process>
    Edited by: rajesh on Feb 13, 2011 9:00 AM

    Choose Xerces2.4 to serialize the DOM object is an option.
    javac XercesTest.java -classpath xmlParserAPIs.jar;xercesImpl.jar;.
    java -classpath xmlParserAPIs.jar;xercesImpl.jar;. XercesTest test.xml
    below is the source file: XercesTest.java
    //JAXP
    import javax.xml.parsers.*;
    import org.w3c.dom.*;
    //APACHE SERIALIZE FUNCTION
    import org.apache.xml.serialize.*;
    class XercesTest
    public static void main(String[] args) throws Exception
    DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
    DocumentBuilder builder = factory.newDocumentBuilder();
    Document doc = builder.parse( new File( args[0] ) );
    File f = new File( "copy_of_"+ args[0] );
    OutputFormat format = new OutputFormat("xml","UTF-8",true ) ;
    FileOutputStream fout = new FileOutputStream( f );
    XMLSerializer ser = new XMLSerializer(fout, format );
    ser.serialize( doc );
    maybe it's helpful
    land

  • Need help to develop Pythagoras theorem-

    Hi i need help to develop proofs 2,3,4
    of pythagoras theorems in java as demonstrations
    These are applets can anyone help me with it or give me an idea of how to go about developing it -
    the site is the following
    http://www.uni-koeln.de/ew-fak/Mathe/Projekte/VisuPro/pythagoras/pythagoras.html
    then double click on the screen to make it start

    Pardon my ASCII art, but I've always liked the following, simple, geometric proof:
         a                   b
    ---------------------------------------+
    |       |                                |
    a|   I   |              II                |
    |       |                                |
    ---------------------------------------+
    |       |                                |
    |       |                                |
    |       |                                |
    |       |                                |
    |       |                                |
    b|  IV   |              III               |
    |       |                                |
    |       |                                |
    |       |                                |
    |       |                                |
    |       |                                |
    |       |                                |
    ---------------------------------------+It almost goes without saying that I+II+III+IV == (a+b)^2, and II == IV == a*b,
    I == a*a and III == b*b, showing that (a+b)^2 == a^2+a*b+a*b+b^2.
    I hope the following sketch makes sense, stand back, ASCII art alert again:     a                   b
    ---------------------------------------+
    |               .             VI         |
    |     .                 .                |a
    | V                               .      |
    |                                        +
    |                                        |
    |   .                                    |
    b|                                     .  |
    |                                        |
    |                  IX                    |
    | .                                      |
    |                                    .   |b
    |                                        |
    +                                        |
    |      .                                 |
    a|               .                  . VII |
    |  VIII                   .              |
    ---------------------------------------+
                     a                    bThe total area equals (a+b)^2 again and equals the sum of the smaller areas:
    (a+b)^2 == V+VI+VII+VIII+IX. Let area IX be c^2 for whatever c may be.
    V+VII == VI+VIII == a*b, so a^2+b^2+2*ab= c^2+2*a*b; IOW a^2+b^2 == c^2
    Given this fundamental result, the others can easily be derived from this one,
    or did I answer a question you didn't ask?
    kind regards,
    Jos

  • I need help to find and open a job app that I exported, was able to fill out and sign and saved and now can't open it? What did I do wrong?

    I need help to find and open a job app that I exported, was able to fill out and sign and saved and now can't open it? What did I do wrong?

    What file format did you export it to?

  • Need help to open audios attached in a PDF file

    Hello
    I just need help. I have ordered a reviewer online that has audios and texts in a pdf file. I was told to download the latest adobe reader on my computer. I have done the same thing on my ipad mini. I am not so technical with regards to these things. Therefore I need help. I can access the audios on my computer but not on my ipad.
    I want to listen to audios with scripts or texts on them so i can listen to them when i am on the go. I was also informed that these files should work in any device. How come the audios doesnt work on my ipad.
    Please help me on what to do.
    Thanks

    Audio and video are not currently support on Adobe Reader. :-<
    You need to buy a PDF reader that supports them. My suggestion is PDF Expert from Readdle ($US 9.99)

  • Need help to open and look for file by name

    Hi,
            Im needing help to open a folder and look for a file (.txt) on this directory by his name ... The user ll type the partial name of file , and i need look for this file on the folder , and delete it ....
    How can i look for the file by his name ?
    Thx =)

    Hi ,
        Sry ,, let me explain again ... I ll set the name of the files in the follow order ... Name_Serial_date_chanel.sxc ..
    The user ll type the serial that he wants delete ...
    I already figured out what i need guys .. thx for the help ^^
    I used List Directory on advanced IO , to list all .. the Name is the same for all ... then i used Name_ concateneted with Serial(typed)* .. this command serial* ll list all serials equal the typed , in my case , ll exist only one , cuz its a count this serial .Then i pass the path to the delete , and its done !
    Thx ^^

  • I need help, my ipod touch is not recognized by windows as a harddisk

    i need help, my ipod touch is not recognized by windows like a memory card or a harddisk.
    i would like to transfer the files from pc to my ipod touch without useing itunes.
    as i see theres some people here that theires ipod touch are recongnzed as a digitl camra, mine is reconzied as nothing, some help plz.
    Message was edited by: B0Om

    B0Om wrote:
    ok but i still dont understed, only my itnes recongnize my ipod, when i go to " my cumputer, it dosent show up there, not even as a digital camra
    Your Touch is working correctly. Currently, without unsupported third party hacks, the Touch has NO disc mode. It will only show up in iTunes.
    how do i put programes and games in my ipod touch
    Right now, you don't. The SDK is scheduled to be released in Feburary. Then developers will be able to write programs that will be loadable.

  • Weird error message need help..

    SO.. i havent updated my itunes in a while because i keep getting this weird message.. it comes up when im almost done installing the newest/newer versions of itunes. it says
    "the feature you are trying to use is on a network resource that is unavailable" "click ok to try again or enter an alternate path to a folder containing the installation package 'iTunes.msi' in the box below"
    now when ever i choose a file from the browse box it replies with this message "the file 'xxx' is not a valid installation package for the product iTunes. try to find the installation package iTunes.msi in a folder from which you can install iTunes."
    no idea need help thanks
    ~~~lake
    Message was edited by: DarkxFlamexCaster
    Message was edited by: DarkxFlamexCaster

    +it comes up when im almost done installing the newest/newer versions of itunes. it says+ +"the feature you are trying to use is on a network resource that is unavailable" "click ok to try again or enter an alternate path to a folder containing the installation package 'iTunes.msi' in the box below"+
    With that one, let's try the following procedure.
    First, head into your Add/Remove programs and uninstall your QuickTime. If it goes, good. If it doesn't, we'll just attend to it when we attend to iTunes.
    Next, download and install the Windows Installer CleanUp utility:
    Description of the Windows Installer CleanUp Utility
    Now launch Windows Installer CleanUp ("Start > All Programs > Windows Install Clean Up"), find any iTunes and/or QuickTime entries in the list of programs in CleanUp, select those entries, and click “remove”.
    Next, we'll manually remove any leftover iTunes or QuickTime program files:
    (1) Open Local Disk (C:) in Computer or whichever disk programs are installed on.
    (2) Open the Program Files folder.
    (3) Right-click the iTunes folder and select Delete and choose Yes when asked to confirm the deletion.
    (4) Right-click the QuickTime folder and select Delete and choose Yes when asked to confirm the deletion. (Note: This folder may have already been deleted if QuickTime was successfully removed using Add/Remove Programs earlier.)
    (5) Delete the QuickTime and QuicktimeVR files located in the C:\Windows\system32\ folder. Click Continue if Windows needs confirmation or permission to continue. (Note: These files may have already been deleted if QuickTime was successfully removed using Add/Remove Programs earlier.)
    (6) Right-click on the Recycle Bin and on the shortcut menu, click Empty Recycle Bin.
    (7) Restart your computer.
    Now try another iTunes install. Does it go through properly now?

  • I got new hard driver for my MacBook I don't have the cd but I do have flash drive that has the software I need help because when I turn on my laptop it shows me a file with question mark how can I install the software from the flash driver?

    I got new hard driver for my MacBook I don't have the cd but I do have flash drive that has the software I need help because when I turn on my laptop it shows me a file with question mark how can I install the software from the flash driver?

    Hold down the Option key while you boot your Mac. Then, it should show you a selection of devices. Click your flash drive and it will boot from that.

  • Need help adobe bridge cc output module

    I need help. I have an assignment I'm held up on completing because the adobe cc bridge does not have the output modue I need. I followed the adobe instructions page to the letter. I copied and pasted the output module folder to the adobe bridge cc extensions folder in programs/commonfiles/adobe. The only thing is the instructions then say to paste the workspace file into the workspace folder located below the bridge extensions folder. I don't have a workspaces folder there or anywhere. I even tried must making one and adding the file to it, but no go. can someone PLEASE help me with this?    I have an assignment due like now that requires the use of the output modue.thanks!

    oh,my system is windows 8.1. sorry, lol.

  • Trying to create a Invoice based on Order need help Error -5002

    the dreaded -5002 error is haunting me too! and I could not find a matching solution for this in the forum....
    I need help quickly on this. I am trying to create invoices for some orders so the Base - Target relationship is retained. The orders I pick are all Open (DocStatus   = O and the lines are all Open LineStatus = O)
    here is my code
    oInvoice.Lines.BaseEntry = 48
    oInvoice.Lines.BaseLine = 0
    oInvoice.Lines.BaseType = SAPbobsCOM.BoObjectTypes.oOrders
    oInvoice.Lines.ItemCode = "A00001"
    oInvoice.Lines.ItemDescription = "IBM Infoprint 1312"
    'adding Line
    oInvoice.Lines.Add
    oInvoice.Lines.BaseEntry = 48
    oInvoice.Lines.BaseLine = 1
    oInvoice.Lines.BaseType = SAPbobsCOM.BoObjectTypes.oOrders
    oInvoice.Lines.ItemCode = "A00002"
    oInvoice.Lines.ItemDescription = "IBM Inforprint 1222"
    'adding Line
    oInvoice.Lines.Add
    lRetCode = oInvoice.Add
    If lRetCode <> 0 Then
        gObjCompany.GetLastError lErrCode, sErrMsg
        MsgBox (lErrCode & " " & sErrMsg)
    End If

    Indika,
    Only set your base types...
    (not items & description)
    oInvoice.Lines.BaseEntry = 48
    oInvoice.Lines.BaseLine = 0
    oInvoice.Lines.BaseType = SAPbobsCOM.BoObjectTypes.oOrders
    oInvoice.Lines.ItemCode = "A00001"
    oInvoice.Lines.ItemDescription = "IBM Infoprint 1312"
    'adding Line (to fill the second item line)
    ' the 1st line item is there by default
    oInvoice.Lines.Add
    oInvoice.Lines.BaseEntry = 48
    oInvoice.Lines.BaseLine = 1
    oInvoice.Lines.BaseType = SAPbobsCOM.BoObjectTypes.oOrders
    oInvoice.Lines.ItemCode = "A00002"
    oInvoice.Lines.ItemDescription = "IBM Inforprint 1222"
    'DO NOT Add THIS line
    ' (only if you want to add a 3rd line item)
    '''oInvoice.Lines.Add -> Don't add this
    lRetCode = oInvoice.Add
    If lRetCode <> 0 Then
        gObjCompany.GetLastError lErrCode, sErrMsg
        MsgBox (lErrCode & " " & sErrMsg)
    End If
    remember to add :
    oInvoice.CardCode = "your BP"
    oInvoice.DocDueDate = Now
    oInvoiceDoc.CardCode = txtDOCBPCode.Text

  • Installation of Photoshop update 13.1.2 for creative cloud fails with error code U44M1P7 I need help

    I need help installing update 13.1.2 for Photoshop creative cloud, installation fails with error code: U44M1P7. Could someone please help?

    Sorry to bother you.
    I could find the answer after searching previous posts about this language problem.
    Had to change my language in AAM profile and then download PS CS6 again ( english version ).
    Then open the actual Photoshop and in preferences > interface you can besides the Dutch also option for English.
    restart application and Voila.
    Greetz, Jeroen

  • Stored DB Procedure - Need help

    Hi. I have a stored database package containing 2 functions. I need help with the function named ret_columns.
    If you look at the code below you will see this function has two different FOR loops. The Select statement in FOR loop that is commented out works just fine, but when I try to use the uncommented select statement in it's place the Function returns NULL (or no records). However, if I run the Select statement in plain old SQL Plus it returns the rows I need. I don't get it.
    Can anyone help me? I'm really stuck on this one.
    -- PACKAGE BODY
    CREATE OR REPLACE package body audit_table_info
    as
    function ret_tables return table_type is
    t_t table_type;
    i integer;
    begin
    i := 1;
    for rec in (select distinct table_name
    from all_triggers
                   where substr(trigger_name,1,9) = upper('tr_audit#')) loop
    t_t(i).tableA := rec.table_name;
    i := i+1;
    end loop;
    return t_t;
    end;
    function ret_columns return column_type is
    c_t column_type;
    i integer;
    begin
    i := 1;
    -- for rec in (select distinct table_name column_name
    -- from all_triggers
    --               where substr(trigger_name,1,9) = upper('tr_audit#')) loop
    for rec in (select distinct b.column_name column_name
    from all_triggers a, all_tab_columns b
                   where a.table_owner = b.owner
                        and a.table_name = b.table_name
                             and substr(a.trigger_name,1,9) = upper('tr_audit#') and rownum < 5) loop                    
    c_t(i).tableB := rec.column_name;
    i := i+1;
    end loop;
    return c_t;
    end;
    end audit_table_info;
    -- PACKAGE DEFINITION
    CREATE OR REPLACE package Audit_Table_Info as
    type table_rec is record( tableA all_tab_columns.TABLE_NAME%type);
    type table_type is table of table_rec index by binary_integer;
    function ret_tables return table_type;
    type column_rec is record( tableB all_tables.TABLE_NAME%type);
    type column_type is table of column_rec index by binary_integer;
    function ret_columns return column_type;
    end Audit_Table_Info;
    /

    It works when I do this!!! I'm so confused.
    Ok...so I did this:
    1 create table test_columns as
    2 (select b.column_name
    3 from all_triggers a,
    4 all_tab_columns b
    5 where a.table_owner = b.owner
    6 and a.table_name = b.table_name
    7 and substr(a.trigger_name,1,9) = upper('tr_audit#')
    8* and rownum < 5)
    SQL> /
    Table created.
    Then altered the Function so the Select statement refers to this table:
    function ret_columns return column_type is
    c_t column_type;
    i integer;
    begin
    i := 1;
    for rec in (select distinct column_name
    from test_columns) loop
    c_t(i).tableB := rec.column_name;
    i := i+1;
    end loop;
    return c_t;
    end;
    Again, any help would be greatly greatly appreciated!

  • Need help with Math related operations...

    I'm learning JAVA for more than 3 weeks and I really need help...
    I'm using SDK1.4 with Elixir IDE Lite (+patch installed).
    In the following screenshot <http://www.geocities.com/jonny_fyy/pics/java1.png>, I've got this error (when I right-click -> Compile) . Do you know what it means & how can I solve it?
    Here's how it should look if correct (pic scan from lab worksheet)... <http://www.geocities.com/jonny_fyy/pics/lab.jpg>
    Here's my java file... <http://www.geocities.com/jonny_fyy/FahToCeltxt.java>
    Thanks for helping :>

    Hi jonny
    One step ahead:
    import java.awt.*;
    import java.applet.*;
    import java.awt.event.*;
    public class FahToCeltxt extends Applet implements ActionListener {
         TextField msgField ;
         String msg = null;
         int msgValue;
         Label title;
         Button b;
         public void init() {
              title = new Label("Enter degrees in Fahrenheit: ");
              add(title);
              msgField = new TextField (10);
              add(msgField);
    //          msgField.addTextListener(this);
              b = new Button("Convert");
              b.addActionListener(this);
              add(b);
    //     public void textValueChanged(TextEvent event) {
    //          msgValue = Integer.parseInt(msgField.getText());
    //          repaint();
         public void paint (Graphics g) {
              int result = (msgValue - 32) * 5/9 ;
              g.drawString("Degree Centigrade is " + result , 50, 50);
      public void actionPerformed(ActionEvent e) {
              msgValue = Integer.parseInt(msgField.getText());
              repaint();
    }Regards.

Maybe you are looking for

  • How do i use my MAC as a TV?

    I'm not too system savvy and so need a little help.  thank you for whatever help you give.

  • Attachments via Apple Mail

    I've searched and did'nt find an answer to my problem (hopefully I didn't overlook), so I made a post. Lately, my clients and recipients haven't been able to receive my attachments when I send using the Mail.app. If I send a PDF or a regular JPG file

  • How to get Hotmail on iPhone

    I want to know how can I get hotmail on my iphone

  • Java 5 threads in linux

    Hi, I am using the following java version in Linux java version "1.5.0_06" Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_06-b05) Java HotSpot(TM) Server VM (build 1.5.0_06-b05, mixed mode) Threads are created using the source code: pr

  • Inserting 3D-PDF into a standard PDF

    I have done this before many moons ago, see here: http://3d.onlinestoragesolution.com/PDF_MakePart_2D-Dwg/FS-11-008_2D.pdf but can't do it again. What I remember doing is create a u3d from an STP file, then: 1- open up the flat 2D PDF, go to a blank