hi!

when i try to run this code against the xml given below i get the following
exception:

Has Children: true
Exception in thread "main" java.lang.NullPointerException
at org.apache.xindice.xml.dom.ContainerNodeImpl.appendChild(Unknown Source)

the code fragment is:
                :
                :
         Database database = (Database) c.newInstance();
         DatabaseManager.registerDatabase(database);
         col = DatabaseManager.getCollection("xmldb:xindice:///db/misc");
         XMLResource xmlResource = (XMLResource) col.getResource("test");
         Node node = xmlResource.getContentAsDOM();
           System.out.println("Has Children: " + node.hasChildNodes());
         Node newNode = node.cloneNode(true);
         node.appendChild(newNode);
                :
                :

the xml file is:

<?xml version="1.0"?>
<parent>
        <child id="123">Text goes here</child>
</parent>

i am not able to figure out what i am doing wrong. any help will be greatly
appreciated.

thanks in advance,
-nani

Reply via email to