Package org.infoset.xml.util

Examples of org.infoset.xml.util.DocumentDestination


      request.setEntity(rep);
      Response entryResponse = editClient.handle(request);
      if (!entryResponse.getStatus().isSuccess()) {
         throw new StatusException("Cannot retrieve new entry from "+location,entryResponse.getStatus());
      }
      DocumentDestination docDest = new DocumentDestination();
      XMLRepresentationParser parser = new XMLRepresentationParser();
      parser.parse(entryResponse,docDest);
      Entry newEntry = new Entry(docDest.getDocument());
      newEntry.index();
      return newEntry;
   }
View Full Code Here


     
      final DB db = (DB)getRequest().getAttributes().get(App.DB_ATTR);
      final Storage storage = (Storage)getRequest().getAttributes().get(App.STORAGE_ATTR);
      XMLRepresentationParser parser = new XMLRepresentationParser();
      try {
         DocumentDestination dest = new DocumentDestination();
        
         parser.parse(entity,AdminApplication.createAdminDocumentDestination(dest,AdminXML.NM_RESTORE));
         Document doc = dest.getDocument();
        
         Element top = doc.getDocumentElement();
         String location = top.getAttributeValue("location");
         if (location!=null) {
            location = location.trim();
View Full Code Here

      }
     
      XMLRepresentationParser parser = new XMLRepresentationParser();
     
      try {
         DocumentDestination dest = new DocumentDestination();
        
         parser.parse(entity,AdminApplication.createAdminDocumentDestination(dest,AdminXML.NM_BACKUP));
         Document doc = dest.getDocument();
        
         Element top = doc.getDocumentElement();
         String location = top.getAttributeValue("location");
         if (location==null) {
            getResponse().setStatus(Status.CLIENT_ERROR_BAD_REQUEST);
View Full Code Here

         return new StringRepresentation("Non-XML media type for entity body: "+entity.getMediaType().getName());
      }
      Document doc = null;
     
      try {
         DocumentDestination dest = new DocumentDestination();
         parser.parse(entity,dest);
         doc = dest.getDocument();
         Element top = doc.getDocumentElement();
         String sid = top.getAttributeValue("id");
         String alias = top.getAttributeValue("alias");
         if (sid==null && alias==null) {
            getResponse().setStatus(Status.CLIENT_ERROR_BAD_REQUEST);
View Full Code Here

         return new StringRepresentation("Non-XML media type for entity body: "+entity.getMediaType().getName());
      }
      Document doc = null;
     
      try {
         DocumentDestination dest = new DocumentDestination();
         parser.parse(entity,dest);
         doc = dest.getDocument();
      } catch (Exception ex) {
         getResponse().setStatus(Status.CLIENT_ERROR_BAD_REQUEST);
         return new StringRepresentation("XML parse error: "+ex.getMessage());
      }
      try {
View Full Code Here

         return new StringRepresentation("Non-XML media type for entity body: "+entity.getMediaType().getName());
      }
      Document doc = null;
     
      try {
         DocumentDestination dest = new DocumentDestination();
         postParser.parse(entity,dest);
         doc = dest.getDocument();
      } catch (Exception ex) {
         getResponse().setStatus(Status.CLIENT_ERROR_BAD_REQUEST);
         return new StringRepresentation("XML parse error: "+ex.getMessage());
      }
     
View Full Code Here

         return new StringRepresentation("Non-XML media type for entity body: "+entity.getMediaType().getName());
      }
      Document doc = null;
     
      try {
         DocumentDestination dest = new DocumentDestination();
         parser.parse(entity,dest);
         doc = dest.getDocument();
         Element top = doc.getDocumentElement();
         String sid = top.getAttributeValue("id");
         UUID id = sid==null ? UUID.randomUUID() : UUID.fromString(sid);
         String name = top.getAttributeValue("name");
View Full Code Here

            switch (level) {
               case 1:
                  if (!e.getName().equals(XML.FEED_NAME)) {
                     throw new XMLException("Feed does not start with an Atom 'feed' element: "+e.getName(),(Location)e);
                  }
                  docDest = new DocumentDestination();
                  //System.out.println("Feed: "+e.isBaseURIInherited()+", "+e.getBaseURI());
                  docDest.send(e.getInfoset().createItemConstructor().createDocument(e.getBaseURI()));
                  docDest.send(e);
                  break;
               case 2:
                  if (!feedSent) {
                     if (e.getName().equals(XML.ENTRY_NAME)) {
                        // send the feed document
                        this.onFeed(docDest.getDocument());
                        feedSent = true;
                        // Now collect the first entry
                        //System.out.println("Entry: "+e.isBaseURIInherited()+", "+e.getBaseURI());
                        docDest = new DocumentDestination();
                        docDest.send(e.getInfoset().createItemConstructor().createDocument(e.getBaseURI()));
                        e.localizeNamespaceDeclarations();
                        docDest.send(e);
                     } else {
                        docDest.send(e);
                     }
                  } else {
                     if (!e.getName().equals(XML.ENTRY_NAME)) {
                        throw new XMLException("Non-entry element after the first entry: "+e.getName(),(Location)e);
                     }
                    
                     // collect the entry
                     //System.out.println("Entry: "+e.isBaseURIInherited()+", "+e.getBaseURI());
                     docDest = new DocumentDestination();
                     docDest.send(e.getInfoset().createItemConstructor().createDocument(e.getBaseURI()));
                     docDest.send(e);
                  }
                  break;
               default:
View Full Code Here

         return new StringRepresentation("Non-XML media type for entity body: "+entity.getMediaType().getName());
      }
      Document doc = null;
     
      try {
         DocumentDestination dest = new DocumentDestination();
         parser.parse(entity,dest);
         doc = dest.getDocument();
      } catch (Exception ex) {
         getResponse().setStatus(Status.CLIENT_ERROR_BAD_REQUEST);
         return new StringRepresentation("XML parse error: "+ex.getMessage());
      }
     
View Full Code Here

         return new StringRepresentation("Non-XML media type for entity body: "+entity.getMediaType().getName());
      }
      Document doc = null;
     
      try {
         DocumentDestination dest = new DocumentDestination();
         postParser.parse(entity,dest);
         doc = dest.getDocument();
      } catch (Exception ex) {
         getResponse().setStatus(Status.CLIENT_ERROR_BAD_REQUEST);
         return new StringRepresentation("XML parse error: "+ex.getMessage());
      }
     
View Full Code Here

TOP

Related Classes of org.infoset.xml.util.DocumentDestination

Copyright © 2018 www.massapicom. 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.