How to insert/delete elements by SAX?

Hi,
I have been using JDOM and now I need to implement
the XML access using Xerces. I was wondering if
I can insert and delete an element using SAX?
It seems to me that SAX is used to "read" XML.
Thanks!

Yes, you are correct, SAX is used to read XML.

Similar Messages

  • How to insert data elements automatically?

    Hi,
    I am developing an ADF (JSF, BC) application with JDev 10. What I've done up to now is an creation form, where you can put in the attributes of an object which are stored to the database by clicking the commit-button.
    This works well. What do I have to do if I want to automically create a primary key which should be added to the same row by clicking the commit-button? In general I would like to know, how to automatically write elements to the database in case of certain events. Is this realized with mananged beans or do I have to alter the class of the entity object. I've searched for this toppic in the Developers Guide but found nothing.
    I don't have much experience with Java, so if this problem could be solved with Java-Code, it would be nice if you could give me a source where I can read how to program this.
    Thank you in advance.

    Use a database sequence to create the unique key and use the DBSequence type for the attribute in your EO that maps to this key.
    Search for DBSequence in the ADF Developer Guide and you'll see it.

  • How to insert queue element from C

    I want to insert a single queue element into a LabView Queue from C (from a DLL).
    The only thing I found is How to set an Labview-Occurence from C. I assume that I have to do that in 2 steps: 1. copy the string data into the queue with a push/pop command. 2. Set the Occurence from the queue to notify waiting queue elements.
    I only need to know how to realize this in the exactly way. (internals of Queue handling, Queue structure, example code, ....)
    I'm using LabView 6.0.2 with WinNT 4.0
    Thank's for help.
    Robert

    Robert,
    You currently cannot access Queue elements from external code. We hope to add this feature to a future version.
    Marcus Monroe
    National Instruments

  • How to insert 1 element in 2D array?

    There is an example of how to replace element in 2D array, but I would like to insert (not replace), I use the insert element. it does not work for 2 D array.
    Attachments:
    find_and_map_defect_to_image736X554.vi ‏46 KB

    You need to tell more about what you want done. What exactly does it mean
    to insert into a 2D array? Are you inserting into the row or column or
    both? By that I mean to ask what parts of the array get their indices
    incremented. Then what should happen at the endpoints? If you insert a
    point into one row then that row will have one more element than the others.
    Should the last element in that row be lost or should the other rows get a
    zero appended?
    "trout00" wrote in message
    news:[email protected]..
    > There is an example of how to replace element in 2D array, but I would
    > like to insert (not replace), I use the insert element. it does not
    > work for 2 D array.

  • How to insert database elements?

    Hi all,
    could you please tell me .. how to add insert command in our abap program to insert the database elements?  and also we want to know whether we can add the same insert statement we are using on the oracle.we tried with that command but it cause some problem.
    INSERT INTO ZJEYC1 VALUES (' & CUSTNO ' , ' & CUSTNAME & ' , ' & CUSTADDRESS & ' , ' & CUSTMOB & ').
    is it correct?...
    if no please send me the code...

    INSERT - Insert in a database table
    Variants
    1. INSERT INTO dbtab VALUES wa. or
    INSERT INTO (dbtabname) VALUES wa.
    2. INSERT dbtab. or
    INSERT *dbtab. or
    INSERT (dbtabname) ...
    3. INSERT dbtab FROM TABLE itab. or
    INSERT (dbtabname) FROM TABLE itab.
    Effect
    Inserts new lines in a database table .
    You can specify the name of the database table either in the program itself in the form dbtab or at runtime as the contents of the field dbtabname . In both cases, the database table must be defined in the ABAP/4 Dictionary . If the program contains the name of the database table, it must also include a corresponding TABLES statement. Normally, lines are inserted only in the current client. Data can only be inserted using a view if the view refers to a single table and was defined in the ABAP/4 Dictionary with the maintenance status "No restriction".
    INSERT belongs to the Open SQL command set.
    Notes
    You cannot insert a line if a line with the same primary key already exists or if a UNIQUE index already has a line with identical key field values.
    When inserting lines using a view , all fields of the database table that are not in the view are set to their initial value (see TABLES ) - if they were defined with NOT NULL in the ABAP/4 Dictionary . Otherwise they are set to NULL .
    Since the INSERT statement does not perform authorization checks , you must program these yourself.
    Lines specified in the INSERT command are not actually added to the database table until after the next ROLLBACK WORK . Lines added within a transaction remain locked until the transaction has finished. The end of a transaction is either a COMMIT WORK , where all database changes performed within the transaction are made irrevocable, or a ROLLBACK WORK , which cancels all database changes performed within the transaction.
    Variant 1
    INSERT INTO dbtab VALUES wa. or
    INSERT INTO (dbtabname) VALUES wa.
    Addition
    ... CLIENT SPECIFIED
    Effect
    Inserts one line into a database table.
    The line to be inserted is taken from the work area wa and the data read from left to right according to the structure of the table work area dbtab (see TABLES ). Here, the structure of wa is not taken into account. For this reason, the work area wa must be at least as wide (see DATA ) as the table work area dbtab and the alignment of the work area wa must correspond to the alignment of the table work area. Otherwise, a runtime error occurs.
    When the command has been executed, the system field SY-DBCNT contains the number of inserted lines (0 or 1).
    The return code value is set as follows:
    SY-SUBRC = 0 Line was successfully inserted.
    SY_SUBRC = 4 Line could not be inserted since a line with the same key already exists.
    Example
    Insert the customer Robinson in the current client:
        TABLES SCUSTOM.
        SCUSTOM-ID        = '12400177'.
        SCUSTOM-NAME      = 'Robinson'.
        SCUSTOM-POSTCODE  = '69542'.
        SCUSTOM-CITY      = 'Heidelberg'.
        SCUSTOM-CUSTTYPE  = 'P'.
        SCUSTOM-DISCOUNT  = '003'.
        SCUSTOM-TELEPHONE = '06201/44889'.
        INSERT INTO SCUSTOM VALUES SCUSTOM.
    Addition
    ... CLIENT SPECIFIED
    Effect
    Switches off automatic client handling. This allows you to insert data across all clients even when dealing with client-specific tables. The client field is then treated like a normal table field which you can program to accept values in the work area wa that contains the line to be inserted.
    The addition CLIENT SPECIFIED must be specified immediately after the name of the database table.
    Example
    Insert the customer Robinson in client 2:
        TABLES SCUSTOM.
        SCUSTOM-MANDT     = '002'.
        SCUSTOM-ID        = '12400177'.
        SCUSTOM-NAME      = 'Robinson'.
        SCUSTOM-POSTCODE  = '69542'.
        SCUSTOM-CITY      = 'Heidelberg'.
        SCUSTOM-CUSTTYPE  = 'P'.
        SCUSTOM-DISCOUNT  = '003'.
        SCUSTOM-TELEPHONE = '06201/44889'.
        INSERT INTO SCUSTOM CLIENT SPECIFIED VALUES SCUSTOM.
    Variant 2
    INSERT dbtab. or
    INSERT *dbtab. or
    INSERT (dbtabname) ...
    Additions
    1. ... FROM wa
    2. ... CLIENT SPECIFIED
    Effect
    These are the SAP -specific short forms for the statements explained under variant 1.
    INSERT INTO dbtab VALUES dbtab. or
    INSERT INTO dbtab VALUES *dbtab. or
    INSERT INTO (dbtabname) VALUES wa.
    When the command has been executed, the system field SY-DBCNT contains the number of inserted lines (0 or 1).
    The return code value is set as follows:
    SY-SUBRC = 0 Line successfully inserted.
    SY_SUBRC = 4 Line could not be inserted, since a line with the same key already exists.
    Example
    Add a line to a database table:
        TABLES SAIRPORT.
        SAIRPORT-ID   = 'NEW'.
        SAIRPORT-NAME = 'NEWPORT APT'.
        INSERT SAIRPORT.
    Addition 1
    ... FROM wa
    Effect
    The values for the line to be inserted are not taken from the table work area dbtab , but from the explicitly specified work area wa . The work area wa must also satisfy the conditions described in variant 1. As with this variant, the addition allows you to specify the name of the database table directly or indirectly.
    Note
    If a work area is not explicitly specified, the values for the line to be inserted are taken from the table work area dbtab if the statement is in a FORM or FUNCTION where the table work area is stored in a formal parameter or local variable of the same name.
    Addition 2
    ... CLIENT SPECIFIED
    Effect
    As for variant 1.
    Variant 3
    INSERT dbtab FROM TABLE itab. or
    INSERT (dbtabname) FROM TABLE itab.
    Additions
    ... CLIENT SPECIFIED
    ... ACCEPTING DUPLICATE KEYS
    Effect
    Mass insert: Inserzts all lines of the internal table itab in a single operation. The lines of itab must satisfy the same conditions as the work area wa in variant 1.
    When the command has been executed, the system field SY-DBCNT contains the number of inserted lines.
    The return code value is set as follows:
    SY-SUBRC = 0 All lines successfully inserted. Any other result causes a runtime error .
    Note
    If the internal table itab is empty, SY-SUBRC and SY-DBCNT are set to 0 after the call.
    Addition 1
    ... CLIENT SPECIFIED
    Effect
    As for variant 1.
    Addition 2
    ... ACCEPTING DUPLICATE KEYS
    Effect
    If a line cannot be inserted, the processing does not terminate with a runtime error, but the return code value of SY-SUBRC is merely set to 4. All the remaining lines are inserted when the command is executed.
    regards,
    srinivas
    <b>*reward for useful answers*</b>

  • How do I delete elements 11

    Transferred iPhoto to elements, how  to delete and transfer by albums?

    Hi,
    Best to post your question over in the photoshop elements forum
    https://forums.adobe.com/community/photoshop_elements
    You posted in the photoshop beginners forum, which pertains to the full version of photoshop i.e. cs6/cc and is quite different in some aspects.

  • Inserting an element into an XML document

    I am simply looking insert a new element into an existing XML Document using JDOM. Here is my code so far:
    public class UserDocumentWriter {
         private SAXBuilder builder;
         private Document document;
         private File file = new File("/path/to/file/users.xml");
         private Element rootElement;
         public UserDocumentWriter() {
              builder = new SAXBuilder();
              try {
                   document = builder.build(file);
                   rootElement = document.getRootElement();
              } catch (IOException ioe) {
                   System.err.println("ERROR: Could not build the XML file.");
              } catch (JDOMException jde) {
                   System.err.println("ERROR: " + file.toString() + " is not well-formed.");
         public void addContact(String address, String contact) {
              List contactList = null;
              Element contactListElement;
              Element newContactElement = new Element("contact");
              newContactElement.setText(contact);
              List rootsChildren = rootElement.getChildren();
              Iterator iterator = rootsChildren.iterator();
              while (iterator.hasNext()) {
                   Element e = (Element) iterator.next();
                   if (e.getAttributeValue("address").equals(address)) {
                        contactListElement = e.getChild("contactlist");
                        contactListElement.addContent(newContactElement);
                        writeDocument(document);
         public void writeDocument(Document doc) {
              try {
                   XMLOutputter output = new XMLOutputter();
                   OutputStream out = new FileOutputStream(file);
                   output.output(doc, out);
              } catch (FileNotFoundException ntfe) {
                   System.err.println("ERROR: Output file not found.");
              } catch (IOException ioe) {
                   System.err.println("Could not output document changes.");
         }However, the problem is, the newly added element will always be appended to the end of the last line, resulting in the following:
    <contactlist>
                <contact>[email protected]</contact><contact>[email protected]</contact></contactlist>Is there anyway in which I can have the newly added element create it's own line for the purpose of tidy XML? Alternatively is there a better methodology to do the above entirely?

    Your question is not very clear.
    Do you want to know How to insert an element into an XML document?
    Answer: I can see you already know how to do it. You have added the element using addContent()
    or do you want to know How to display the XML in a tidy format?
    Answer: to view the XML in a properly formatted style you can you the Format class. A very basic way of viewing the XML would be:
       * Prints the Document to the specified file.
       * @param doc
       * @param filename
       * @param formatting
      public static void printDocToFile(Document doc, String strFileName,
          boolean formatting)
        XMLOutputter xmlOut = null;
        if (!formatting)
          xmlOut = new XMLOutputter();
        } else
          Format prettyFormat = Format.getPrettyFormat();
          prettyFormat.setOmitEncoding(false);
          prettyFormat.setOmitDeclaration(false);
          xmlOut = new XMLOutputter(prettyFormat);
        try
          if (doc != null)
            FileWriter writer = new java.io.FileWriter(strFileName, true);
            xmlOut.output(doc, writer);
            writer.flush();
            writer.close();
          } else
            System.out.println("Document is null.");
        catch (Exception ex)
          System.out.println(ex);
      }

  • Add/Delete elements from viewcontaineruielement in web dynpro abap

    Dear all,
    Please let me know how to Add/Delete elements from viewcontaineruielement in web dynpro abap? I have copied a viewcontaineruielement from another program and now i dont want few elements from that viewcontaineruielement in my view. Please guide

    Hi Ajinkya,
    I have copied a viewcontaineruielement from another program and now i dont want few elements from that viewcontaineruielement in my view. Please guide
    Have you saved that VC element as template and using that template in another component?.If so,on resuing that VC element template it populates all the screen elements which you've save as template.
    Now, select that VC element which you've re-used,based on you're requirement add/remove UI elements as Kiran suggested.
    Hope it will resolve your issue.
    Thanks
    KH

  • Hihow to insert 2 elements into 2D array?

    Hi I had a hard time figuring out how to insert 2 elements into 2D arrays. 
    I tried using replace and insert array functions but it does not work right way.
    I am using LV7.1. See the pic below.
    How do I insert elements in that way?
    Pls advise
    Clement

    Well, "replace array subset" is not the right tool, because it keeps the size of the array constant. Insert into array only works for entire rows or columns.
    You need a hybrid approach, because you want to insert elements at the beginning of column 1 while padding the remaining columns to the new lenght of column 1. This won't be efficient but there are plenty of ways to do that (here is one example with DBL arrays, should work equally well for string arrays as in your case).
    How much flexibility do you need? Is it always at the beginning of the first column? Are the arrays huge (=is performance an issue)? Is this a rare operations or do you constantly need to do this (e.g. inside a loop).
    In any case this seems like a rather arbitrary and somewhat silly operation. What is the practical purpose?
    LabVIEW Champion . Do more with less code and in less time .
    Attachments:
    WeirdMerge.vi ‏21 KB

  • Insert,delete,update in oracle Rac11g2

    hi all.
    i am using oracle grid 11g R2,oracle database 11g R2 and oracle Linux Enterprise 5.5.
    i tried to use insert,update and delete in oracle Rac but wihout commit iit did not delete,update and insert in Node2.
    plz can anyone help me that how to insert,delete and update without issuing commit in node1 and perform the action
    on node2 as well?
    Kelly

    Hi Kelly,
    Now I get it, but unfortunately there is no way to do it. TAF can allow only session failover, or query failover (a running query will continue in the other node). But anyway, there is no way to failover a transaction. The transaction will be rolled back automatically (no question or any other option) and the session will get an error. However, the session will be connected to the other node and can continue working or retry the operation.
    HTH
    Liron

  • How to delete elements from a cluster?

    Hello. I would like to know how to delete elements from a cluster. I got stuck with this problem. There is its own order of each element in a cluster. I tried to initiate an array but it seems like too complicated. In the attached file, I want to obtain only the data from "flow" not "pressure". I try to use array programming but it doesn't work. Would be nice if you help me to fix the file. Thanks
    Solved!
    Go to Solution.
    Attachments:
    test 1.vi ‏16 KB

    Bombbooo wrote:
    What about if I want to store data into the pressure array too? Do I have to create another loop or it can be done in the same loop as the flow loop?
    Try this, for example. Modify as needed.
    LabVIEW Champion . Do more with less code and in less time .
    Attachments:
    test1MOD2.vi ‏9 KB
    SelectFlowOrPressure.png ‏7 KB

  • How to remove the the standard button APPEND/INSERT/DELETE in webdynpro alv

    Hello,
    how to remove the the standard button APPEND/INSERT/DELETE in webdynpro-abap  alv
    Thanks
    Rakshar

    Use  this.
        data lo_cmp_usage type ref to if_wd_component_usage.
        lo_cmp_usage =   wd_this->wd_cpuse_alv1( ).
        if lo_cmp_usage->has_active_component( ) is initial.
          lo_cmp_usage->create_component( ).
        endif.
        data lo_interfacecontroller type ref to iwci_salv_wd_table .
        lo_interfacecontroller =   wd_this->wd_cpifc_alv1( ).
        data lo_value type ref to cl_salv_wd_config_table.
        lo_value = lo_interfacecontroller->get_model(
        data: lr_std type ref to if_salv_wd_std_functions.
        lr_std ?= lo_value.
        lr_std->set_export_allowed( abap_false ).
    NOte: ALV1 is alv component name
    Regards
    Srinivas
    Edited by: sanasrinivas on Dec 1, 2011 6:11 AM

  • In Elements 7.0, how can I delete multiple photos at the same time?

    In Adobe Photoshop Elements 7.0, how can I delete multiple photos at the same time?   Please be a little specific so I can follow your instructions as I'm not real smart at computers; I'm an intermediate user.  Thank you.

    Shift-click the photos or Ctrl-click them to select them, then right-click one of them and choose Delete from Catalog. They will all go together.

  • How do I delete more than 1 slide at a time from the custom slide show in Elements 8

    How do I Delete more than 1 slide at a time from the custom slide show in Elements 8?

    How to Mass Delete Emails from iPhone and iPad Inbox (with video)
    http://suiteminute.com/how-to-mass-delete-emails-from-iphone-and-ipad-inbox/
     Cheers, Tom

  • How can I delete a subscribed calendar, Hong Kong holidays from calendar on Ipad 4. This was inserted through a hacked gmail account.

    I Have an ipad 4 with ios 7. Through clicking on a link sent in a hacked gmail account, a 'subscribed' calendar, named Hong Kong holidays has been inserted into my calendar. How do I delete this calendar and how does it affect my personal details?
    I have changed my password.
    THank you

    Hi Cigire34,
    Welcome to Apple Support Communities.
    Are you syncing the iPad with a computer and do you see the account on your computer? It sounds like you may have Google Calendar account setup on your iPad, which will have to be deleted from settings or the Google site. The instructions in the following article should help.
    iOS: Syncing multiple Google CalDAV calendars
    http://support.apple.com/kb/ht4372
    After adding your Google Calendar account using Settings > Mail, Contacts, Calendars > Add Account… > Other > Add CalDAV Account, the primary calendar will sync with your device.
    To sync additional Google Calendars, you must configure them using this tool on the Google website. Note that you must log in to your Google account to access this page.
    Cheers!
    -Jason

Maybe you are looking for