Copy the nodes from one Document obj to another Document Obj.

Hi All,
I have two Document Objects created out of the same InputStream source.Both of them have the same DTD, namely SourceDoc and TargetDoc.
Now when I try to replace a node in TargetDoc with that in SourceDoc, it is giving me the below exception.
*org.w3c.dom.DOMException: NOT_FOUND_ERR: An attempt is made to reference a node
in a context where it does not exist.*
I then tried with TargetDoc.importNode(), even this function resulted in the same above error. How can I make the Parser get to know that , both the SourceDoc and the TargetDoc belong to the same XSD...
Thanks,
Sabarisri. N

Hi Sabarisri, I have to downplay a bit the drama that might appear in the response above. After looking at my notes, I think if the schema document is properly made (in particular, not itself invalid---that's important), you can normally proceed with in-memory revalidation. That I have renew the checking using a demo, like this.
Let the xsd look like this.
<?xml version="1.0" encoding="UTF-8"?> 
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" attributeFormDefault="unqualified"> 
<xs:element name="root" type="roottype" /> 
<xs:complexType name="roottype"> 
  <xs:sequence>
    <xs:element name="child" type="xs:string" maxOccurs="2"/> 
  </xs:sequence> 
</xs:complexType> 
</xs:schema>This is a correct xsd in itself.
Suppose you've an xml doc like this.
<root>
  <child>child-1</child>
  <child>child-2</child>
</root>If you proceed with append another child to the dom tree and do an in-memory revalidation, it can be done without complication. For this category of problems, you should not encounter the problem I mentioned.
//suppose the doc be the xml document loaded into the dom-tree
//suppose the validator being the Validator instance with the xsd document loaded
//this would lead to no error before doing anything else
validator.validate(new DOMSource(doc));
//then you start make another child to make the doc invalid
Element elem=doc.createElement("child");
elem.setTextContent("child-3");
doc.getDocumentElement().appendChild(elem);
//do an in-memory revalidation, using the same validator in the memory already
validator.validate(new DOMSource(doc));
//this time it will result in error in the error handler of the validator as expected --- normal behaviourFor this kind of re-validation, which belongs to a very large category of problems to encounter, you should be able to do it like the above. (Just bearing in mind, on some fringe cases, oddity might result.) Hence, I should not encourage a temporary intermediate xml file approach, which all can understand very clumnsy and inefficient.

Similar Messages

  • How can I copy the layer from one .PSD file to another .PSD file?

    Hi,
    Actually it is shape and mask on one layer which I want to use it on my Photoshop CS4 file. If I select all the layer and copy it to my file it just copies the shape but not the mask. How can I copy MASK to my file?
    Please do hlep.
    Actually I am trying to copy the following layer.

    I believe the fastest way would be to duplicate the layer and send it to the other document. Open both images. Click the document tab of the document with the shape layer. With the shape layer selected in the layers palette, right click where it says the shape layer name. Select "duplicate layer" from the context menu. In the dialog that comes up, select the document you want to copy that layer to in the destination box then press ok.
    Alternately, you can open both images then pull the document frame tabs down to open both images in your workspace. Grab the shape layer in the document's layers palette by left clicking it...keep the left button pressed (hand icon should be a grab icon). While left button is still pressed, drag the shape layer over the receiving document. To make the shape layer register in the same location, press the shift key and keep it pressed. Release left mouse button while the layer is over the receiving document. Release shift key after you have released the left mouse button.
    This tutorial has a good photo reference for what I mean when I say pull the image tabs down so both documents appear in the same workspace...also shows drag/drop:
    http://www.photoshopcstutorials.co.uk/html/cs4_workspace___palette_notes.html

  • How can I copy the config from one SF300-24p to another?

    I can download the config, but do not see any upload options.
    Fred

    Fred,
    The saved config is a text file.
    You should be able to backup a config to your desktop and restore it to another similar unit.  I hope..
    let me know if you have any problems. See my screen shot below;
    regards Dave

  • How to copy a node from one dom document to another?

    I have one dom document that I have to split up into multiple dom documents. I am able to get the inividual nodes that I want to put into seperate documents.
    My problem occurs when I create a new dom document and try to add the node from the parent document. I get an exception saying (copied from api: WRONG_DOCUMENT_ERR: Raised if newChild was created from a different document than the one that created this node. )
    How can I make it so that I can copy a node from one document and add it to another.

    Have you checked out the API called importNode in the DOM Document. It lets you move nodes between different documents.
    This api lets you simply copy the existing node from one document into another. without creating any new nodes for it.
    I have done a small example please have a look.
    Book.xml
    <?xml version="1.0"?>
    <books>
      <book>
        <name>Inside Corba</name>
      </book>
      <book>
        <name>Inside RMI</name>
      </book>
    </books>------------------------
    Book2.xml
    <?xml version="1.0"?>
    <books>
      <book>
        <name>Core Java </name>
      </book>
      <book>
        <name>Core JINI</name>
      </book>
    </books>-------------------
    MoveNode.java (copies nodes from doc2 into doc1)
    import java.io.*;
    import javax.xml.parsers.*;
    // structures
    import org.w3c.dom.*;
    import org.xml.sax.*;
    public class MoveNode
      public static void main(String[] args)
        // step1. create a factory and configure it
        DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
        // step2. set various configurations
        factory.setValidating(false); // do not need validation at this time.
        factory.setIgnoringComments(false); // do not ignore comments
        factory.setIgnoringElementContentWhitespace(false); // do not ignore element content whitespace.
        factory.setCoalescing(false);
        factory.setExpandEntityReferences(true);
        // step 3 create a document builder
        DocumentBuilder builder = null;
        try
          builder = factory.newDocumentBuilder();
        catch(ParserConfigurationException e)
          e.printStackTrace();
        try
          Document doc1 = builder.parse(new File("book.xml"));
          Document doc2 = builder.parse(new File("book2.xml"));
          if (doc1 == null || doc2 == null)
            System.out.println("doc1 is null or doc2 is null");
            System.exit(1);
          } // if
          // fetch books from doc2
          NodeList list = doc2.getElementsByTagName("book");
          System.out.println("number of books found " + list.getLength());
          Node node1 = list.item(0);
          Node node2 = list.item(1);
          // get the root node of doc1
          Node root = (Node) doc1.getDocumentElement();
          root.appendChild(doc1.importNode(node1, false));
          root.appendChild(doc1.importNode(node2, false));
          //now doc1 should have 4 nodes
          System.out.println(doc1.getElementsByTagName("book").getLength());
        } // try
        catch(SAXException se)
          se.printStackTrace();
        catch(IOException ie)
          ie.printStackTrace();
    hope this helps.
    regards,
    Abhishek.

  • How do I copy the style from one control to another?

    I need to programmatically copy the style from one graph to another. I'm currently using the importstyle and export style functions but I'd like to avoid that since: 1) I'm creating >100 of the same graphs in a scrolling window and execution time is a concern, and 2) it makes it harder to redistribute the application, and 3) you shouldn't have to import/export from disk just to copy a graph style.
    I noticed the copy constructor was disabled so you can't just create a new one from the original. I suppose I could iterate through all the styles and transfer them from the master graph to all the copies but is there an easier way to do that? If not, is there some sample code for that?
    I'm using MStudio 7.0 for C
    ++.
    Thanks,
    -Bob

    One way that you could do this would be to create a helper method that configures your graph rather than configuring it at design-time, then use that helper method to apply the settings to the new graphs that you create. However, this would only work if you wanted all graphs to be configured exactly the same way - this would not work if the settings of your master graph are changing at run-time and you want the new graphs to be configured with the current settings of the master graph.
    Another approach is to query each control for IPersistPropertyBag, create an IPropertyBag, pass the IPropertyBag to the master graph's IPersistPropertyBag:ave, then pass the IPropertyBag to the new graph's IPersistPropertyBag::Load implementation. I'm not aware of any implementations of IPropertyBag that are readily available for use in applications, so the tricky part is creating the IPropertyBag. Below is a very simple implementation of IPropertyBag that should be enough to get the job done for this example. First, add this to your stdafx.h:
    #include <atlbase.h>
    CComModule _Module;
    #include <atlcom.h>
    #include <atlcoll.h>
    Here's the simple IPropertyBag implementation:
    class ATL_NO_VTABLE CSimplePropertyBag :
    public CComObjectRootEx<CComSingleThreadModel>,
    public IPropertyBag
    private:
    CAtlMap<CComBSTR, CComVariant> m_propertyMap;
    public:
    BEGIN_COM_MAP(CSimplePropertyBag)
    COM_INTERFACE_ENTRY(IPropertyBag)
    END_COM_MAP()
    STDMETHODIMP Read(LPCOLESTR pszPropName, VARIANT* pVar, IErrorLog* pErrorLog)
    HRESULT hr = E_FAIL;
    if ((pszPropName == NULL) || (pVar == NULL))
    hr = E_POINTER;
    else
    if (SUCCEEDED(::VariantClear(pVar)))
    CComBSTR key = pszPropName;
    CComVariant value;
    if (!m_propertyMap.Lookup(key, value))
    hr = E_INVALIDARG;
    else
    if (SUCCEEDED(::VariantCopy(pVar, &value)))
    hr = S_OK;
    return hr;
    STDMETHODIMP Write(LPCOLESTR pszPropName, VARIANT* pVar)
    HRESULT hr = E_FAIL;
    if ((pszPropName == NULL) || (pVar == NULL))
    hr = E_POINTER;
    else
    m_propertyMap.SetAt(pszPropName, *pVar);
    hr = S_OK;
    return hr;
    Once you have a way to create an implementation of IPropertyBag, you can use IPropertyBag and IPersistPropertyBag to copy the settings from one control to another like this:
    void CopyGraphStyle(CNiGraph& source, CNiGraph& target)
    LPUNKNOWN pSourceUnknown = source.GetControlUnknown();
    LPUNKNOWN pTargetUnknown = target.GetControlUnknown();
    if ((pSourceUnknown != NULL) && (pTargetUnknown != NULL))
    CComQIPtr<IPersistPropertyBag> pSourcePersist(pSourceUnknown);
    CComQIPtr<IPersistPropertyBag> pTargetPersist(pTargetUnknown);
    if ((pSourcePersist != NULL) && (pTargetPersist != NULL))
    CComObject<CSimplePropertyBag>* pPropertyBag = 0;
    CComObject<CSimplePropertyBag>::CreateInstance(&pPropertyBag);
    if (pPropertyBag != NULL)
    CComQIPtr<IPropertyBag> spPropertyBag(pPropertyBag);
    if (spPropertyBag != NULL)
    if (SUCCEEDED(pSourcePersist->Save(spPropertyBag, FALSE, TRUE)))
    pTargetPersist->Load(spPropertyBag, NULL);
    (Note that "CreateInstan ce" above should be CreateInstance - a space gets added for some unknown reason after I click Submit.)
    Then you can use this CopyGraphStyle method to copy the settings of the master graph to the new graph. Hope this helps.
    - Elton

  • MM01 -- Update Was terminated while copying the material from one plant

    Hi Experts,
    While I am trying to copy the material from one plant like ETPE to another plant ETPZ , its telling that material created.
    But when we try to display the created material in MM02 for plant ETPZ , it says that material does not exist.
    Note : After creating the material , if we try to move any transaction code it shows the error message box and  says that Update was terminated .
    Kindly help us to resolve this.
    Regards,
    Vijay

    Hi rob,
    we have put the debugging , if there is any badi , enhancement the debugger would have gone to exit or enhancement line but its not going to any where.
    and I have checked in sm13 ..
    its giving the error like update was terminated
    from funtion module : MATERIAL_UPDATE_DB
    Report name :      LGRAPU37
    row : 360.
    ABAP/4 processor: POSTING_ILLEGAL_STATEMENT
    but if we go and see in the row 360 ...
    CALL SCREEN 100 line only
    is there , even if we put the breakpoint in this line , while we are debugging , debugger is not going to that line .
    Note : if we see the screen 100 it shows the empty screen.

  • Needed to copy the share from one server to share in another server

    Hi ,
    Needed to copy the data from one share named as xyz in the server 1 to the another share abc in another server 2.
    Share xyz data should be copied to the share abc which has already different data in it .We need to copy all the data from the share xyz to the share abc  without deleting any existing data in the destination share.
    I know that /MIR option will replace the destination same as source
    Can anybody help us in the Robocopy command & switches for this activity?
    Any help is greatly appreciated!
    Thanks & Regards S.Swaminathan Live & let others live!!!

    Hi Mandy,
    Thanks for your reply.
    I have done many robocopy for the share movements from the one server joined in a domain to another server joined in the same domain.In that instances, the destination server will not be having any share of the old server name and just I robocopy the share
    from the old server to the new server after creating a new share .The usual command is as follows:
    "\\server1\oldshare" \\server2\newshare" *.* *.* *.* /ZB /E /COPY:DATO /XJ /R:0 /W:0 /TEE /dcopy:T /NP /log:c:\robocopy.txt
    And after the copy , during the cutover of the standalone DFS pointing to the new share , the domain users in the corresponding access groups (name of the groups based on the old server name) of Full,Modify,Read will be appropriately copied to the respective
    new  groups (name of the groups based on the new server name) of the new share and the access is ensured by the users.
    But in this case , the destination server is already having a share with existing data in it and to be added with the old share data
    My question is shall I use the same command as before by copying all the data to the newly created subfolder inside the existiing destination share through the following command
    "\\server1\oldshare" \\server2\newshare\new sub-folder" *.* *.* *.* /ZB /E /COPY:DATO /XJ /R:0 /W:0 /TEE /dcopy:T /NP /log:c:\robocopy.txt
    You have already mentioned /E without purge options will do.
    Just asking one more time for the safer side
    Thanks & Regards S.Swaminathan Live & let others live!!!

  • How to copy the data from one database to another database without DB link

    Good Day,
    I want to copy the data from one database to another database with out DB link but the structure is same in both.
    Thanks
    Nihar

    You could use SQL*Plus' COPY command
    http://technology.amis.nl/blog/432/little-gold-nugget-sqlplus-copy-command
    http://download.oracle.com/docs/cd/B19306_01/server.102/b14357/apb.htm#sthref3702
    Edited by: Alex Nuijten on Sep 16, 2009 8:13 AM

  • How to Copy the PLD from one database to another

    Dear Members,
       i have designed the  PLD for Purchase Order, i want to copy the particular PLD into another Database.
    i tried to copy the PLD from one database to another through copy express.. i copied the PLD sucessfully. But the problem is,it copies all PLD's from one database to another. i want only the Purchaseorder PLD has to be copied in to another database.any body can help me in this regard.
    With Regards,
    G.shankar Ganesh

    Hi,
    select * into A1 from RDOC where Author !='System'
    select *  into A2  from  RITM   where Doccode  in (select Doccode from A1 )
    select * from A1
    select * from A2
    sp_generate_inserts 'A1'
    sp_generate_inserts 'A2'
    you will get Insert scripts of A1 and A2 tables .After that You 'll  Replace A1 to RDOC and A2 to RITM.
    So that you can RUN this SQL srcipts any where (In any Database)
    but First u have to run sp_generate_inserts  Storeprocedure(from websites) .
    drop table A1,A2

  • When I copy and paste from one source material to another  within adobe reader, all the words are in one sentence. I have to take extra time to separate  the words using the space bar. Can this be fix?

    When I copy and paste from one source material to another  within adobe reader, all the words are in one sentence. I have to take extra time to separate  the words using the space bar. Can this be fix?

    Hi Bernie,
    Are you trying to copy and paste from a pdf to another pdf?
    Regards,
    Rave

  • How to Move or Copy the Tables from One Database to Another Database ?

    HI,
          Can any one help me on this, How i can move or copy the tables from one database to another database in SQL server 2005 by using SQL query. Hope can anyone provide me the useful and valuable response.
    Thanks
    Gopi

    Hello,
    Maybe these links help you out
    http://www.microsoft.com/downloads/en/details.aspx?familyid=56E5B1C5-BF17-42E0-A410-371A838E570A&displaylang=en
    http://www.suite101.com/content/how-to-copy-a-sql-database-a193532
    Also, you can just detach the database make a copy and move it to the new server.

  • How to copy a table from one text frame to another...

    Is there a way to copy a table from one text frame to another? I'm using JavaScript. The following will move a table from one text frame to another, but I need to copy.
    var srcFrame = document.textFrames.item("section-template");
    var dstFrame = document.textFrames.item("test");
    srcFrame.characters[0].move(LocationOptions.before, dstFrame.insertionPoints[0]);
    Thanks,
    Mike-

    Hi Bhupinder,
    According to your description, you want to copy a table with Primary keys from one database to another database.
    As per my understanding, I think the best method is use Transfer SQL Server Objects Task in SQL Server Integration Services. The Transfer SQL Server Objects task transfers one or more types of objects in a SQL Server database between instances of SQL Server.
    Server roles, roles, and users from the specified database can be copied, as well as the permissions for the transferred objects. Indexes, Triggers, Full-text indexes, Primary keys, Foreign keys can also be copied.
    To use the Transfer SQL Server Objects Task, we should create a SQL Server Integration Services Project in SQL Server Data Tools, then drag a Transfer SQL Server Objects Task to Control Flow pane. Specify SourceConnection, SourceDatabase, DestinationConnection
    and DestinationDatabase for the Connection, select the table in the ObjectsToCopy category, then change CopyPrimaryKeys to True and the other corresponding properties in the task.
    References:
    Transfer SQL Server Objects Task
    Transfer SQL Server Objects Task in SSIS 2008 R2 With Example
    Thanks,
    Katherine Xiong
    Katherine Xiong
    TechNet Community Support

  • How do I copy an image from one Keynote presentation to another one?

    I have a previously saved presentation on Keynote in iCloud. I created it from my desktop at work. Some of the images I used for the presentation I want to use again in another presentation, onlh this time I am working off my laptop and don't have the same access to those images. Is it possible to copy/paste images from one Keynote presentation into another? I can't even seem to click on the image and save it.
    Any suggestions?

    Clicking and dragging does not work.
    Click on the image and Copy and Paste
    or
    Inspector > Metrics > File Info > click on the icon of the file and drag it to your desktop
    You can then drag that file back in wherever you want.
    Peter

  • Copying a page from one picture book into another

    Does anyone know how to copy a page from one picture book into another. I have made 2 books and would like to make a third consisting of pages from the first 2 but seem unable to do it without starting again, or at least starting from a duplicate of one and re doing all the missing pages.

    Garageclan
    Welcome to the Apple user to user assistance forums
    print each page you want to include in "book 3" to a PDF and use the send PDF to iPhoto option - this will give you the pages as images in iPhoto that you can them place into "book 3"
    See Old Toad's tutorial #19 for more details - http://web.mac.com/toad.hall/OldToadsTutorials/No._19.html - note that it is slightly different - you are only using the beginning part
    LN

  • Copy a page from one page group to another

    Hi
    Is it possible to copy a page from one page group to another?
    Regards,
    Lene

    Hi ,
    Through Portal it is not possible to copy a page from one page group to another .
    There is a feature in Portal WebDav .
    Through a DAV client you can copy page to your local system as a folder and then drag the page to the pagegroup you want to copy .
    Regards
    Medini

Maybe you are looking for

  • Oracle 11G,10g and DB2 replication?

    Oracle 11G,10g and DB2 replication? ======================================= We are using Oracle 11gR2. We have a table in Oracle filled with partial data (over 200K+, it may grow to 1M). The rest need to be obtained from DB2. It is not from one DB2 t

  • How To traverse files under subfolder using Traverse folder option

    My files are stored as Newborn.txt under each year's subfolder, How to implement this. Eg: C:\Ravi\N90\Newborn.txt   C:\Ravi\N91\Newborn.txt C:\Ravi\N92\Newborn.txt C:\Ravi\N93\Newborn.txt Pl help me to read the files using the for each loop containe

  • Any print graphic designers using a MacBook?

    My 15" Powerbook 800 is so painfully slow now, and the battery connection stinks- it always shuts off if not plugged in (replaced the battery 3 times, and Apple no longer sells the original battery). So I think it's time for a replacement- but I don'

  • How to increase java virtual machine.. i am using Ocj4 server

    How to increase memory size java virtual machine.. i am using Ocj4 server Edited by: java_net on Aug 29, 2008 4:09 PM

  • Export to movie in Logic 9.1

    I'm incredibly psyched about Logic 9.1; it's eliminated all the memory problems I was having with Spectrasonics virtual instruments and I can't wait to use it once all my plugs have gone 64 bit. But if you, like me, score film for a living you should