How to delete element using XmlCursor

Hi
I am using XMLBeans for bidirectional binding (XML to Java and after user updates
back to XML).
I do not want to use a direct setter (e.g. doc.setAccount (account)) because I
am developing a framework and I need to provide an API to the callers. It would
have helped if the setters accepted XmlObject, then I could use polymorphism.
But that is a different topic.
Hence, I have tried to use cursors. I have my cursor advance to an element. I
do not find a method in the Javadoc to delete the element (so that I can replace
it with the updated XML). I tried the method remove, but got an error that read
"java.lang.IllegalStateException: Can't remove this". Does not tell why (reminded
me of MC Hammer).
Can someone tell me what method I can use to delete or update the element being
pointed by the cursor ?
Thus if Account is a complex Type, I would like to update just the Account element
(and all the elements it contains). The rest of the doc should remain the same.
Thanks

Remove is the correct function to call on the cursor. If the current token is
a start token, then the remove should work. You will get such a message if the
current token is s startdoc, enddoc or end.
"Shashi Garje" <[email protected]> wrote:
>
Hi
I am using XMLBeans for bidirectional binding (XML to Java and after
user updates
back to XML).
I do not want to use a direct setter (e.g. doc.setAccount (account))
because I
am developing a framework and I need to provide an API to the callers.
It would
have helped if the setters accepted XmlObject, then I could use polymorphism.
But that is a different topic.
Hence, I have tried to use cursors. I have my cursor advance to an element.
I
do not find a method in the Javadoc to delete the element (so that I
can replace
it with the updated XML). I tried the method remove, but got an error
that read
"java.lang.IllegalStateException: Can't remove this". Does not tell why
(reminded
me of MC Hammer).
Can someone tell me what method I can use to delete or update the element
being
pointed by the cursor ?
Thus if Account is a complex Type, I would like to update just the Account
element
(and all the elements it contains). The rest of the doc should remain
the same.
Thanks

Similar Messages

  • 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

  • My icloud storage is almost full, i have a lot of rubbish photos and things backed up but i do not know how to delete them using icloud

    my icloud storage is almost full, i have a lot of rubbish photos and things backed up but i do not know how to delete them using icloud

    Delete them from your phone and then do another backup.

  • How access an element using getElementById() without absolute path?

    hello,
    Currently I'm working on a JSF woodstock project.
    I'm trying to acceess the different components used the JSF page inside a javascript by using document.getElementById()
    this is a part of code in my JSF file. please have a look on it.
    <webuijsf:form id="form1">
                            <webuijsf:panelGroup id="pnlGrpBankListMainContainer" style="left:2px; top:89px; margin-left:1.5%; margin-top:1%; width:50%; position:absolute;">
                                <webuijsf:table augmentTitle="true" title="#{BankList.screenName}" id="table1" paginateButton="true"
                                    paginationControls="true" clearSortButton="true" extraActionTopHtml="style='height:35px'">
                                    <f:facet name="actionsTop" >
                                        <webuijsf:panelGroup id="grpPnlButtons">
                                            <webuijsf:checkbox binding="#{BankList.chkBoxSelectAllItems}" id="chkBoxSelectAllItems" name="chkBoxSelectAllItems" rendered="#{BankList.renderChkBoxAndImgSeparator}"
                                                selectedValue="selectAllItems" onClick="selectAllTableRows(this,'chkBoxBankListSelectedRowId',5);"/>
                                            <webuijsf:image id="imgSeparator" url="/resources/images/select_image_separator.gif" rendered="#{BankList.renderChkBoxAndImgSeparator}" />
                                            <webuijsf:button id="btnAdd" rendered="#{BankList.renderAddButton}"  text="Add" styleClass="btnStyle" immediate="true"
                                                onClick="return openAdd('#{BankList.requestContextPath}/faces/BankEntry.jsp', 500, 755,'Add  #{BankList.screenIdentifier}', '&action=ADD');"/>
                                            <webuijsf:button id="btnEdit"  rendered="#{BankList.renderEditButton}"  text="Edit" styleClass="btnStyle" disabled="#{BankList.disableEditButton}"
                                                onClick = "return openEdit('#{BankList.requestContextPath}/faces/BankEntry.jsp', 'chkBoxBankListSelectedRowId', 500, 755,'Edit  #{BankList.screenIdentifier}', '&action=EDIT');"/>
                                            <webuijsf:button id="btnDelete"  text="Delete" onClick="return confirmRecordsDelete();"  rendered="#{BankList.renderDeleteButton}"  styleClass="btnStyle" disabled="#{BankList.disableDeleteButton}"/>
                                            <webuijsf:button id="btnExportXls" disabled="#{BankList.disableExcelButton}" rendered="#{BankList.renderXlsButton}"
                                                styleClass="btnStyle #{BankList.excelButtonStyleClass}" style="position:relative; margin-left: 10px"
                                                text="x" onMouseOver="setMouseOverStyle(this);" onMouseOut="setMouseOutStyle(this);"
                                                onClick="return openXlsExport('#{BankList.requestContextPath}/faces/Export.jsp', 'chkBoxBankListSelectedRowId', 'Export  #{BankList.screenName}', '&screenIdentifier=#{BankList.screenIdentifier}');">
                                            </webuijsf:button>
                                        </webuijsf:panelGroup>
                                    </f:facet>when i access button element using absolute path like
    document.getElementById("form1:pnlGrpBankListMainContainer:table1:grpPnlButtons:btnEdit") it works fine.
    But when i try to access it using
    document.getElementById("form1:table1:btnEdit") it returns null.
    I've common javascrpt functions for all the screens.
    so i do not want to change the current javascript functionality nor do i want want to specify complete path for an element.
    So is there any way so that i can access the elements without absolute path or any othet solution?
    Edited by: sonali_amonkar on Apr 1, 2008 11:17 PM

    thanks for your reply mjswallow.
    Do you mean that I'll write a new javascript which will accept all the parent elements and inside this method I'lll call the common javascript methods that are present in our project?
    but this solution would result in changing the already existing javascript methods that i coded for all screens. right?
    that is i do not want to change.
    any other solutions you can think of?

  • How to delete term using powershell?

    Hello
    I want to delete a particular term from termstore. I dont have termset name. Without termset name how can I delete term using powershell?
    Avi

    If you don't know the termset net it makes it tricky.
    In theory if you know the name of the term you could look through all termsets to find it. The catch of course is to ensure there is only one instance of the term otherwise you may delete terms you need.
    Which version of SharePoint?
    Jason Warren
    @jaspnwarren
    jasonwarren.ca
    habaneroconsulting.com/Insights

  • How to delete database using sql

    I have to delete some databases from oracle 8i. I tried it using the Database Configuration Assistant and I get stuck indefinately as the message always says connecting but nothing happens.
    How can I delete databases using sql not thru the DCA?
    Thanks

    files related to the database and follow these steps:
    1.- shutdown the database
    2.- Delete all files ( Control Files, .dbf, Redo's, Archive�s, parameter file, password file )
    3.- Delete the entrance of this database from
    listener.ora and from tnsnames.ora files.
    and that's it.
    Joel P�rez

  • How to delete PostOffice using AdminTypeLibrary (C#)

    Is there any way to delete PostOffice using Admin Object API?
    Thank you in advance.
    Kahren

    In article <pus1d.8585$[email protected]>, kallak2000
    @hotmail.com says...
    > Is there any way to delete PostOffice using Admin Object API?
    >
    > Thank you in advance.
    >
    > Kahren
    >
    >
    >
    Hello, Kahren.
    Because of all the steps actually involved, and the complexity it is not
    possible to delete or create Post Offices, Domains or MTAs with the
    APIs.
    Regards,
    Shane

  • Add Column Delete  in report, How to delete row using this delete Option

    Hi Friends,
    i have a report ,iwant to add an option DELETE in last column.When i click on DElete then respective id sholund be deleted.
    My Table Is
    CREATE TABLE  "DUMY_FILE"
       (     "ID" NUMBER,
         "NAME" VARCHAR2(500),
         "FILE_OBJ_ID" NUMBER,
         "MIME_TYPE" CLOB,
         "DOC_SIZE" NUMBER,
         "BLOB_CONTENT" BLOB,
         "DESCRIPTION" VARCHAR2(500),
         "UPLOAD_DATE" CHAR(25)
    How can i do this.
    Thanks
    Edited by: 805629 on Nov 16, 2010 11:51 PM                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

    Trent,
    Thanks for you suggestions. .. Let me explain my problem a little better ...
    I have a report that lists fields associated with a report ... I have a delete icon which deletes a row and removes it from the underlying table ... however, I am trying to implement a Before header process which runs a pl/sql process that checks if the selected field is the last field in the report ... if so, I want a confirmation dialog to pop up ... if they click cancel .. then the deletion is aborted, else the field is deleted (which triggers other status changes).
    Based on this logic if there is a way to implement this based on your suggestion I would appreciate it ...
    Here is the process I was trying to use .... but the I have a few issues with this approach
    declare
    -- cursor to check if this is the last field
    cursor fld_cnt is
    select count(*) from prm_ptnr_rpt_fields
    where report_uid = :P22_REPORT_UID;
    num_flds number;
    msg varchar2(300);
    begin
    open fld_cnt;
    fetch fld_cnt into num_flds;
    If num_flds > 1 then
    delete from prm_ptnr_rpt_fields
    where report_uid = :P22_REPORT_UID
    and field_user_key = :P9_DELETED_FLD;
    commit;
    :P9_DELETED_FLD := NULL;
    msg := :P9_FIELD_NAME || ' Field Excluded From Report' ;
    apex_application.g_print_success_message := msg;
    else
    htp.p('<script type="text/javascript">');
    htp.p('
    var r=confirm("This is the last field included in this report .. \n Deleting it will Inactivate the report and remove it from schedule (if scheduled) ...\n Do you want to proceed?");
    if (r==true)
    {      delete from prm_ptnr_rpt_fields 
    where report_uid = :P22_REPORT_UID
    and field_user_key = :P9_DELETED_FLD;
    :P9_DELETED_FLD := NULL;
    commit;
    msg := :P9_FIELD_NAME || ' Field Excluded From Report' ;
    update prm_ptnr_rpts
    set report_status = 'INCOMPLETE',
    active_report = 'N'
    where report_uid = :P22_REPORT_UID;
    msg := msg || ' and Report Status changed to INCOMPLETE';
    apex_application.g_print_success_message := msg;
    htp.p('}else {
    alert("Delete Action Aborted");
    htp.p('</script>');
    End if;
    Close fld_cnt;
    end;
    a) Even if I click cancel ... the field still gets deleted ...
    b) :P9_DELETED_FLD is the id for the selected field ... I am setting it on the link attributes which places it on the URL ... I would rather user javascript (but not exactly sure how).
    Thanks,
    Gerald
    Edited by: user5459177 on Feb 22, 2011 2:45 PM

  • How to delete group using SPML

    Hi,
    While deleting the group using SPML, we should remove "Access Policies", Users, Membership Rules associated with the group. Can anyone tell me how to do this(de-associating access policies, membership rules and users with group) using SPML??
    Thanks in Advance

    same way you delete a non-group message.

  • How can delete MBean using MBeanHome?

    Hi, I am using the MBeanHome to create / get mbeans, now I need to delete/remove mbean.
    can I do that using MBeanHome? If I can: How can I do that?

    use MBeanHome.getMBeanServer().unregisterMBean
    "Tal" <[email protected]> wrote in message
    news:[email protected]..
    >
    Hi, I am using the MBeanHome to create / get mbeans, now I need todelete/remove mbean.
    can I do that using MBeanHome? If I can: How can I do that?

  • How to delete songs using ios 7

    How do I delete songs on both my iPhone5c using IOS 7 and on my iTunes account?

    To delete tracks in the Music app, navigate to any view that shows you a list of songs, swipe to  the left, tap Delete.
    You can't remove purchases completely from your itunes account (music or apps), but youcan hide them using itunes installed on a computer. On teh iPhone, if you do not wish to see purchased track in the Music app view: Settings app > Music > Show All Music (turn OFF).

  • How to delete the record in the table without using lead selection?

    hi,
    I have added the separate column "delete" to the table uielement and so for each record or row of the table the appropriate "delete" link to action will be there................the code below works when the particular row is selected through lead selection only.......
    help me how to delete without using lead selection.....
      DATA:
      NODE_MODULE                         TYPE REF TO IF_WD_CONTEXT_NODE,
      ELEM_MODULE                         TYPE REF TO IF_WD_CONTEXT_ELEMENT,
      STRU_MODULE                         TYPE IF_V_MODULE=>ELEMENT_MODULE .
       data itab TYPE TABLE OF zac_modules.
      navigate from <CONTEXT> to <MODULE> via lead selection
      NODE_MODULE = WD_CONTEXT->GET_CHILD_NODE( NAME = `MODULE` ).
      get element via lead selection
      ELEM_MODULE = NODE_MODULE->GET_ELEMENT(  ).
      get all declared attributes
      ELEM_MODULE->GET_STATIC_ATTRIBUTES(
        IMPORTING
          STATIC_ATTRIBUTES = STRU_MODULE ).
    NODE_MODULE->GET_STATIC_ATTRIBUTES_TABLE(
        IMPORTING
         TABLE  = itab )
    DELETE itab WHERE zmodule_id = STRU_MODULE-zmodule_id.
    CALL METHOD NODE_MODULE->BIND_TABLE
        EXPORTING
          NEW_ITEMS            = itab
       SET_INITIAL_ELEMENTS = ABAP_TRUE
       INDEX                =
    ENDMETHOD.

    Hi  ,
    The onclick event provides you with a standard paramater "CONTEXT_ELEMENT" which has the element from which the event is triggered.
    so you can declare this in the handler(if it is not there) and use it as follows.
    CONTEXT_ELEMENT  TYPE REF TO IF_WD_CONTEXT_ELEMENT  an importing paramater.
    DATA:
    NODE_MODULE TYPE REF TO IF_WD_CONTEXT_NODE,
    ELEM_MODULE TYPE REF TO IF_WD_CONTEXT_ELEMENT,
    STRU_MODULE TYPE IF_V_MODULE=>ELEMENT_MODULE .
    data itab TYPE TABLE OF zac_modules.
    CONTEXT_ELEMENT->GET_STATIC_ATTRIBUTES(
    IMPORTING
    STATIC_ATTRIBUTES = STRU_MODULE ). "Using the context_element paramater to get the static attributes.
    NODE_MODULE->GET_STATIC_ATTRIBUTES_TABLE(
    IMPORTING
    TABLE = itab )   "getting all the data.
    DELETE itab WHERE zmodule_id = STRU_MODULE-zmodule_id. "deleting the particular row from the table and binding it.
    CALL METHOD NODE_MODULE->BIND_TABLE
    EXPORTING
    NEW_ITEMS = itab
    * SET_INITIAL_ELEMENTS = ABAP_TRUE
    * INDEX =
    thanks,
    Aditya.

  • Delete ccmcache used space

    Hi All
    I have a question regarding client cache removal using a powershell script calling a com object
    My C drive contains 18 GB free space
    Total CCM Cache in c:\windows\ccmcache size is 10240
    Free Space = 8713  and used space = 1527
    I used the following powershell script to remove used space by using DeleteCacheElement function
    Though all folders were removed in cache but I still see used space even after using the script
    May I know the reason and how to delete the used space
    $UIResourceMgr = New-Object -ComObject UIResource.UIResourceMgr
    $Cache = $UIResourceMgr.GetCacheInfo()
    $CacheElements = $Cache.GetCacheElements()
    foreach ($Element in $CacheElements)
            Write-Host "Deleting CacheElement with PackageID $($Element.ContentID)"
            Write-Host "in folder location $($Element.Location)"
     If (!(Test-Path $($Element.Location)))
       md $($Element.Location)
           $Cache.DeleteCacheElement($Element.CacheElementID)
    $Cache = $UIResourceMgr.GetCacheInfo()
    Write-Host "The total Cache size = $($Cache.TotalSize)"
    Write-Host "The total Cache free size after execution of script= $($Cache.FreeSize)"
    Write-Host "The total Cache used size after execution of script = $(($Cache.TotalSize) -($Cache.FreeSize))"

    Though all folders were removed in cache but I still see used space even after using the script
    How? Are you talking about this line of the script? Write-Host "The total Cache free size after
    execution of script= $($Cache.FreeSize)"
    Torsten Meringer | http://www.mssccmfaq.de

  • How to Delete emails in Specific range on database level (Exchange 2010)

    Hi All,
    Kindly assist me on deleting emails in specific range. i have exported all users mailbox using this below powershell script and in the same manner can we delete all the emails from users mailboxes in the below date range. Please advise
    foreach ($usr in (Get-Mailbox -Database "DB01")) { New-MailboxExportRequest -ContentFilter 
    {(Received -lt "12/07/2012")} -Mailbox $usr -FilePath \\Server01\DB01_Export\$($usr.Alias).pst・}
    Thanks, Venkatesh. &quot;Hardwork Never Fails&quot;

    Hello,
    You can use search-mailbox cmdlet with -deletecontent switch:
    http://technet.microsoft.com/en-us/library/ff459253(v=exchg.141).aspx
    http://andersonpatricio.ca/how-to-delete-messages-using-search-mailbox-in-exchange-server-2010/
    Hope it helps,
    Adam
    www.codetwo.com
    If this post helps resolve your issue, please click the "Mark as Answer" or "Helpful" button at the top of this message. By marking a post as Answered, or Helpful you help others
    find the answer faster.

  • Delete Initialization using Process Chain

    Hi Experts,
    How to delete initialization using process chain? Additional question, why does our DTP couldn't get any data from PSA? We just transfer our DTP to other process chain and left its associated infopackage from the original process chain but when we check our extraction, our DTP always gets zero (0) records. What do we need to put in our DTP settings? and infopackage and DTP should always be in the same process chain??
    Thanks,
    nips

    Hi UserPV,
    Thanks for your inputs!
    Anyway, our InfoPackage in the other Process chain executed succesfully and has an extracted data. Now, our DTP can't get any data from the PSA where the extracted data of InfoPackage resides first. Is there any other way around to separate DTP and its associated infopackage in different process chains? Or those objects should be in the same process chain?
    Another questions, how can we delete an initialization using a process chain? and is there a function module that can we use to remove the initialization request so that we could re-initialize a process?
    Thanks,
    nips

Maybe you are looking for

  • Trying to update the First Gen Ipod to the newest IOS if possible!

    Hello Im trying to update two older verison's IPod First Gen. The one is verison... 4.2.1 (8C148) its a 8GB model number MCC086LL serial Number 1D034SRL75J I dont know if this information is needed but i put it up here anyway. The other one is veriso

  • Deltas are not updating to subsequent data targets?

    Hi, We are running process chain which loads  delta data to a DSO O1 and then to DSO O2 .Then FULL upload will be done to CUBE by deleting the last request every time. Till yesterday the data was loading to O2 DSO properly.But only one load has taken

  • Positioning of the menu fly-outs

    Hi, I have created a horizontal menu using CSS on a JSP. This is a three level menu, meaning, it is having fly-out sub menus till third level. The problem is that, the contents in the menu are quite a bit so for viewing all the entries, one has to us

  • I tunes does not open and ipod is concidered a drive

    when i plug my ipod into my windows vista home primium pc, it calls it a disk (and i do not have it on any sort of disk, auto select mode) and itunes does not open, and i have open itunes when ipod is connected. This started when i updated to the las

  • Why does InDesign always open multiple files in reverse number order?

    Whenever I select multiple InDesign files to open, despite being named accordingly Page_01, Page_02, Page_03, etc. InDesign always opens them in reverse order tabs. If I open 10 spreads at once instead of staring at page 1 I'm looking at the back. Is