Examples of validateXMLResource()


Examples of org.exist.collections.Collection.validateXMLResource()

            String existHome = System.getProperty("exist.home");
            File existDir = existHome==null ? new File(".") : new File(existHome);
      File f = new File(existDir,"samples/shakespeare/r_and_j.xml");
      assertNotNull(f);
            IndexInfo info = test2.validateXMLResource(transaction, broker, XmldbURI.create("new_test2.xml"),
          new InputSource(f.toURI().toASCIIString()));
      test2.store(transaction, broker, info, new InputSource(f.toURI()
          .toASCIIString()), false);

      transact.commit(transaction);
View Full Code Here

Examples of org.exist.collections.Collection.validateXMLResource()

          broker.saveCollection(transaction, root);
         
          Collection test = broker.getOrCreateCollection(transaction, TEST_COLLECTION_URI.append("test2"));
          broker.saveCollection(transaction, test);
         
          info = test.validateXMLResource(transaction, broker, XmldbURI.create("test.xml"), TEST_XML);
          //TODO : unlock the collection here ?
          test.store(transaction, broker, info, TEST_XML, false);
 
          mgr.commit(transaction)
          System.out.println("Transaction commited ...");
View Full Code Here

Examples of org.exist.collections.Collection.validateXMLResource()

                  }
              }
             
              final InputStream is = new ByteArrayInputStream(xml);
              source = new InputSource(is);
              info = collection.validateXMLResource(transaction, broker, docUri.lastSegment(), source);
              final MimeType mime = MimeTable.getInstance().getContentTypeFor(docUri.lastSegment());
              if (mime != null && mime.isXMLType()){
                info.getDocument().getMetadata().setMimeType(mime.getName());
              }
              if (created != null)
View Full Code Here

Examples of org.exist.collections.Collection.validateXMLResource()

            }
          }

          //XML
          if(treatAsXML) {
            info = collection.validateXMLResource(transaction, broker, docUri.lastSegment(), source);
            if (created != null)
              {info.getDocument().getMetadata().setCreated(created.getTime());}                 
            if (modified != null)
              {info.getDocument().getMetadata().setLastModified(modified.getTime());}                 
          } else {
View Full Code Here

Examples of org.exist.collections.Collection.validateXMLResource()

            for (int i = 0; i < files.length; i++) {
                f = files[i];
                MimeType mime = MimeTable.getInstance().getContentTypeFor(f.getName());
                if (mime == null || mime.isXMLType()) {
                    try {
                        info = root.validateXMLResource(transaction, broker, XmldbURI.create(f.getName()), new InputSource(f.toURI().toASCIIString()));
                        assertNotNull(info);
                        root.store(transaction, broker, info, new InputSource(f.toURI().toASCIIString()), false);
                    } catch (SAXException e) {
                        System.err.println("Error found while parsing document: " + f.getName() + ": " + e.getMessage());
                    }
View Full Code Here

Examples of org.exist.collections.Collection.validateXMLResource()

           
            Collection test2 = broker.getOrCreateCollection(transaction, TestConstants.TEST_COLLECTION_URI2);
            assertNotNull(test2);
            broker.saveCollection(transaction, test2);
           
            IndexInfo info = test2.validateXMLResource(transaction, broker, TestConstants.TEST_XML_URI, TEST_XML);
            assertNotNull(info);
            //TODO : unlock the collection here ?
           
            test2.store(transaction, broker, info, TEST_XML, false);
           
View Full Code Here

Examples of org.exist.collections.Collection.validateXMLResource()

            File[] docs = dir.listFiles();
            assertNotNull(docs);
            for (int i = 0; i < docs.length; i++) {
                f = docs[i];
                assertNotNull(f);
                info = test2.validateXMLResource(transaction, broker, XmldbURI.create(f.getName()), new InputSource(f.toURI().toASCIIString()));
                assertNotNull(info);
                test2.store(transaction, broker, info, new InputSource(f.toURI().toASCIIString()), false);
            }
           
            transact.commit(transaction);
View Full Code Here

Examples of org.exist.collections.Collection.validateXMLResource()

            // store some documents.
            for (int i = 0; i < files.length && i < RESOURCE_COUNT; i++) {
                f = files[i];
                assertNotNull(f);
                try {
                    info = test2.validateXMLResource(transaction, broker, XmldbURI.create(f.getName()), new InputSource(f.toURI().toASCIIString()));
                    assertNotNull(info);
                    test2.store(transaction, broker, info, new InputSource(f.toURI().toASCIIString()), false);
                } catch (SAXException e) {
                  //TODO : why store invalid documents ?
                    System.err.println("Error found while parsing document: " + f.getName() + ": " + e.getMessage());
View Full Code Here

Examples of org.exist.collections.Collection.validateXMLResource()

            // store some documents.
            for (int i = 0; i < files.length && i < RESOURCE_COUNT; i++) {
                f = files[i];
                assertNotNull(f);
                try {
                    info = test2.validateXMLResource(transaction, broker, XmldbURI.create(f.getName()), new InputSource(f.toURI().toASCIIString()));
                    assertNotNull(info);
                    test2.store(transaction, broker, info, new InputSource(f.toURI().toASCIIString()), false);
                } catch (SAXException e) {
                    System.err.println("Error found while parsing document: " + f.getName() + ": " + e.getMessage());
                }
View Full Code Here

Examples of org.exist.collections.Collection.validateXMLResource()

            mgr.addConfiguration(transaction, broker, test, COLLECTION_CONFIG);
           
      InputSource is = new InputSource(new File(
          "samples/shakespeare/hamlet.xml").toURI().toASCIIString());
      assertNotNull(is);
      IndexInfo info = test.validateXMLResource(transaction, broker,
          XmldbURI.create("hamlet.xml"), is);
      assertNotNull(info);
      test.store(transaction, broker, info, is, false);
      transact.commit(transaction);
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.