Append a DOM to another DOM

Hi guys, I have a simple application. And I need to append my DOM tree in another DOM tree.
What I do:
I just create a Document, and append the nodes (elements and texts).
After a create another Document and...
Document tree_one = builder.newDocument();
Document tree_tw0 = builder.newDocument();
//Here I add the nodes to the fisrt tree
//Here I add the nodes to the second tree
Node root = tree_one.getDocumentElement(); //Get the root element of first tree
root.appendChild(tree_two.getDocumentElement());  //Append the elementThe second tree was projected to be append at the first tree, i.e, I don't put two root elements!!! The first tree I just create a root element, and at the second I create the elements to put at the root element
Firts Tree:
<transformers>
</transformers>
Second tree:
<transformer>
</transformer>
When I execute the code above I get the error: WRONG_DOCUMENT_ERR
If a node is used in a different document than the one that created it (that doesn't support it)
Please, help me!!!
Giscard

Refer to
http://javaalmanac.com/egs/org.w3c.dom/CloneSubtree2.html

Similar Messages

  • How to append a ResultSet to another ResultSet?

    Hi,
    How could I append a ResultSet to another ResultSet object if their columns are exactly the same?
    For example, I have some methods that return ResultSet objects for particular queries.
    int a = 3;
    ResultSet rs1 = getRoute(20, a);
    ResultSet rs2 = getRoute(a, 40);
    ResultSet rs3 = rs1 + rs2;
    How do I combine the two ResultSet objects together instead of writing the last statement? Thank you.
    -Henry Chang

    As I noted earlier, UNION is always going to re-sort your results and remove any duplicate rows; UNION ALL might or might not depending on the database implementation.
    I think Oracle happens to be among the databases that will produce a concatenated result FROM UNIUN ALL, without resorting, but if not, and if your database happens to be Oracle, then this will work:
    SELECT * FROM
      (SELECT test_table.*, 1 subresult_no, rownum row_no
      FROM test_table
      WHERE column_a = 20 AND column_b = 10
      ORDER BY order_no)
    UNION ALL
      (SELECT *, 2 subresult_no, rownum row_no
      FROM test_table
      WHERE column_a = 10 AND column_b = 30
      ORDER BY order_no DESC)
    ORDER BY subresult_no, rownum row_no"rownum" is an Oracle feature, it's a pseudo-column that gives the row index at that point in the computation.
    The above SQL will of course add 2 columns to your result set; you can of course suppress them by explicitly listing your selected columns; doing so is widely considered to be good practice anyway.

  • I need to append a string to another string

    I'm working with some inherited code, I'm a Colf Fusion
    novice myself, and I'm trying to make this order form display the
    correct data. The problem is a lot of data in the database is
    missing. Description in the QStockDB query can contain a lot of
    stuff. For our full color work the text "4/0", "4/BLACK", and "4/4"
    are consistent so I'm changing the newitem (I know, not very
    descriptive but it's not my code) to CMYK Printing.
    <cfif #QStockDB.description# contains "4/0"><cfset
    newitem = "CMYK Printing"></cfif>
    <cfif #QStockDB.description# contains
    "4/4/BLACK"><cfset newitem = "CMYK Printing"></cfif>
    <cfif #QStockDB.description# contains "4/4"><cfset
    newitem = "CMYK Printing"></cfif>
    I want to then go back through description and compare it
    more to add more description. For instance with this:
    <cfif #QStockDB.description# contains "12 pt"><cfset
    newitem = newitem + " - BC"></cfif>
    I know that the job is a business card. So I want to append
    the newitem variable with " - BC". Likewise:
    <cfif #QStockDB.description# contains
    "catalog"><cfset newitem = newitem + " - Catalog
    Sheets"></cfif>
    displays CMYK Printing - Catalog Sheets. Or, it should... or,
    more precisely, I want it to. :)
    How do I append a string to another string?

    + is the addiion operator and works with numbers. Because
    your string is a ...well, string... you need to use an ampersand.
    Thus, instead of:
    <cfif #QStockDB.description# contains
    "catalog"><cfset newitem = newitem + " - Catalog
    Sheets"></cfif>
    Use...
    <cfif #QStockDB.description# contains
    "catalog"><cfset newitem = newitem & " - Catalog
    Sheets"></cfif>
    <cfoutput>#newitem#</cfoutput>
    At least I think that will work - haven't tested it
    though.

  • Append one vector to another

    Hi:
    I would like to know if there is anyway to append one vector to another
    i.e
    Vector vec = new Vector();
    Vector anotherVec = new Vector();Is there a method I can call to append anotherVec to vec?
    without going through a while loop??
    please let me know...
    thnx

    do vec.addAll(anotherVec);

  • How to create a new DOM tree with nodes from another DOM tree?

    Hello,
    I would like to create a DOM tree by using nodes from an existing DOM. How can I do that? I tried with appendChild and it gaves me as error: "WRONG_DOCUMENT_ERR".
    Thx!

    The xml that should be parsed is something like that:
    <?xml version="1.0" encoding="UTF-8"?>
    <root xmlns="http://www.nebi.biz/schemas/bd/nebienvelope" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" BusinessDocumentVersion="7.0" xsi:schemaLocation="http://www.nebi.biz/schemas/bd/nebienvelope NeBiEnvelope_L_0_3.xsd">
        <Header>
            <To>
                <OrganisationId>OrganisationId0</OrganisationId>
                <DestinationType>DestinationType0</DestinationType>
                <Destination>Destination0</Destination>
            </To>
            <From>
                <OrganisationId>OrganisationId1</OrganisationId>
                <DestinationType>DestinationType1</DestinationType>
                <Destination>Destination1</Destination>
            </From>
            <Dialog>Dialog0</Dialog>
            <DialogId>DialogId0</DialogId>
            <MessageType>MessageType0</MessageType>
            <MessageId>MessageId0</MessageId>
            <Reference Role="buyer" Type="BusinessAgreement">Reference0</Reference>
            <SequenceId>SequenceId0</SequenceId>
            <Checksum Type="MD5">Checksum0</Checksum>
        </Header>
        <Body>
            <Order xmlns="http://www.nebi.biz/schemas/bd/order" BusinessDocumentVersion="7.0" OrderType="request" xsi:schemaLocation="http://www.nebi.biz/schemas/bd/order Order_L_0_96.xsd">
                <OrderId Role="buyer"/>
                <ProductLine Number="1">
                    <ProductUseCaseDetails Id="WICreation">
                        <wiCreation xmlns="http://mydomain.com/GRIPP/workitem">
                            <wiCreationHeader>
                                <userId>wmadm</userId>
                                <taskModelName>DNS02_CreateMasterZone</taskModelName>
                            </wiCreationHeader>
                            <wiCreationBody>
                                <DNS02CreationBody>
                                    <GlobalSection xmlns="http://mydomain.com/GRIPP/dns02">
                                        <Outcome>1</Outcome>
                                    </GlobalSection>
                                    <SpecificSection xmlns="http://mydomain.com/GRIPP/dns02">
                                        <Zonename>0.0</Zonename>
                                        <RRLocation>Domain</RRLocation>
                                        <RemoteSlaves type="multiline">
                                            <RemoteSlaveFQDN>test.com</RemoteSlaveFQDN>
                                            <RemoteSlaveIP>123.234.234.123</RemoteSlaveIP>
                                            <RemoteSlaveFQDN>test.net</RemoteSlaveFQDN>
                                            <RemoteSlaveIP>123.123.123.123</RemoteSlaveIP>
                                        </RemoteSlaves>
                                    </SpecificSection>
                                </DNS02CreationBody>
                            </wiCreationBody>
                        </wiCreation>
                    </ProductUseCaseDetails>
                </ProductLine>
             </Order>
        </Body>
        <Trace>
            <CheckPoint>
                <SystemName>SystemName0</SystemName>
                <SystemDateTime>2006-05-04T18:13:51.0Z</SystemDateTime>
            </CheckPoint>
        </Trace>
    </root>This is the output of the Document after parsing and augmentation with the Xerces parser.

  • Change Preview Image at Callout (Video library Thumbnails view) to another DOM elements

    Hello,
    Is it possible to change DOM of the already existiong Callout for Thumbnail View at Video Asset Library?

    Hi,
    To change the layout of the Callout, we can apply custom style to it like the following thread:
    http://social.msdn.microsoft.com/Forums/sharepoint/en-US/1ebc65d3-75b6-4851-a704-5bf412f25a34/customization-in-style-of-calloutjs-sharepoint-2013?forum=sharepointcustomization
    Or you can take use of the callout.js to create a custom Callout:
    http://www.learningsharepoint.com/2012/12/30/the-new-hover-overpreviewcallout-popups-in-sharepoint-2013/
    http://blog.alexboev.com/2012/07/custom-callouts-in-sharepoint-2013.html
    Best regards
    Patrick Liang
    TechNet Community Support

  • [CDATA] not the same way read in DOM and SAX (DOM: O.K., SAX: not O.K.)

    I wrote a test application that reads a XML file. First method reads it via DOM in a Document object, second that reads it via SAX in a string. The output is almost the same but the character data is different:
    while the dom outout is as expected:
    <hap>EUSF</hap>
    <name><![CDATA[WADDELL&REED ADV BOND CL Y]]></name>
    the SAX output is different:
    <hap>EUSF</hap>
    <name>WADDELL&REED ADV BOND CL Y</name>
    as both elements have text data, only the second is enclosed in a <![CDATA]> value. The DOM output is the same as when displayed the XML in internet explorer, so i guess this is the correct result. but my SAX reader does not display the <![CDATA]> value ...
    to get the sax output i subclassed DefaultHandler and overwrote the methods like described in the Web Service Tutorial "Echoing an XML File with the SAX Parser" (http://java.sun.com/webservices/docs/ea2/tutorial/doc/JAXPSAX3.html#64190):
    * Overwrites super.
    * Receive notification of character data inside an element.
    public void characters(char buf[], int offset, int len) {
    String s = new String(buf, offset, len);
    if (!s.trim().equals("")) { //suppress output of characters that are all whitespace
    write(s);
    }//characters()
    the characters() method has the content of an element, but it has not the information if a CDATA is enclosing the data or not(?). How can this be done?

    There's a thing called a LexicalHandler (org.xml.sax.ext.LexicalHandler) that has startCDATA and endCDATA methods. The API documentation suggests that you could create your own LexicalHandler and use it somehow, but it doesn't give you a nicely packaged example. I don't have an example of it either, sorry.
    However despite what you say, those two outputs are not different. In XML terms they are identical and parsers will treat them identically.

  • How to append a gif to another gif in adobe photosop cs5 extended???

    like i have two gif files and i need to apppend 2 gif file at the end of 1st gif file,,so that i 'll a single gif.

    There is no such thing as an "append" with GIF files, since adding frames always affects the color palette, which is global. Ultimately it doesn't matter if you use PS or another tool to add the frames, but of course using e.g. Ulead GIF Animator may be a bit more straightforward than going through the song and dance in PS...
    Mylenium

  • How do you append an ArrayList to another ArrayListt

    Hi,
    Basically I have two Arraylist and I want to append one on to the end of another?
    Any idea how to do this in Java in Python you just use the append function.. Cant find anything like this in Java though....

    david_david wrote:
    baskaraninfo wrote:
    list1.addAll(Arrays.asList(list2.toArray()));Why don't use
    list1.addAll(list2);Edited by: david_david on Jan 31, 2008 12:16 PMIndeed. That initial line where an array is converted to an array only to convert it back to a list reminds me of a gesture a student of mine taught me. He was Iranian, so I wonder if this is an Iranian gesture or just one of his own devising. It goes like this:
    +"Instead of doing this (tug left ear lobe with right hand, in the obvious way) you are doing this (awkwardly reach right arm across top of head and try to tug on left earlobe, again)."+

  • Need to Append one ByteArrayOutputStream to Another ByteArrayOutputStream

    hi all i need to append a ByteArrayOutputStream object to another one will anyone get me solution pls
    regards
    Mahesh

    hi all i need to append a ByteArrayOutputStream object to another one will anyone get me solution plsAppending one OutputStream to another does not make sense so I don't understand your question.
    You can use the writeTo(OutputStream out) method to append the content of one ByteArrayOutputStream to another.
    will anyone get me solution plsWhy don't you tell us what you've tried and what's your problem.

  • How to append structure dynamically to another structure

    Hi Everyone,
    My requirement is like this.
    PERFORM fill_additional_fields_f16 USING         'RIHAFVC'
                                                            CHANGING <ls_object_tab>.
    FORM fill_additional_fields_f16  USING         iv_structure_name TYPE strukname
                                                      CHANGING  cs_object    type any.
    endform.
    Now my question is how to append the structure IV_STRUCTURE_NAME to CS_OBJECT in the subroutine.
    Thanks in advance
    -Regards
      TOM

    Have a look at the below link.
    https://wiki.sdn.sap.com/wiki/display/Snippets/Add%20a%20column%20to%20an%20internal%20table%20dynamically
    Thanks

  • Appending videos one after another

    Salutations everybody.
    I need to use a MediaPlayer to play multiple video and / or audio files one after the other.
    The idea is that the user will select all the video he wants to hear and then hit the 'Play' button. Then I need to play all those videos in order, one after the other. That is, as soon as one video is done I want to begin playing the next video and so on.
    I assume this can be done ? Anyone can help me on the how to ?
    Thanx !

    The videos must also be checked. I had unchecked them so that they would not be transferred to my iPod that won't play them. It wasn't until I checked them and did the other things in this thread that the videos began to play one after another.
    I would like this to work when the videos are being played at full screen. But I can't seem to get that to work at all.

  • Error while appending a Node to another as child

    HI,
    I am new to XML and trying to add a Node n2 as a child to Node n1 and getting error "Node does not belong to current XML document" .Iwas getting these Node objects through APIs written by somebody.I am doing like this.
    Node n1 = SomeAPI.methode();
    Node n2 = SomeAPI.method();
    now n1.appendChild(n2);
    is this the right approach can anybody post sample code how to do this.

    be sure n1 and n2 has the same owner document,if not u can do like this:
    Node n1 = SomeAPI.methode();
    Node n2 = n1.getOwnerDocument().import(SomeAPI.method(),true/false);
    n1.appendChild(n2);

  • Store.connect passing dom\\user not dom\user

    Hi all,
    I am reading a properties file but I have tried to hardcode in the values. What I get is a logon exception:
    javax.mail.AuthenticationFailedException: Logon failure
    5.5.1960.6 (rdlcrmmail1.CRMLAB.com) ready
    A0 CAPABILITY
    * CAPABILITY IMAP4 IMAP4rev1 IDLE LITERAL+ LOGIN-REFERRALS MAILBOX-REFERRALS NAMESPACE AUTH=NTLM
    A0 OK CAPABILITY completed.
    A1 LOGIN "domain\\user" "password"
    A1 NO Logon failure
    Why does connect not properly pass the delimited String "\\"? Has anyone seen this before connecting to MSExchange?
    Thanks for any information.

    Try reading the prop into string.
    Check the string by doing a sys out
    see if problem exisits

  • How can I import an XML DOM document into another?

    Dear all,
    I'm using the following bit of code:
         public static Node replaceNode(Document replacedDocument,
                        Document replacingDocument,
                        Node replacedNode)
         //Create a documentFragment of the replacingDocument
         DocumentFragment docFrag = replacingDocument.createDocumentFragment();
         Element rootElement = replacingDocument.getDocumentElement();
         docFrag.appendChild(rootElement);     
         //Import docFrag under the ownership of replacedDocument
         Node replacingNode =
         ((replacedDocument).importNode(docFrag, true));
              //In order to replace the node need to retrieve replacedNode's parent
         Node replaceNodeParent = replacedNode.getParentNode();
         replaceNodeParent.replaceChild(replacingNode, replacedNode);
         return replacedDocument;
    to import a DOM document into another DOM document, so that it converts something like this:
    <?xml= .... etc>
    <Data></Data
    to:
    <?xml= .... etc>
    <Data>
    <Yellow>Butter</Yellow>
    <White>Marzipan</White>
    </Data>
    Instead, what it is doing is:
    <?xml= .... etc>
    <Yellow>Butter</Yellow>
    <White>Marzipan</White>
    I know that it is stripping out the <Data> elements because of the call to the replaceChild
    function, after getting the element's parent, but if I change
    Node replaceNodeParent = replacedNode.getParentNode();
    to
    Node replaceNodeParent = replacedNode;
    I get an error about node node being accessible.
    Please help!
    Paul

    http://forum.java.sun.com/thread.jsp?forum=34&thread=208596

Maybe you are looking for

  • Windows 7 and internet connection issue

    I am having a problem connecting to internet on Windows 7 OS. I have a Macbook that installed Windows 7 on Bootcamp. When I connect the DSL wire to my computer in dormitory it connects automatically. But when I go to somewhere else it doesn't connect

  • Can't Save Application State in Acrobat X Pro

    There once was a time that I could close Acrobat X Pro with various and sundry pdfs open and upon reopening the application, those selfsame documents would reappear. This is no longer the case, and I have no idea what has changed. I am using Acrobat

  • Content Server Installation in DMS

    Dears, We are implementing DMS on our Windows server and Database is Oracle 10.2.0.4. For it I have installed ECC6  server and now as I know I have to follow SPRO steps for DMS configuration. Beside it I have to install a content server also,For whic

  • How to separate single photos from that have been put into an album

    I always import and categorize my photos into albums immediately. But I've accidentally imported photos without putting them into an album so they don't appear in the 'events' section. They do however appear in the 'all photos' section along with tho

  • Download from camera to iPhoto or Photos

    Until yesterday I could download the photos on my digital camera to iPhoto. My Mac has now done an update & installed Photos & when I plug the sync lead in from the camera it shows the new photos in the preview pane but when I try to download I get a