How to move XML tree to another level using DOM api ?

<p>
Hi,
</p>
<p>
I have a followin function
</p>
<p>
<font face="courier new,courier"><strong>    public void printEmployeesAsXML(){
</strong></font>
</p>
<p>
<font face="courier new,courier"><strong>        ViewObject vo = getEmployees();
        Node no = vo.writeXML(-1,XMLInterface.XML_OPT_ALL_ROWS);
        XMLNode oraXML = (XMLNode)no; 
        try {
                oraXML.print(System.out);
            } catch (IOException e) {
                e.printStackTrace();
    } </strong></font>
</p>
<p>
<font face="courier new,courier"><strong>that gives me following XML:</strong></font>
</p>
<p>
<font face="courier new,courier"><strong>&lt;Employees&gt;
   &lt;Employee&gt;
      &lt;Empno&gt;7369&lt;/Empno&gt;
      &lt;LastName&gt;SMITH&lt;/LastName&gt;
      &lt;Job&gt;CLERK&lt;/Job&gt;
      &lt;Manager&gt;7902&lt;/Manager&gt;
      &lt;HireDate&gt;1980-12-17&lt;/HireDate&gt;
      &lt;Salary&gt;800&lt;/Salary&gt;
      &lt;Deptno&gt;20&lt;/Deptno&gt;
   &lt;/Employee&gt;</strong></font>
<font face="courier new,courier"><strong>&lt;/Employees&gt;</strong></font>
</p>
<p>
I always wil have only one row, so I need following XML:
<font face="courier new,courier"><strong>
   &lt;Employee&gt;
      &lt;Empno&gt;7369&lt;/Empno&gt;
      &lt;LastName&gt;SMITH&lt;/LastName&gt;
      &lt;Job&gt;CLERK&lt;/Job&gt;
      &lt;Manager&gt;7902&lt;/Manager&gt;
      &lt;HireDate&gt;1980-12-17&lt;/HireDate&gt;
      &lt;Salary&gt;800&lt;/Salary&gt;
      &lt;Deptno&gt;20&lt;/Deptno&gt;
   &lt;/Employee&gt;</strong></font>
</p>
<p>
Question is how to remove <strong>&lt;/Employees&gt;</strong> tag using w3c DOM API and move tree one level above
</p>
<p>
Kuba 
</p>
<p>
</p>

The XSLT for the required transformation is as follows:
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml"/>
<xsl:template match="/Employees">
<xsl:copy-of select="Employee"/>
</xsl:template>
</xsl:stylesheet>

Similar Messages

  • How ECMAScript enabled SVG Documnt be generated dynamically using DOM API.

    <?xml version="1.0" encoding="UTF-8"?>
    <svg height="200cm" width="200cm">
    <script type="text/ecmascript">
    <![CDATA[function rect_click(id){appletHost.getSelectedRectId(id);}]]>
    </script>
    <rect fill="none" height="1.0cm" i="5" id="B7001-09" j="0" stroke="blue" stroke-width="1" width="2.0cm" x="27.0cm" y="0.8cm" onclick="rect_click('B7001')"/>
    <rect fill="none" height="1.0cm" i="5" id="B7001-09" j="0" stroke="blue" stroke-width="1" width="2.0cm" x="27.0cm" y="0.8cm"/>
    <rect fill="none" height="1.0cm" i="5" id="B7001-09" j="0" stroke="blue" stroke-width="1" width="2.0cm" x="27.0cm" y="0.8cm"/>
    </svg>

    Sorry to ask u this question, its ver simple.
    Create CDATA Section through the document and append it to the Script Element..
    Element script = doc.createElement("script");
    script.setAttribute("type","text/ecmascript");
    script.appendChild(doc.createCDATASection("function rect_click(id){appletHost.getSelectedRectId(id);}"));
    doc.getDocumentElement().appendChild(script);
    Output inside <svg> tag::
    <script type="text/ecmascript">
    <![CDATA[function rect_click(id){appletHost.getSelectedRectId(id);}]]>
    </script>
    Rohit Joshi

  • How to move a selection into another selection in elements 12

    how to move a selection into another selection in elements 12

    Open picture B, the one you wish to select something from to add to another picture.
    Use one of the selection tools, e.g. selection brush, lasso tool, to select the object. You will see an outline ("marching ants") once the selection is complete
    Go to Edit menu>copy to copy the selection to the clipboard
    Open picture A, then go to Edit>paste
    Use the move tool to position object from picture B.
    In the layers palette you should see picture A as the background layer, and object B on a separate layer

  • How to send XML file to https server using POST

    Hi, I am having an requirement, that I have to connect to https server and I have to pass an input XML file as a response server will give me output XML file.
    The certificate validation part is over, I am using FileInputStream to read the XML file and attaching this to connection.getOutputStream(); but server is throwing me DTD does n't match.
    Can any body tell me how to send XML file, I have to use any DOM parser to send the XML file, suggest me and give me sample code.
    Thanks,

    Can anybody give me the solution

  • How to read XML message present in Table using PL/SQL?

    Hi,
    How to read XML content present in Table using PL/SQL .And is it possible to parse the xml uisng xslt and insert xml output in same table again ?
    Thanks!

    Late reply, but hopefully better late than never.
    You can possibly do it all via a single SQL statement, such as {message:id=4232077}
    XMLTable Syntax can be found at http://download.oracle.com/docs/cd/B19306_01/server.102/b14200/functions228.htm#CIHGGHFB (for 10.2 users) else find your correct version at http://www.oracle.com/technology/documentation/index.html

  • How i can deal with oracle file by using php api

    how I can deal with oracle file by using php api ?

    What has this to do with Reflections and Reference Objects?

  • How to create snapshot portlet and snapshot query using server API

    How to create snapshot portlet and snapshot query using server API
    Regards
    Dheeraj

    Hi Sebastian,
    I have used the query and it is working fine. but, How could i include the headers of the query also in to the Excel Sheet.
    RehaanKhan. M
    see the method discussed here
    http://sqlblogcasts.com/blogs/madhivanan/archive/2008/10/10/export-to-excel-with-column-names.aspx
    Please Mark This As Answer if it solved your issue
    Please Vote This As Helpful if it helps to solve your issue
    Visakh
    My Wiki User Page
    My MSDN Page
    My Personal Blog
    My Facebook Page

  • How can I move a folder to another catalog using LR 3

    I have imported a large amount of folder into cat#1, but now i have decided to create cat#2. I have tried to move the "folders" and not "catalog" using the following workflow:
    1- Opening cat #1, make selection of folder to be moved
    2- Go to file and select "Export as a cat".
    3- Opened cat #2, go to File and select "Import catalog"
    4- Importing window shows the entire list of folders I had imported previously (lots of them). They all are checked. I can see the path, but only see the location of the folders, but I can't read the name of the files. I am able to see the total number on each folder
    5- I have not even considering "synchronizing" the folder
    Oh another thing, when I go to cat#1 and locate the folder I "exported as a catalog". The folder still shows on cat#1, but I don't see it on cat#2. I guess because I didn't complete the task.
    I find it very tedious process trying to locate the file. And this is where I'm stuck
    I have searched so many ways to find a workflow that would make sense, but I tend to get nothing but responses about how to move a "catalog". I have been thinking doing the following:
    1- Remove the folder from cat#1
    2- Open cat#2 and import the same folder, but this again seems to redundant, boring and a lot of clicking. Any suggestions.

    Hm... Well, for everyone else the reply link is still on the website, and works fine soo....
    Tell me about it. I went to catalog #2 and I didn't see the exported
    catalog. Then I went back to catalog #1 and I still can see the entire
    folder that I had selected to Export. I double checked it the process and it
    seemed ok, but apparently there's something missing to complete the export
    You seem under the impression that exporting as a catalog removes the images from the first catalog.  This is not true.  As I said earlier, it makes a copy for you.  So of course, when you go back into catalog1, all of your images/collections/etc, are still there.  As they should be.
    So, you say you didn't see anything in your exported catalog?  Are  you sure you are opening the same catalog you just exported, or  have you opened a new blank one that you created, accidentally or not?  That would be my guess.
    I think you should start over, and very carefully take it one step at a time.
    Dj has suggested not using include negatives, and I can see where that might be useful.  However, if you do that, you will end up having images from two different catalogs in the same folder.  This will cause problems if you ever use the "sync folder" option, as it will attempt to load all images in that folder into your current catalog. Which means you could easilly end up with all your images in both catalogs.  Messy.   So to avoid this, use a new place instead.  You can also avoid having to do the "import to catalog" step by exporting the negatives at the same time.  Don't worry about exporting previews, though.
    First, find a new place (external disk, whatever) to create a new catalog in.  Do _not_ create the new catalog your self!  Make sure you are sending everything to a new place!
    Now, go into catalog1, and select all of the images you want to export.  They have to be selected, or nothing happens, and you'll just get a blank catalog.
    Now, export as catalog those images into the new location, and make sure you are copying the negatives too!  Double check before you hit go!
    Now, using LR, open that new catalog; you can either double click on the new one, or browse to open it.  Either way.  Verify that your images are in the new place and everything looks good.  You can see in the Folders tab on the left panel to make sure the images are in the right place in the new folder.
    At this point, you should have 2 and a half catalogs;  your new catalog with only the images you exported, and the old catalog, with all of your images.
    Now, you have a couple of choices.  But before you do either of them, make sure you backup your system, including all of the images in the original catalog.  If you've messed up making the new catalog (you should be able to tell!) then you want to make sure your original catalog can be restored.
    Open your original catalog again, and now remove all of the images you exported.  You will need to use the "remove from disk" option, as they will stay in the folders if you don't.  This would cause the above problem with "sync folder", and of course, use double the disk space.
    You can obviuosly see why I said to back everything up first;  if you messed up the export by not including the negatives, you could easilly delete your originals, and not have them _anywhere_, in which case  you would have to restore from back up and try again.
    You now have two separate catalogs.
    Remember, backup everything first, and good  luck!
    Cheers!

  • How to move one screen to another screen Webdynpro ?

    Hi,
    How to move from one screen to another screen Webdypro ?
    Best Regards,
    Kishore

    Hi,
    for this you have to declare in and outbound plugs to your views,
    bind them into the window area of your component and fire the
    outbound plug in your action handler in view one, view2 will be called
    automatically.
    <a href="http://help.sap.com/saphelp_nw04s/helpdata/en/1f/464941db42f423e10000000a155106/frameset.htm">documentation</a>
    grtz
    Koen

  • How to move a window to another, existing space that already has windows

    NOT happy with the new Mission Control.  Give me back spaces!
    I have been using virtual desktops (VDT) for years and I often work 14 to 18 hours a day on my mac.. 
    I can reorder my spaces in MC but that seems to be about all I can do and it really is ******* me off.
    I need to be able to drag a single window from 1 space to another space where I already have another application running. This was TRIVIAL in SPACES but seems impossible in MC.
    example:  I have a text file of notes in vi in one VDT and in another I have a browser window open to a customer location where I need to use or add to those notes with some complexity. I want to move that notes window from the VDT that it is in (because there are other apps there) to the current VDT so that I can easily use the notes and the browser together. I do NOT want to have to make the stupid vi window in ALL spaces. How do I do this?
    another example: I have a browser with multiple tabs and I want to move ONE of them to another VDT. I can pull the tab to make another window.. But I can't move just that tab to another VDT!! How can I do that?
    Please please PLEASE fix this in Mountain Lion !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

    You have to start from the Desktop where the window is currently living to move it to another Desktop.
    If you are using Safari in Full Screen, that screen is its own desktop and can't be moved to another desktop. If you are not in Full screen, go to the desktop that hosts the window and drag it to another Desktop in MC.

  • How to move a picture in another folder with drag & drop

    I want to move a picture in another folder with drag&drop. I work´s any more. What I do wrong?

    Hi all!
    Thanks.
    The problem was between the flatscreen and the chair...:-) I clicked always on the gray frame around and not in the image.
    Now it works!

  • How to send a app to another device using icloud

    I want to send my imovies to my another device using icloud.....i downloaded imovies with my bros account and now i have different app store account. So can i still send my app to my another device with my new apple account.

    You cannot "send" an app via iCloud, the purchase is saved but only accesible to the same AppleID...app purchases are tied to a specific AppleID.  If you want one purchased under your brother's ID you must purchase under your ID.

  • How to responce back HTML format to MVC using asembler API

    Hi,
    Now we are trying to build integration between MVC Web Application on Seesar2 framework(http://www.seasar.org/en/) and endeca commerce 3.1.1.
    In order to responce back the HTML page from endeca based on the query executed by MVC side, assembler API should return the format of HTML, however, it seems that Assembler API actually returns the contentItem data with which cartridge should be used, so assembler API responce as is cannot be used as HTML page output.
    Is there any way to generate the HTML page format using assembler API ?
    Also I've found following forum saying that Assembler API can be called by Spring MVC, but is it also applicable for other framework than spring ?
    https://qa.endecacommunity.com/questions/149/creating-endeca-dispatcher-using-spring-mvc-instead-of-assemblerjsp-in-endeca-310
    Re: How to use Spring MVC instead of assembler.jsp in endeca 3.1.0
    Thanks,
    Yuki

    Instead of writing HTML directly why not write an XML representation of your data and then use XSLT to create an HTML view and a PDF view. PDF can be generated from XML using FOP (http://xml.apache.org/fop/index.html).

  • How to post a document in the future using DI API?

    Hello friends
    Please can someone help me find a clever way around this....
    I am using SAP 2005 SP01 PL09. I am trying to add an invoice into SAP using a VB.Net application. I want to set the date for the invoice to a future date (e.g. 01/01/2008). The problem is that even though I have set the setting which "<b>Allows future Posting Date</b>" in SBO I still get a "<b>Date deviates from permissable range</b>" Error (-5002) when I try adding the invoice.
    I know that when I try post the invoice through the SAP <i>front end</i> (i.e. still posting it in 01/01/2008) I get a confirmation screen which pops up and says "<b>Posting Date later that System Date</b>" and I can either click on "<i>OK</i>" or "<i>Cancel</i>". If i click on OK the Invoice goes through no problem.
    This however does not work when i try use the DIAPI to do the same thing.
    How can i bypass this error when i use the DIAPI??
    Any help is much appreciated
    Greeshma

    Hello,
    if you want to escalate to SAP, I think you upgrade your SAP B1 to  the latest PL i.e. PL 36. Let me know if the error still persists after upgrading.
    Rgds,

  • How to move xml files to a particular folder?

    I have made XML forms for new which is having approval feature.
    Now i want that  after the approver approves the news ,the respective xml file of the approved news should move to a particular folder defined by me in KM.
    Is it possible....?If yes, how?

    Hi
    Other way of achieving this is to create a repository service which listens to the publish event. You can write the code to move document in the received method of repository service. If any document is published, event will be triggered and the service will be invoked, the code to move the document will be executed.
    Check the link:
    https://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/30143cc1-d176-2a10-55a3-ea498211e424
    Regards,
    Yoga

Maybe you are looking for

  • Server 2012 R2 Corrupt User Profile Disks after RDSH reboot

    Hi, We have a serious problem when using User Profile Disks, we have a pretty simple setup with a single RDGW & RDCB and the 2x RDSH with a folder share for redirected folders and another for User Profile Disks. Now if any server suffers a re-boot wh

  • Data Management Services with Cairngorm 2.1

    Hello. I have been using cairngorm 2.0 for a while, and I am now trying to convert the 2.1 stuff over, including using cairngorm to manage my DataServices. However I have some questions about it if you have used it. Using the command, and passing the

  • My itunes wont open. Ive tried everything.

    I was updating my phone and it disconnected and now my itunes wont open and plus my phone is still in recovery mode. Ive tried everything, someone help

  • Update problem , getting iphone 4 out of recovery mode

    How can i get my iphone 4 to work after recent update when I get this message' itunes has detected an iphone in recovery mode . you must restore this iphone before it can be used with itunes.' i have a itunes logo and usb display on screen and nothin

  • Page file issue

    hello team, We have a weird issue running on one of the servers(w2k8 R2 ENt) where the page file is not getting saved on the reboot..i.e we set a value for page file 0f 200GB via GUI and the registry key also shows to be same..but on reboot of the se