Package org.xmldb.api.base

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


        Resource doc;

        // Store module
        try {
            Collection testCollection = getTestCollection();
            doc = testCollection.createResource(module_name, "BinaryResource");
            doc.setContent(module);
            ((EXistResource) doc).setMimeType("application/xquery");
            testCollection.storeResource(doc);
        } catch (XMLDBException ex) {
            ex.printStackTrace();
View Full Code Here


        Resource doc;

        // Store module
        try {
            Collection testCollection = getTestCollection();
            doc = testCollection.createResource(module_name, "BinaryResource");
            doc.setContent(module);
            ((EXistResource) doc).setMimeType("application/xquery");
            testCollection.storeResource(doc);
        } catch (XMLDBException ex) {
            ex.printStackTrace();
View Full Code Here

    // http://sourceforge.net/support/tracker.php?aid=1807014
    public void testWrongAddNamespace_1807014() {
        try {
          Collection testCollection = getTestCollection();
            Resource doc = testCollection.createResource("a.xqy", "BinaryResource");
            doc.setContent("module namespace a = \"http://www.a.com\"; "
                            +"declare function a:selectionList() as element(ul) { "
                            +"<ul class=\"a\"/> "
                            +"};");
            ((EXistResource) doc).setMimeType("application/xquery");
View Full Code Here

  protected void setUp() {
    try {
      super.setUp();
     
      Collection col = getTestCollection();
      XMLResource res = (XMLResource) col.createResource("testappend.xml", "XMLResource");
      res.setContent("<root><node id=\"1\"/></root>");
      col.storeResource(res);
     
      addAction(new XQueryUpdateAction(URI + "/C1", "testappend.xml"), 20, 0, 0);
      addAction(new XQueryUpdateAction(URI + "/C1", "testappend.xml"), 20, 0, 0);
View Full Code Here

        try {
            broker = db.get(db.getSecurityManager().getSystemSubject());

            Collection root = DatabaseManager.getCollection(BASE_URI + testCollection, "admin", "");

            Resource resource = root.createResource("data.xml", "XMLResource");
            resource.setContent(DOCUMENT1_CONTENT);
            root.storeResource(resource);

            assertEquals(3, AnotherTrigger.createDocumentEvents);
View Full Code Here

        try {
            broker = db.get(db.getSecurityManager().getSystemSubject());

            Collection root = DatabaseManager.getCollection(BASE_URI + testCollection, "admin", "");

            Resource resource = root.createResource("data.xml", "XMLResource");
            resource.setContent(DOCUMENT2_CONTENT);
            root.storeResource(resource);

            resource = root.createResource("data.xml", "XMLResource");
View Full Code Here

            Resource resource = root.createResource("data.xml", "XMLResource");
            resource.setContent(DOCUMENT2_CONTENT);
            root.storeResource(resource);

            resource = root.createResource("data.xml", "XMLResource");

            assertEquals(DOCUMENT3_CONTENT, resource.getContent().toString());

        } catch (XMLDBException e) {
            e.printStackTrace();
View Full Code Here

            Collection root = DatabaseManager.getCollection(BASE_URI + testCollection, "admin", "");

            IndexQueryService idxConf = (IndexQueryService) root.getService("IndexQueryService", "1.0");
            idxConf.configureCollection(COLLECTION_CONFIG);

            Resource resource = root.createResource("data.xml", "XMLResource");
            resource.setContent(DOCUMENT2_CONTENT);
            root.storeResource(resource);

            resource = root.createResource("data.xml", "XMLResource");
View Full Code Here

            Resource resource = root.createResource("data.xml", "XMLResource");
            resource.setContent(DOCUMENT2_CONTENT);
            root.storeResource(resource);

            resource = root.createResource("data.xml", "XMLResource");

            assertEquals(DOCUMENT3_CONTENT, resource.getContent().toString());

        } catch (XMLDBException e) {
            e.printStackTrace();
View Full Code Here

        File[] files = samples.listFiles();
        MimeTable mimeTab = MimeTable.getInstance();
        for (int j = 0; j < files.length; j++) {
            MimeType mime = mimeTab.getContentTypeFor(files[j].getName());
            if(mime != null && mime.isXMLType()) {
                Resource resource = collection.createResource(files[j].getName(), "XMLResource");
                resource.setContent(files[j]);
                collection.storeResource(resource);
            }
        }
    }
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.