Problem moving a Node from one Document to another (XMLBeans)

Hi all
Is it possible to get a org.w3c.dom.Node from one org.w3c.dom.Document object and put it into another org.w3c.dom.Document object?
I am attempting to do this by getting a Node from an XMLBeans object and trying to append it to a SOAPHeader. It compiles, but I get the following runtime exception: -
DOMException: WRONG_DOCUMENT_ERR
The Javadoc says that this is thrown If a node is used in a different document than the one that created it (that doesn't support it)
I dont know if the problem is that Nodes cant be passed between Documents in general (namespace issues?), or there is something about a Node from an XMLBeans object that is putting a spanner in the works somewhere.
I would be very grateful for any advice or suggestion.
Many thanks
Jon

If you look at all the methods of the Document interface carefully, pretty soon you will come upon one named "importNode".

Similar Messages

  • Moving a node from one Document to another

    Hi,
    Could someone suggest a way to merge two XML Documents ?
    Thanks in advance,
    Sony
    null

    Here's an example of the XSL-based approach.
    Assume your two XML source files are:
    demo1.xml
    <messages>
    <msg>
    <key>AAA</key>
    <num>01001</num>
    </msg>
    <msg>
    <key>BBB</key>
    <num>01011</num>
    </msg>
    </messages>
    demo2.xml
    <messages>
    <msg>
    <key>AAA</key>
    <text>This is a Message</text>
    </msg>
    <msg>
    <key>BBB</key>
    <text>This is another Message</text>
    </msg>
    </messages>
    Here is a stylesheet the "joins" demo1.xml
    to demo2.xml based on matching the "<key>" values...
    demomerge.xsl
    <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
    <xsl:output indent="yes"/>
    <xsl:variable name="doc2" select="document('demo2.xml')"/>
    <xsl:template match="@*|node()">
    <xsl:copy>
    <xsl:apply-templates select="@*|node()"/>
    </xsl:copy>
    </xsl:template>
    <xsl:template match="msg">
    <xsl:copy>
    <xsl:apply-templates select="@*|node()"/>
    <text><xsl:value-of select="$doc2/messages/msg[key=current()/key]/text"/></text>
    </xsl:copy>
    </xsl:template>
    </xsl:stylesheet>
    If you use the command-line "oraxsl" to test this out, you would do:
    $ oraxsl demo1.xml demomerge.xsl
    And you'll get the merged result of:
    <messages>
    <msg>
    <key>AAA</key>
    <num>01001</num>
    <text>This is a Message</text>
    </msg>
    <msg>
    <key>BBB</key>
    <num>01011</num>
    <text>This is another Message</text>
    </msg>
    </messages>
    Obvious not as efficient for larger-sized files as an equivalent database "join" between two tables, but this illustrates the technique if you only have XML files to work with.

  • Cs sdk: copying an item from one document to another

    is there a way to copy any item from one ai document to the other ?

    I'm not one for bumping old threads, but this problem is really giving me a headache...
    I'm having the same exact problem with copying groups from one document to another.  It doesn't seem to matter if it's a top-level group or not; any group that gets copied over results in the copied art not showing up in the layer list and gives errors when trying to click on it.
    If my source document looks like this:
    Layer 1
      <path 1_1>
      <path 1_2>
      Layer 2
        <path 2_1>
    If I DuplicateArt on the GetFirstArtOfLayer(Layer 1), Layer 1 gets copied into the new document, but it doesn't show up in the layer list and I get errors trying to click on any of the art.
    If I iterate over the children/siblings of Layer 1 and duplicate them all separately, <path 1_1> and <path 1_2> will show up correctly in the new layer list and are clickable, but Layer 2 will not, and clicking on <path 2_1> results in the error.
    At this point, the only solution I can think of is to recursively iterate over the source tree, manually creating the destination groups, and then copying the art work into them.
    Very frustrating!

  • Moving pages from one document to another in preview

    I have two PDF documents open with the sidebar on my desktop.  I have moved a page from one document sidebar to another and then saved the document with the additional page.  When I open the document the added page is not there.  This is extremely fustrating as I have tried this all different ways.  Any suggestios???

    See my reply in this thread here:
    Merge 2 pdf files into 1 ?: Apple Support Communities
    The movie is still available, watching it may help, it shows a method for adding all the pages from one PDF to another. The general idea of where to drag in the destination would still apply for adding just one page.
    Francine

  • How do I copy an art object from one document to another using illustrator API(C  )

    Hi, I'm trying to copy text and graphic elements from one document into another, does anybody has an idea how to do it using Illustrator SDK(C++)?
    Thanks in advance.

    If you call AIArtSuite::ReorderArt() giving the layer group handle from the target document and using art from the source document, it will move art between documents. That said, there are all sorts of caveats that come along with that -- some things move over automatically (graphic styles, symbols) while others cause problems. E.g. copying art that contains a swatch can cause a crash when you shut down the source document because it may keep the style reference to the swatch in the source document -- which goes away when the document is closed. Gradients in particular are a problem I believe. Straight up colours are (I think) fine. I've had to write a lot of workarounds for various headaches caused by moving art between documents.
    Bottom line: its very doable, but there are a lot of edge cases. This was clearly not an intended use of the SDK, though it is possible.

  • [CS3 JS]  Move pages from one document to another?

    First, a brief explanation of what I am trying to do. I have several individual chapters that I am including in an INDD book. However, I also want to be able to allow those individual chapters to stand alone, meaning that I want to add a cover/title page to each chapter file (these two pages would be placed before the current page 1 of each chapter).
    My preference would be to write a script that would open the cover/tp file and open the first chapter file; this part is no problem. Where I am running into trouble however, is the second step: moving the cover/tp pages (2 pages) over into the chapter file.
    Manually, I would open Cover.indd, activate the "move pages" menu, "Move pages: 1-2", "Destination: Before_Page 1", "Move to: Chapter1.indd".
    With over 100 chapters in the book, however, I would prefer to automate the process. I have looked into the Page.move and PageItem.move elements, but both look like they would require a location in the current document (either in (x,y) form or using "AT_BEGINNING".
    If I cannot get this to work, I will likely try to insert two blank pages, then cut/paste with a script, but I would prefer the "move" functionality, if it is possible.
    A couple of answers to potential questions:
    I can't simply place the INDD cover file b/c it uses a text variable to pull the chapter name; this personalizes each stand-alone chapter.
    Same answer to why I can't just slap the 2-page .pdf on the front of each. I need the text variable to still be active.
    Has anyone tried to move pages from one document to another using scripting? I tried to explain what I am trying to do, but if it doesn't make sense, I can try again. :)
    thanks!
    Matt

    ok here we are
    I get a raw skeleton that you will have to adjust but it's functional.
    Use a PDF for placement as you can specify the page that you want to place.
    I don't know if you can do the same for indesign files.
    So basically, it starts adding 2 pages and placeing the pdf in the same time.
    After that, it creates the textVariable and the frame that will receive it.
    Here you are:
    //If a document is open
    if(app.documents.length!=0)
    var ad = app.activeDocument;
    //Pages placement
    for(i=0; i<2; i++)
    //Add 2 pages on top of the document;
    var tmpPg = ad.pages.add(LocationOptions.BEFORE, ad.pages[0]);
    //Here you place your pdf
    app.pdfPlacePreferences.pageNumber = i;
    tmpPg.place(File(cover.pdf), false)
    //You should specify page x and page y but ain't found yet the way to go.
    //Text variable creation
    //Check if the textVariable named "txtVar" does not already exist...
    if(ad.textVariables.item("txtVar")==null)
    //if not found, create the text variable named "txtVar"
    var txtVar = ad.textVariables.add();
    txtVar.variableType =VariableTypes.CUSTOM_TEXT_TYPE;
    txtVar.name = "txtVar";
    //Set the contents of the text variables to the string "test"
    ad.textVariables.item("txtVar").variableOptions.contents = "test";
    //these coordinates don't care aboutyour units but you may adjust them to your needs
    var y1 = ad.marginPreferences.left;
    var x1 = ad.marginPreferences.top;
    var y2 = y1+5;
    var x2 = x1+25;
    var myFrame = ad.pages[0].textFrames.add({geometricBounds:[y1,x1,y2,x2]});
    //Set the contents of the frame to the text variables "txtVar"
    myFrame.contents=ad.textVariables.item("txtVar").variableOptions.contents;
    //You may want to stylize the txtVar
    //In this case, either you use a existing characterStyle or you create one in the script
    Bye Loic

  • Adding multiple same-name nodes from one xml into another

    Hi,
    Following on from my question the other day (Adding multiple different nodes from one xmltype into another), I now have a slightly more complex requirement that I cannot work out where to start, assuming that it's something that can reuse some/all of yesterday's work (thanks again, odie_63!). ETA: I'm on 11.2.0.3
    So, here's the (slightly amended) xml along with yesterday's solution:
    with sample_data as (select xmltype('<root>
                                           <xmlnode>
                                             <subnode1>val1</subnode1>
                                             <subnode2>val2</subnode2>
                                           </xmlnode>
                                           <xmlnode>
                                             <subnode1>val3</subnode1>
                                             <subnode2>val4</subnode2>
                                           </xmlnode>
                                         </root>') xml_to_update,
                                xmltype('<a>
                                           <b>valb</b>
                                           <c>valc</c>
                                           <d>
                                             <d1>vald1</d1>
                                             <d2>vald2</d2>
                                           </d>
                                           <e>vale</e>
                                           <f>valf</f>
                                           <g>
                                             <g1>valg1</g1>
                                             <g2>valg2</g2>
                                           </g>
                                           <h>
                                             <h1>valh1</h1>
                                             <h2>valh2</h2>
                                           </h>
                                           <multinode>
                                             <name>fred</name>
                                             <type>book</type>
                                             <head>1</head>
                                           </multinode>
                                           <multinode>
                                             <name>bob</name>
                                             <type>car</type>
                                             <head>0</head>
                                           </multinode>                                        
                                         </a>') xml_to_extract_from
                          from   dual)
    select xmlserialize(document
               xmlquery(
                 'copy $d := $old
                  modify (
                    insert node element extrainfo {
                      $new/a/b
                    , $new/a/d
                    , $new/a/f
                    , $new/a/h
                    } as first into $d/root
                  return $d'
                 passing sd.xml_to_update as "old"
                       , sd.xml_to_extract_from as "new"
                 returning content
             indent
    from sample_data sd;
    That gives me:
    <root>
      <extrainfo>
        <b>valb</b>
        <d>
          <d1>vald1</d1>
          <d2>vald2</d2>
        </d>
        <f>valf</f>
        <h>
          <h1>valh1</h1>
          <h2>valh2</h2>
        </h>
      </extrainfo>
      <xmlnode>
        <subnode1>val1</subnode1>
        <subnode2>val2</subnode2>
      </xmlnode>
      <xmlnode>
        <subnode1>val3</subnode1>
        <subnode2>val4</subnode2>
      </xmlnode>
    </root>
    However, I now need to add in a set of new nodes based on information from the <multinode> nodes, something like:
    <root>
      <extrainfo>
        <b>valb</b>
        <d>
          <d1>vald1</d1>
          <d2>vald2</d2>
        </d>
        <f>valf</f>
        <h>
          <h1>valh1</h1>
          <h2>valh2</h2>
        </h>
        <newnode>
          <name>fred</name>
          <type>book</type>
        </newnode>
        <newnode>
          <name>bob</name>
          <type>car</type>
        </newnode>
      </extrainfo>
      <xmlnode>
        <subnode1>val1</subnode1>
        <subnode2>val2</subnode2>
        <type>book</type>
      </xmlnode>
      <xmlnode>
        <subnode1>val3</subnode1>
        <subnode2>val4</subnode2>
        <type>car</type>
      </xmlnode>
    </root>
    If it's easier, I *think* we would be ok with something like:
    <newnode>
      <type name="fred">book</type>
      <type name="bob">car</type>
    </newnode>
    The closest I've come is:
    with sample_data as (select xmltype('<root>
                                           <xmlnode>
                                             <subnode1>val1</subnode1>
                                             <subnode2>val2</subnode2>
                                           </xmlnode>
                                           <xmlnode>
                                             <subnode1>val3</subnode1>
                                             <subnode2>val4</subnode2>
                                           </xmlnode>
                                         </root>') xml_to_update,
                                xmltype('<a>
                                           <b>valb</b>
                                           <c>valc</c>
                                           <d>
                                             <d1>vald1</d1>
                                             <d2>vald2</d2>
                                           </d>
                                           <e>vale</e>
                                           <f>valf</f>
                                           <g>
                                             <g1>valg1</g1>
                                             <g2>valg2</g2>
                                           </g>
                                           <h>
                                             <h1>valh1</h1>
                                             <h2>valh2</h2>
                                           </h>
                                           <multinode>
                                             <name>fred</name>
                                             <type>book</type>
                                             <head>1</head>
                                           </multinode>
                                           <multinode>
                                             <name>bob</name>
                                             <type>car</type>
                                             <head>0</head>
                                           </multinode>                                        
                                         </a>') xml_to_extract_from
                          from   dual)
    select xmlserialize(document
               xmlquery(
                 'copy $d := $old
                  modify (
                    insert node element extrainfo {
                      $new/a/b
                    , $new/a/d
                    , $new/a/f
                    , $new/a/h
                    , element newnode {
                                       $new/a/multinode/name
                                       ,$new/a/multinode/type
                    } as first into $d/root
                  return $d'
                 passing sd.xml_to_update as "old"
                       , sd.xml_to_extract_from as "new"
                 returning content
             indent
             ) fred
    from sample_data sd;
    Which produces:
    <newnode>
      <name>fred</name>
      <name>bob</name>
      <type>book</type>
      <type>car</type>
    </newnode>
    - obviously not right!
    Can anyone provide any hints? I've tried searching for similar examples, but I mustn't be putting in the right search terms or something!

    odie_63 wrote:
    or, similarly, to get the alternate output :
    copy $d := $old
    modify (
      insert node element extrainfo {
        $new/a/b
      , $new/a/d
      , $new/a/f
      , $new/a/h
      , element newnode {
          for $i in $new/a/multinode
          return element type {
            attribute name {data($i/name)}
          , data($i/type)
      } as first into $d/root
    return $d
    So we're going with the second method, but I've discovered that the "$i/name" node is not always present. When that happens, I would like to use a default value (for example, "george"). I promise I've searched and searched, but I'm completely failing to turn up anything that sounds remotely like what I'm after (seriously, I can't believe my google-fu sucks this badly!).
    Is there a simple way of doing it? The only thing that I've found that looks vaguely relevant is "declare default namespace...." but I'm not sure that that's the correct thing to use, or if it is, how I'm supposed to reference it when populating the attribute value.

  • How to move sections from one document to another?

    In Pages 08 I could merge two documents by simply moving the sections from one document to the other one. By activating the thumbnail-view you could drag and drop sections. In Pages 5.2.2 that doesn't work. Any suggestions? Copy and paste doesn't work, because the layout is broken afterwards.
    Jan

    You only recourse in Pages v5 (any release) is copy/paste between documents, and its layout consequences; follow Peter's advice, or use a non-Apple word processing solution that allows you to get work done effectively. Apple put dumbnation into Pages v5.

  • Cannot move the pages from one document to another

    Hi,
    I cannot move the pages from one document to another, abobe gets crashed. I am not sure but I think this was happening when I try to copy or move the threaded content. How to resolve this, this is happening in both CS4 and CS5. Can anyone help me?

    Thanks for ur reply.
    1. Open two documents, for ex doc1 and doc2, doc1 contais 4 pages, doc2 contains 2 pages
    2. Using Move Pages from the Pages panel menu in doc1, moving 1st two pages to doc2
    Move Pages  : 1-2
    Destination   : After page 1
    Move to        : doc2
    Actually I was not able to copy the textframe which is linked with another, immediately it crashes.

  • Moving CMS database from one server to another

    Using the following:
    Crystal Enterprise 10, installed on W2K3 Server R2 (not making any changes to this server);
    CMS database, installed on W2K Server, SQL Server 2000, SP3
    New database server: W2K3 Server R2, SQL Server 2005, SP2
    I found what I think are the steps to moving the database from one place to another in the CE10 Administrator's guide (pages 291-300, but I want to make sure there aren't any "gotchas" when moving the database location and/or upgrading the database version.  I'm primarily a DBA, so I already know about the Schema security change going from SQL 2000 to SQL 2005.
    In a nutshell, here's my plan:
    1. Take fresh backup of the existing CMS database
    2. Stop Crystal Management Server
    3. Click "Specify CMS Data Source" on the toolbar.
    4. ETC--following the steps in the admin guide
    If anyone has done this and has run into any problems (what I'm expecting) or had it go smoothly (I would be surprised), please let me know what to expect.
    Thanks!

    All you really need to do is stop the crystal services.
    Backup the CMS and Auditing database
    Detach the CMS and Auditing database
    Copy CMS and Auditing databases to new DB server
    Attach the CMS and Auditing databases
    Set the compatibility mode
    On the servers/s that host the CMS service, modify the ODBC connections to point to the new database server
    Start the CMS service, fire up the Crystal services.
    One thing to note, I don't think SQL 2005 is a supported platform for CE10 - this doesn't mean it won't work and since the support lifecycle for the product is long gone it doesn't really make much difference however you may want to run some thorough testing prior to the move.
    Edited by: James Pretorius (CCLTD) on Aug 5, 2009 9:20 PM

  • I bought a new laptop and used Windows Easy Transfer cable and moved all files from one computer to another. I installed iTunes and found my iTunes music Library.  However, when I plug in my iPod it says it is already synced with another iTunes Library.

    I bought a new laptop and used Windows Easy Transfer cable and moved all files from one computer to another. I installed iTunes and found my iTunes music Library.  However, when I plug in my iPod it says it is already synced with another iTunes Library. 
    I don't see anything in Help that shows when you already have transfered all the files over.  Why would it want to erase and sync when I already have all the music folder copied over?  I didn't have an issue when I had another technician copy from one laptop to another.  Home sharing is also on but not being recognized.

    I suspect you only migrated the media folder instead of the complete working library. Either review the transfer process and copy over the entire iTunes folder from your old profile's music folder or see Recovering your iTunes library from your iPod or iOS device.
    tt2

  • I have no problems copying iMovie Events from one Mac to another, however, how can I copy iMovie Projects from one Mac to another?

    I have no problems copying iMovie Events from one Mac to another, however, how can I copy iMovie Projects from one Mac to another?  Any help will be appreciated.  Thank you.

    This should give you some good insight, I'd probably store them on an External HD on the old machine and then just drag and drop to the new machine.
    https://discussions.apple.com/docs/DOC-4141

  • I have over 200 hours of HD video on 5 different TB Thunderbolt GRaid hard drives. I need to reorganize my projects, moving large files from one drive to another. Advice?

    I have over 200 hours of HD video on 5 different TB Thunderbolt GRaid hard drives. I need to reorganize my projects, moving large files from one drive to another. Advice?

    Do some testing to get your method working right with some less than important footage.
    Copy/paste files where you want then.
    Use the FCE Reconnect feature to tell FCE where the newly copied files reside.
    Make sure the new location and files are working as expected with your Projects.
    Delete the original files if no longer required.
    Al

  • Is it possible to copy formats and styles from one document to another?

    Is it possible to copy formats and styles from one document to another?
    Or use a commen styledocument as a masterdocument?

    Only by creating a template with what you want.
    Apple has removed the ability to import styles inPAges 5 along with almost 100 other features.
    Peter

  • FW CS5: Copy Page from one document to another without changing layers

    Hi,
    how can I copy a Page from one document to another without changing the layers?
    Drag-and-drop isn´t possible and by Copy-Paste all elements are placed in the same layer.
    Greetings,
    toho

    Use File > Import.
    Open the File, then navigate to the page you want to import
    Be sure to select Insert after current page, or FW will just import the content into the current page itself.

Maybe you are looking for

  • Payment method not getting copied automatically during posting invoice

    Dear Gurus, The payment method maintained in the vendor master " T" / "C" is not getting copied while posting the invoice document in MIRO or FB60 . The terms of payment is being defaulted from the master data, but not the payment method. Please help

  • ScrollPane not disappearing after dynamic creation

    Gentlefolk; Have a movieclip that that has formatted text. This content is longer than the stage, so I thought of putting it in a scrollpane. Creating a dynamic text box kills the text formatting. The scrollpane has a name "my_SP". If I have this cod

  • Join files again, after they're split into 1 kb chunks

    I have the below code in my program. It splits a single file into multiple files each 1 kb in size that when put together in the right order will make up the original text file. Anyone got any ideas on how I can write a class to do this? import java.

  • Blink  Text continously in a Container , screen shot Attached .

    Hi , Please tell me if is it  possible to blink some Text continously in a Container .. Attached is the screen shot , please advise me some solution .

  • Relate request and response messages

    Hello, Concerning how to relate messages. I have a jpd putting messages 'send' queue, and a responses arrive on a 'receive' queue. Both queues may be remote. Several jpd’s will run at the same time. The message correlation id appears to be intended