JDOM copy element without content

Hi!
I like to copy an element X from an (input) JDOM document to become the root element of a new (output) JDOM document. I can do that. so far so good. Only the input JDOM I'm touching is quite lange and from the element to copy, the complete content (many other elements) gets copied aswell. But I need to copy just the start tag with it's attributes and the end tag. like:
Input JDOM
<Y>
<X abc="123" def="456">
<A xyz="234">
InhaltVonA
</A>
<B>
<C www="http"/>
</B>
</X>
</Y>
Output JDOM
<X abc="123" def="456">
</X>
How can I do that?
Cheers,
Marcello, Germany

.removeContent is the one to be known..
SAXBuilder builder = new SAXBuilder();
File f = new File("xml.xml");
Document doc = builder.build(f);
// get the root element
Element rootElement = doc.getRootElement();
// get the X element
Element xElement = rootElement.getChild("X");
//clone the X element and remove all
// children
Element copyOfX = (Element)(xElement.clone());
copyOfX.removeContent();
// create a new document with the x element
Document doc2 = new Document(copyOfX);

Similar Messages

  • Copy/paste without using the clipboard?

    Can this be done without using the clipboard?
    myTable.select()
    app.copy()
    app.select(myCopyFrame.insertionPoints.item(0));
    app.paste();

    Can you please not use that site, or (if you must) at the very least not refer to it in this forum?
    Its entire contents is "stolen" -- the guy who made it advertises himself as "proficient XML and HTML programmer", but rather than proving it by doing something worthwhile himself, he copied the entire contents of the heavily improved HTML version I made from Adobe's own documentation. To add insult to injury he wrapped it up in heavily advertised pages.
    The help text is Adobe's own, but I vastly improved upon it by adding yet even more hyperlinks, categories, and a graphic hierarchical view. An even better version than the one this ****head stole can be downloaded for free (and without any advertisements) from http://www.jongware.com/idjshelp.html. I made it better just to prove I could; so far this stinking thief didn't dare copy the latest version -- yet.

  • Locked Objects when i try to copy elements from one folder to another

    Hi,
    Could anyone help me to resolve a lock problem in the portal-content studio? I try to copy elements (iviews or pages) from one package(folder) to another and the objects have been locked.
    How can I set another lock time different from the system time (36 000sek.)?
    and how should I copy this files/elements to avoid this locking situation?
    thx in advance

    hi
        to unlock the objects <system admin><monitoring>in detailed navigation <portal>drill down <object locking> u may check to unlock the objects..

  • Premiere Elements 10 content will not download?

    Every time I launch the program it says I don't have the content installed. It says to insert the CD or download, I purchased a download version so I try to download and it asks me to select a folder and opens a browse window but no matter what folder I tell it to download it say to select a different folder and try again, even if I create a folder on the desktop it does the same - yes, I am using admin - any suggestions?

    jmadl
    Thanks for the follow up.
    I am just starting my day. As soon as possible I will try to download that Premiere Elements 10 Content to my Windows 7 or 8 64 bit computer and see what problems I run into.
    What is your download choice - All Content or one of the groups at a time?
    I just did the download of just "Content 3....." without problem. The process initially required that I download the Akamai NetSession Interface which I did. Then I got the Browse for Folder message. At that time, I selected Desktop, New Folder which I named PE10 Group 3. The download proceeded to completion successfully.
    Next I will try for the All Content download and see if I can get beyond the Browse for Folder message.
    Keep in mind that my Windows 7 Professional SP1 64 bit has far less resources than your computer and that I did not stop to turn off firewalls or anti-virus for this test run.
    I will report back very soon with further results. I am located on the east coast of the USA and, at this moment, that link to the Premiere Elements 10 Content seems to be OK. Internet connection is DSL (not highest speed).
    To be continued...
    ATR
    Add On...the results for going the All download representing 2.95 GB, instead of just one group at a time, route was the same, that is, no problems with the request for designate a folder and the creation of that folder to accept the download.

  • Creation of PL Element without it being a cost element

    Hi
    I have to asign two PL elements in T code 0KEK for transfer of material between two profit centers. The two elements should not be <b>cost elements</b> but they should be PL Elements to be used only in PCA.
    We have to create PL elements through FS00. But the system automatically creates a new cost element when i create a GL as a PL nature. Pls let me know how to create a PL element without it being a cost element.
    Regards
    Sanil Bhandari

    Hi Sanil
    IN OB13 
    Controlling integration tab
    select : Manual creation of cost element and create GL accts.
    Hope this works
    Best Regards
    Ashish Jain

  • How do I install photoshop elements without a disk drive

    How do I install photoshop elements without a disk drive. My Mac does not have one and have just bought Elements

    Downloads available:
    Suites and Programs:  CC 2014 | CC | CS6 | CS5.5 | CS5 | CS4 | CS3
    Acrobat:  XI, X | 9,8 | 9 standard
    Premiere Elements:  12 | 11, 10 | 9, 8, 7
    Photoshop Elements:  12 | 11, 10 | 9,8,7
    Lightroom:  5.5 (win), 5.5 (mac) | 5.4 (win), 5.4 (mac) | 5 | 4 | 3
    Captivate:  8 | 7 | 6 | 5
    Contribute:  CS5 | CS4, CS3
    Download and installation help for Adobe links
    Download and installation help for Prodesigntools links are listed on most linked pages.  They are critical; especially steps 1, 2 and 3.  If you click a link that does not have those steps listed, open a second window using the Lightroom 3 link to see those 'Important Instructions'.

  • How do I copy the entire contents of my laptops failing hard drive to copy back onto a new computer.

    How do I copy the entire contents of my laptops failing hard drive to copy back onto a new computer.

    If the drive has failed the only way to get any data off it is to send it to a Data Recovery company. Which is very expensive and no guaranty they will be able to retrieve any data.
    That is why Apple has included a system to backup your Mac on a regular basis, Time Machine. Also there are other Apps to do basically the same thing by Cloning your internal drive to an external drive. Carbon Copy Cloner and SuperDuper. Along with using Disk Utility to Image the internal drive to an external drive.
    Sorry to tell you but if the drive has really failed your Data is gone unless you pay a large sum of money to one of the Data recovery companies.

  • 3D PDF files in portfolio prints to Adobe PDF printer without content

    3D PDF files in portfolio prints to Adobe PDF printer without content, but if printed from single 3D PDF file everything is fine. I need batch printing (this is the reason I use portfolio) of large amount of 3DPDF files because of the need to have proper preview of these files in browsers. Any ideas or workarounds how to have preview pdf's or jpg's of the single paged 3D PDF files, keeping relevant file names?

    I suspected as much.  I was hopeful it was something like a setting that needed to be changed or a reg hack that needed a bit changed from 0 to 1 to make the printing work as expected.  I only installed the local printer to see if the RDP session
    tunnel was in fact causing the print size to balloon so I will continue to instruct users to use that instead of the local redirected printer.  I am disappointed but not surprised.
    Edit:
    Additionally I have tested the functionality of setting the GPO settings for Easy Print to use the redirected printer's drivers instead of the ones used by easy print, by setting “Computer
    Configuration -> Administrative templates -Windows Components -> Remote Desktop Services > Remote Desktop Session Host -> Printer Redirection”.
    to “Disabled” but
    with no luck.  In fact the printer received the proper Adobe PDF driver, but the job went out into print spool hell and was lost to the ether.  I have concluded that this approach will not bear any fruit.

  • How can I copy/transfer iTunes content ?

    How can I copy/transfer iTunes content from my old computer to the new one, considering that for some reason Target Mode and Migration Assistant doesn't work for me ?
    I don't need the application itself (it comes with the new computer) but just the content.
    I want to transfer my collection of CD in iTunes. they are all CD that I physically have in my living room, listen to them on my stereo and have copy them in my computer (which is in the Den) so I can listen while working on my computer.
    The iTunes is version 9.0.2
    Can I drag it to the external drive or perhaps just the songs, then copy/drag them to my new computer ?

    Hi-
    Can I drag it to the external drive or perhaps just the songs, then copy/drag them to my new computer ?
    Pretty much, Yes.
    If you wish to keep the formatting, notes, ratings, etc. that are with the library, you should allow the iTunes software to "discover" the library.
    If the iTunes Library from one machine is placed on an external drive, the iTunes software on the other machine can be directed to the library of the external drive when connected.
    Allowing "Copy to Home folder/music" will provide for copying of the library to the new machine.
    Alternatively, if the library is loaded onto an iPod, the iPod can be used to transfer the music.
    http://support.apple.com/kb/HT1329

  • I am trying to Copy paste some content from PDF reader with no success

    Hi,
    I am new here, hope I will find the answer to my prob.
    I am currently working on an Ebook I plan publishing, discussing affiliate marketing.
    I am using some resources from other Ebooks I purchased and have in hand.
    * While I am trying to copy paste some content, it does copy, but when trying to place it in a notepad file, the content is being copied as gibberish. (signs and spaces).
    I've tried using microsoft word, then i totally gets out of contrast.
    Did anyone experience something alike?
    Thank you.
    Mia.

    This is common. In this case it may be done to protect the copyright
    content of the ebook from reuse. Since the amount you can use under
    fair use is only a few sentences, it shouldn't take too long to
    retype...
    Aandi Inston

  • E-Mails in IPad and iPhone without content and sender "This E-Mail has no content"

    Often I get E-Mails listet without content and no sender "This E-Mail hasn't got any content" I can't get rid of the ghost, only by  total restarts. . Why does this happen and how can Iavoid this?  Klaus

    Move them out of the trash and back into the Inbox.
    Open the Trash, tap Edit, tap the email to select it, then tap Move.

  • In PC I have changed the default app location from default to other and copied the previous content to new location and changed the Default location in preference. Now in iTunes, my previous apps are not visible. Is there any solution to this?

    In PC I have changed the default app location from (c:/users/username/My Music/iTunes) to other (d:iTunes)  and copied the previous content to new location and changed the Default location in Edit preference. Now in iTunes, my previous apps are not visible. Is there any solution to this?

    wjosten - thanks very much for the detailed instructions. I'll try this as soon as I get my replacement and it looks like you'll probably end up getting the green tick

  • Can't copy text without HTML

    Is it possible to select text from a website and copy it without getting all the HTML link coding too? For instance, I look up an address on google maps and want to copy the text of the address into a word doc or email and get all this HTML code that I then have to delete. How do you copy text only?

    Hi JJMack and anyone else having the same issue!
    I have a solution for the problem: I went to Keyboard shortcuts and Menus, and strangely Edit/Copy had F3 associated with it. I use Photoshop for ten years now and I never changed that shortcut, not even recently. Strange, because I would remember that I changed that, it's not something you can mess with a couple of incidental clicks or key strokes.
    So for anyone having the same issue: check your Keyboard shortcuts and if it is for some reason changed, set it back to Ctrl+C or anything you like and know.
    Link to Photoshop family discussion

  • How can I copy/paste without copying the formatting?

    How can I copy/paste without copying the formatting? For example, if I copy a sentence from a website and paste it on text editing program, it copies all the formatting as well. How can I turn that off?

    There is an app called "No Formatting" in the App Store. It is simple and works perfectly - it strips formatting from paste (Ctr-V). I needed it for Word and Excel, which don't have keyboard shortcuts for this. It can be toggled on and off from the Menu Bar.

  • Is it possible to Aperture Library by copying over the Contents?

    Hi,
    My new Drobo 5D is having issues, and i'm not able to copy the Aperture File Directly over directly as its 530GB and the hard drive keeps failing in the last 30GB or so.
    so I was wondering is it possible to copy over the contents bit by bit by using the show contents folder and then somehow recreating the Aperture file from the folder of Contents copied over?
    Otherwise, is there any other solution?
    thanks!
    Derrick

    Read all this before doing anything.
    You select the library in the Finder and right click it and do Show Package Contents. That will revel the inside of the library You would then copy the files/folders out to the other drive MAKING SURE you copy them so that they are in the same relation to each other as they are in the original.
    On the destination drive create a new empty Aperture library. You'll probably have the easiest time of it if you have two finder windows open, one on the original library and on on the destination. Revel Package contents on both libraries and then copy from the source to the destination replacing the items in the destination library with items from the source. Make sure you go from source (old) to destination (new). It sounds silly to emphasis this but once you start copying it will be easy to get disoriented and go in the wrong direction. Do something to make sure the source Finder window stands out from the destination Finder window.
    I wouldn't worry about copying the previews or thumbnails those will be recreated when Aperture opens the new library BUT don't do anything with the Dobro or previews until you are sure the new library opens. In a worst case scenario you could retrieve the previews and still salvage something from your library.
    Of course the possibility exists that you will hit the file(s) that are causing the error that is keeping you from doing this in a normal fashion. If so mark the file(s) that are having problems (color label will work well) and continue with the rest of the library. It is possible that the file(s) that won't copy are not of major importance to Aperture and the new library will open anyway. If not then there may be some other way to work around it. By labeling the files you'll at least know what didn;t copy.
    That should do it if you're unsure of anything post back before starting.
    good luck
    Ps. Read  this post  Re: New iMac, Pegasus & Aperture? from a recent thread on backups and RAID. In it I explain why RAID is not a backup replacement. Once you recover from this you will need to put a true backup procedure in place.
    regards
    BTW here is OS X's definiiton of an Error -36
    Type -36 error (I/O Errors (bummers)
    This file is having difficulty while either reading from the drive or writing to the drive. The file
    may have been improperly written data to the drive or the hard drive or disk may be damaged.
    This is almost always indicative of a media error (hard error on the disk). Sometimes (rarely) it is transient.
    Solutions: Try copying the file to another drive. Use a disk recovery software, such as Disk First Aid to examine the disk. You can try rebooting with all extensions off. Once in a while this will allow you to read the data. The file in question should be restored from a backup that was stored on a different disk. Regular backups can reduce the time to recover from this error.
    Message was edited by: Frank Caggiano

Maybe you are looking for