Examples of DocumentLoader


Examples of org.infoset.xml.DocumentLoader

      String charset = entity.getMediaType().getParameters().getValues("charset");
      if (charset==null) {
         charset = "UTF-8";
      }
      try {
         DocumentLoader loader = new SAXDocumentLoader();
         Reader r = new InputStreamReader(entity.getStream(),charset);
         Document doc = loader.load(r);
         r.close();
        
         // Find the entry
        
         try {
View Full Code Here

Examples of org.infoset.xml.DocumentLoader

      super.loadSchema(name, connection, sqlLocation);
      if (name.equals("auth")) {
         URL defaultDB = this.getClass().getResource("default-db.xml");
         if (defaultDB!=null) {
            try {
               DocumentLoader loader = new SAXDocumentLoader();
               RestoreDestination restore = new RestoreDestination(LOG,this);
               loader.generate(defaultDB.toURI(), restore);
            } catch (XMLException ex) {
               throw new IOException(ex.getMessage());
            } catch (URISyntaxException ex) {
               throw new IOException(ex.getMessage());
            }
View Full Code Here

Examples of org.infoset.xml.DocumentLoader

                  term(constructor,dest,fterm.getTerm().getURI(),fterm.getValue());
               }
               link(constructor,dest,"related",resourceBase+feed.getPath());
               dest.send(constructor.createElementEnd(AtomResource.ENTRY_NAME));
            }
            DocumentLoader loader = new SAXDocumentLoader();
            Iterator<TermInstance<Entry>> entries = app.getDB().getEntriesByTerm(dbTerm,value);
            while (entries.hasNext()) {
               TermInstance<Entry> termValue = entries.next();
               Entry entry = termValue.getTarget();
               Feed feed = entry.getFeed();
               String feedPath = feed.getPath();
               String feedBaseURI = resourceBase.toString()+feedPath;
               dest.send(constructor.createCharacters("\n"));

               // get the entry representation
               Representation rep = app.getStorage().getEntry(feedBaseURI,feedPath,feed.getUUID(),entry.getUUID());
              
               // avoid thread creation because reading an output representation requires a thread
               StringWriter sw = new StringWriter();
               rep.write(sw);
               rep.release();
               loader.generate(new StringReader(sw.toString()), new RemoveDocumentFilter(dest));
              
            }
         }
      } catch (Exception ex) {
         throw new XMLException("Exception while getting ancestors.",ex);
View Full Code Here

Examples of org.infoset.xml.DocumentLoader

               if (progress.update) {
                  progress.status = appResponse.getStatus().getCode();
               } else {
                  try {
                     Reader r = appResponse.getEntity().getReader();
                     DocumentLoader loader = new SAXDocumentLoader();
                     Document entryDoc = loader.load(r);
                     Entry entry = new Entry(entryDoc);
                     entry.index();
                     progress.entryId = entry.getId();
                     progress.status = appResponse.getStatus().getCode();
                     getLogger().info("Entry: "+progress.entryId+", status="+progress.status);
View Full Code Here

Examples of org.infoset.xml.DocumentLoader

      throws ConfigurationException
   {
      Map<String,DB> dbList = new HashMap<String,DB>();
      File dbConf = new File(dir,"db.conf");
      if (dbConf.exists()) {
         DocumentLoader loader = new SAXDocumentLoader();
         try {
            Document doc =loader.load(dbConf.toURI());
            Iterator<Element> databases = doc.getDocumentElement().getElementsByName(AdminXML.NM_DATABASE);
            while (databases.hasNext()) {
               Element databaseE = databases.next();
               URI href = databaseE.getBaseURI().resolve(databaseE.getAttributeValue("href"));
               if (!href.getScheme().equals("file")) {
View Full Code Here

Examples of org.infoset.xml.DocumentLoader

            // avoid thread creation because reading an output representation requires a thread
            StringWriter sw = new StringWriter();
            rep.write(sw);
            rep.release();
            DocumentLoader loader = new SAXDocumentLoader();
            loader.generate(new StringReader(sw.toString()), new RemoveDocumentFilter(dest));

         }
      } catch (Exception ex) {
         throw new XMLException("Exception while getting ancestors.",ex);
      }
View Full Code Here

Examples of org.infoset.xml.DocumentLoader

         // Should be an entry
         Document doc = null;
         if (entity instanceof InfosetRepresentation) {
            doc = ((InfosetRepresentation)entity).getDocument();
         } else {
            DocumentLoader loader = new SAXDocumentLoader();
            try {
               Reader r = new InputStreamReader(entity.getStream(),charset);
               doc = loader.load(r);
               r.close();
            } catch (IOException ex) {
               getResponse().setStatus(Status.CLIENT_ERROR_BAD_REQUEST);
               return new StringRepresentation("I/O error while parsing document: "+ex.getMessage());
            } catch (XMLException ex) {
View Full Code Here

Examples of org.infoset.xml.DocumentLoader

      String charset = entity.getMediaType().getParameters().getValues("charset");
      if (charset==null) {
         charset = "UTF-8";
      }
      try {
         DocumentLoader loader = new SAXDocumentLoader();
         Reader r = new InputStreamReader(entity.getStream(),charset);
         Document doc = loader.load(r);
         r.close();
        
         try {
            app.updateFeed(feed,doc);
            getResponse().setStatus(Status.SUCCESS_NO_CONTENT);
View Full Code Here

Examples of org.infoset.xml.DocumentLoader

         Representation entryRep = app.getEntryRepresentation(feedBaseURI,feed,entry.getUUID());
         // avoid a thread with the entry's output representation
         StringWriter sw = new StringWriter();
         entryRep.write(sw);
         entryRep.release();
         DocumentLoader loader = new SAXDocumentLoader();
         Document doc = loader.load(new StringReader(sw.toString()));
        
         // mark the entry as edited
         Date date = media.getEntry().edited();
        
         // change the entry's edited element
View Full Code Here

Examples of org.infoset.xml.DocumentLoader

         Representation entryRep = app.getEntryRepresentation(feedBaseURI,feed,entry.getUUID());
         // avoid a thread with the entry's output representation
         StringWriter sw = new StringWriter();
         entryRep.write(sw);
         entryRep.release();
         DocumentLoader loader = new SAXDocumentLoader();
         Document doc = loader.load(new StringReader(sw.toString()));
        
         // mark the entry as edited
         Date date = media.getEntry().edited();
        
         // change the entry's edited element
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.