Package org.xmldb.api.base

Examples of org.xmldb.api.base.Collection.removeResource()


                }

                if (table.get(XMLTools.NAME_OF) != null) {
                    Resource colresource = col.getResource((String) table.get(XMLTools.NAME_OF));

                    col.removeResource(colresource);
                    System.out.println("DELETED: " + table.get(XMLTools.COLLECTION) + "/" + table.get(XMLTools.NAME_OF));
                } else {
                    // User did not supply document name
                    System.out.println("ERROR : Document Key and switch required");
                }
View Full Code Here


        try {

            collection = getCollection("xmldb:xindice:///db/addressbook");

            Resource document = collection.getResource(args[0]);
            collection.removeResource(document);
            System.out.println("Document " + args[0] + " removed");
        } catch (XMLDBException e) {
            System.err.println("XML:DB Exception occured " + e.errorCode + " " + e.getMessage());
        } finally {
            if (collection != null) {
View Full Code Here

        
         // Get the documentKey for this particular Person
         String dockey = person.getDocKey();
        
         // Delete the document
         col.removeResource(col.getResource(dockey) );
        
      } catch (Exception e) {
         e.printStackTrace();

    // there's not much else we can do if the response is committed
View Full Code Here

            resources[0] = res;
        }
        for (int i = 0; i < resources.length; i++) {
            message("removing document " + resources[i].getId() + " ...");
            final Collection parent = resources[i].getParentCollection();
            parent.removeResource(resources[i]);
            messageln("done.");
        }
    }
   
    private void xupdate(final String resource, final String filename) throws XMLDBException, IOException {
View Full Code Here

        String s = (String) r.getContent();
        Node content = r.getContentAsDOM();
        System.out.println("Resource: " + r.getId());
        System.out.println("getContent: " + s);
        System.out.println("getContentAsDOM: " + content);
        coll.removeResource(r);
      }

      cms.removeCollection("A");
      DatabaseManager.deregisterDatabase(database);
      DatabaseInstanceManager dim =
View Full Code Here

      Database database = (Database) dbc.newInstance();
      DatabaseManager.registerDatabase(database);
      Collection coll =
        DatabaseManager.getCollection(baseURI, username, password);
      XMLResource resource = (XMLResource) coll.getResource(name);
      coll.removeResource(resource);
      DatabaseManager.deregisterDatabase(database);
      DatabaseInstanceManager dim =
        (DatabaseInstanceManager) coll.getService(
          "DatabaseInstanceManager",
          "1.0");
View Full Code Here

      String s = (String) resource.getContent();
      Node n = resource.getContentAsDOM();
      System.out.println("getContent: " + s);
      System.out.println("getContentAsDOM: " + n);

      coll.removeResource(resource);

      DatabaseManager.deregisterDatabase(database);
      DatabaseInstanceManager dim =
        (DatabaseInstanceManager) coll.getService(
          "DatabaseInstanceManager",
View Full Code Here

      Transformer t = TransformerFactory.newInstance().newTransformer();
      DOMSource source = new DOMSource(n);
      SAXResult result = new SAXResult(new DOMTest.SAXHandler());
      t.transform(source, result);

      coll.removeResource(resource);

      System.out.println("test 4 : PASSED");
    } catch (Exception e) {
      System.out.println("test 4 : FAILED");
      e.printStackTrace();
View Full Code Here

        ResourceSet rs = service.query("/person[@id='" + id + "']");

        for (ResourceIterator iterator = rs.getIterator(); iterator.hasMoreResources();) {
            Resource r = iterator.nextResource();
            System.err.println("Resource id=" + r.getId() + " xml=" + r.getContent());
            testCollection.removeResource(r);
            resource = null;
        }
    }

    @Test
View Full Code Here

        if (null != resource) {
            Collection collection = null;

            try {
                collection = DatabaseManager.getCollection(ROOT_URI + "/" + TEST_COLLECTION);
                collection.removeResource(resource);
            } finally {
                closeCollection(collection);
            }
        }
    }
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.