Package org.xmldb.api.base

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


         saxReader.parse(new InputSource(fis));
         fis.close();
        
         // Create the XMLResource and store the document
         XMLResource resource =
               (XMLResource) col.createResource((String) table.get(XMLTools.NAME_OF),
                  "XMLResource");
         resource.setContent(ser.toString());
         col.storeResource(resource);
                          
         System.out.println("Added document " + table.get(XMLTools.COLLECTION) + "/" +
View Full Code Here


                              String name,
                              String doc)
         throws Exception {
      Collection col = DatabaseManager.getCollection(driver + "/" + path);

      XMLResource document = (XMLResource) col.createResource(name, "XMLResource");
      document.setContent(doc);
      col.storeResource(document);
   }

   public int countDocument(String path)
View Full Code Here

    /*
     * Create a binary resource, save it in the 'current' collection,
     * then retrieve it and verify that the data comes back right.
     */

        Resource newResource = collection.createResource(null, "BinaryResource");
        newResource.setContent(new byte[] { 0x00, 0x10, 0x01, 0x11 });
    collection.storeResource(newResource);
    String id = newResource.getId();

    Resource foundResource = collection.getResource(id);
View Full Code Here

        //
        // Create a binary resource, save it in the 'current' collection,
        // then list resources.
        //

        Resource newResource = collection.createResource(null, "BinaryResource");
        newResource.setContent(new byte[] { 0x00, 0x10, 0x01, 0x11 });
        collection.storeResource(newResource);
        String id = newResource.getId();

        String[] resources = collection.listResources();
View Full Code Here

    /*
     * Create a binary resource, save it in the 'current' collection,
     * then remove it and verify that it was indeed removed.
     */

        Resource newResource = collection.createResource(null, "BinaryResource");
        newResource.setContent(new byte[] { 0x00, 0x10, 0x01, 0x11 });
    collection.storeResource(newResource);
    String id = newResource.getId();

    Resource foundResource = collection.getResource(id);
View Full Code Here

        Collection col = DatabaseManager.getCollection(driver + "/" + path);
        if (col == null) {
            throw new XindiceException("DatabaseManager.getCollection(" + driver + "/" + path + ") returned null");
        }

        XMLResource document = (XMLResource) col.createResource(name, "XMLResource");
        document.setContent(doc);
        col.storeResource(document);
    }

    public int countDocument(String path) throws Exception {
View Full Code Here

            reader.parse(new InputSource(fis));
            fis.close();

            // Create the XMLResource and store the document
            XMLResource resource =
                    (XMLResource) col.createResource((String) table.get(XMLTools.NAME_OF),
                                                     "XMLResource");
            resource.setContent(ser.toString());
            col.storeResource(resource);

            System.out.println("Added document " + table.get(XMLTools.COLLECTION) + "/" +
View Full Code Here

      collection = getCollection("xmldb:xindice:///db/addressbook");
     
      String data = readFileFromDisk(args[0]);

      XMLResource document = (XMLResource) collection.createResource(null, "XMLResource");
      document.setContent(data);
      collection.storeResource(document);
      System.out.println("Document " + args[0] + " inserted as " + document.getId());
    }
    catch (XMLDBException e) {
View Full Code Here

         // Create xml string from from values
         ourdoc = toXml(fname,lname,workphone,homephone,cellphone,homeemail,workemail,
                           homeaddress,workaddress);
  
         // Create the XMLResource and store the document
         XMLResource resource = (XMLResource) col.createResource( "", "XMLResource" );
         resource.setContent(ourdoc);
         col.storeResource(resource);
        
      } catch ( Exception e) {
          e.printStackTrace();
View Full Code Here

    /*
     * Create a binary resource, save it in the 'current' collection,
     * then retrieve it and verify that the data comes back right.
     */

        Resource newResource = collection.createResource(null, "BinaryResource");
        newResource.setContent(new byte[] { 0x00, 0x10, 0x01, 0x11 });
    collection.storeResource(newResource);
    String id = newResource.getId();

    Resource foundResource = collection.getResource(id);
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.